[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220513003233.4442-1-nicolinc@nvidia.com>
Date: Thu, 12 May 2022 17:32:33 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: <dwmw2@...radead.org>, <baolu.lu@...ux.intel.com>,
<joro@...tes.org>, <will@...nel.org>
CC: <jgg@...dia.com>, <iommu@...ts.linux-foundation.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH] iommu/vt-d: Try info->iommu in device_to_iommu()
Local boot test and VFIO sanity test show that info->iommu can be
used in device_to_iommu() as a fast path. So this patch adds it.
Signed-off-by: Nicolin Chen <nicolinc@...dia.com>
---
drivers/iommu/intel/iommu.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 2990f80c5e08..412fca5ab9cd 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -777,6 +777,7 @@ static bool iommu_is_dummy(struct intel_iommu *iommu, struct device *dev)
struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn)
{
struct dmar_drhd_unit *drhd = NULL;
+ struct device_domain_info *info;
struct pci_dev *pdev = NULL;
struct intel_iommu *iommu;
struct device *tmp;
@@ -786,6 +787,10 @@ struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn)
if (!dev)
return NULL;
+ info = dev_iommu_priv_get(dev);
+ if (info)
+ return info->iommu;
+
if (dev_is_pci(dev)) {
struct pci_dev *pf_pdev;
--
2.17.1
Powered by blists - more mailing lists