summaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorVasant Hegde <vasant.hegde@amd.com>2023-02-15 06:26:41 +0100
committerJoerg Roedel <jroedel@suse.de>2023-02-18 15:36:33 +0100
commitf451c7a5a3b818ecfeba2ba258570769998baf3a (patch)
tree193e1d0f360aa18ef814086a58a18acaf7b0a731 /drivers/iommu
parentiommu/amd: Improve page fault error reporting (diff)
downloadlinux-f451c7a5a3b818ecfeba2ba258570769998baf3a.tar.xz
linux-f451c7a5a3b818ecfeba2ba258570769998baf3a.zip
iommu/amd: Skip attach device domain is same as new domain
If device->domain is same as new domain then we can skip the device attach process. Signed-off-by: Vasant Hegde <vasant.hegde@amd.com> Link: https://lore.kernel.org/r/20230215052642.6016-2-vasant.hegde@amd.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd/iommu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index f97c0bf930a7..2aff392d9895 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -2184,6 +2184,13 @@ static int amd_iommu_attach_device(struct iommu_domain *dom,
struct amd_iommu *iommu = rlookup_amd_iommu(dev);
int ret;
+ /*
+ * Skip attach device to domain if new domain is same as
+ * devices current domain
+ */
+ if (dev_data->domain == domain)
+ return 0;
+
dev_data->defer_attach = false;
if (dev_data->domain)