intel-iommu: PCIe hot plug for Intel iommu - IOMMU API
A message that is not in the archive (sent off-list or not yet received): A6AD88C3F2289247BE726C37303E1EB8BC06E356@orsmsx505.amr.corp.intel.com
A message that is not in the archive (sent off-list or not yet received): 715D42877B251141A38726ABF5CABF2C05505A7433@pdsmsx503.ccr.corp.intel.com
A message that is not in the archive (sent off-list or not yet received): C2866F9FC4CB034EB51A633DF168598605E2D2EE@ssbarcelone
PATCH 1/2 intel-iommu: PCIe hot plug for Intel iommu - IOMMU API
We expand existing IOMMU API iommu_detach_device for PCIe hot remove. We don't need IOMMU API for hot add.
---
drivers/pci/intel-iommu.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletion(-)
drivers/pci/intel-iommu.c +12 -1
@@ -3559,9 +3559,20 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,static void intel_iommu_detach_device (struct iommu_domain *domain,struct device *dev) { -struct dmar_domain *dmar_domain = domain->priv; +struct dmar_domain *dmar_domain;struct pci_dev *pdev =to_pci_dev (dev); +/* If domain=NULL, we'll find a valid domain for the device.*/ +if (!domain) { + dmar_domain =find_domain (pdev); +if (!dmar_domain) { +printk (KERN_ERR "Can not find IOMMU domain for %s\n" , +pci_name (pdev)); +return ; + } + }else + dmar_domain = domain->priv; +domain_remove_one_dev_info (dmar_domain, pdev); }
Quoted 2 lines · Fenghua Yu
We expand existing IOMMU API
iommu_detach_devicefor PCIe hot remove. We don't need IOMMU API for hot add.
I think this could do with more explanation. A hot remove will cause detach_device() to be called with a NULL domain parameter? Surely we shouldn't be printing an error with KERN_ERR just because such a device hasn't been used for DMA before it was removed?
Quoted 32 lines
Signed-off-by Fenghua Yu <[email protected]>---
drivers/pci/intel-iommu.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletion(-)drivers/pci/intel-iommu.c +12
-1@@ -3559,9 +3559,20 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,static void intel_iommu_detach_device (struct iommu_domain *domain,struct device *dev) { -struct dmar_domain *dmar_domain = domain->priv; +struct dmar_domain *dmar_domain;struct pci_dev *pdev =to_pci_dev (dev); +/* If domain=NULL, we'll find a valid domain for the device.*/ +if (!domain) { + dmar_domain =find_domain (pdev); +if (!dmar_domain) { +printk (KERN_ERR "Can not find IOMMU domain for %s\n" , +pci_name (pdev)); +return ; + } + }else + dmar_domain = domain->priv; +domain_remove_one_dev_info (dmar_domain, pdev); }
Signature · 1 line
dwmw2