diff options
author | Nicolin Chen <nicolinc@nvidia.com> | 2022-10-18 01:02:21 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2022-11-01 18:39:59 +0100 |
commit | f4a14773579302e5f0c4bf80b03f0db7ce67f2ce (patch) | |
tree | b3a260911369cf6b131b7926874c4ae69cd005c6 /drivers/iommu/virtio-iommu.c | |
parent | iommu: Regulate EINVAL in ->attach_dev callback functions (diff) | |
download | linux-f4a14773579302e5f0c4bf80b03f0db7ce67f2ce.tar.xz linux-f4a14773579302e5f0c4bf80b03f0db7ce67f2ce.zip |
iommu: Use EINVAL for incompatible device/domain in ->attach_dev
Following the new rules in include/linux/iommu.h kdocs, update all drivers
->attach_dev callback functions to return EINVAL in the failure paths that
are related to domain incompatibility.
Also, drop adjacent error prints to prevent a kernel log spam.
Link: https://lore.kernel.org/r/f52a07f7320da94afe575c9631340d0019a203a7.1666042873.git.nicolinc@nvidia.com
Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/iommu/virtio-iommu.c')
-rw-r--r-- | drivers/iommu/virtio-iommu.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 0b64e7f64e68..8226b4da4350 100644 --- a/drivers/iommu/virtio-iommu.c +++ b/drivers/iommu/virtio-iommu.c @@ -734,8 +734,7 @@ static int viommu_attach_dev(struct iommu_domain *domain, struct device *dev) */ ret = viommu_domain_finalise(vdev, domain); } else if (vdomain->viommu != vdev->viommu) { - dev_err(dev, "cannot attach to foreign vIOMMU\n"); - ret = -EXDEV; + ret = -EINVAL; } mutex_unlock(&vdomain->mutex); |