lkml.org 
[lkml]   [2009]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/2] pciehp_driver.c: PCIe hot plug for Intel iommu - call IOMMU API in hot remove
IOMMU API iommu_detach_devcie() is called to hot remove a PCIe device.

A hot added device will be added into an IOMMU domain when it first does IOMMU
op. So there is no need to add more code for hot add.

Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>

---
drivers/pci/pci-driver.c | 8 ++++++++
1 files changed, 8 insertions(+)
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index e5d47be..b8f0592 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -17,6 +17,7 @@
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/cpu.h>
+#include <linux/iommu.h>
#include "pci.h"

struct pci_dynid {
@@ -390,6 +391,13 @@ static int pci_device_remove(struct device * dev)
*/

pci_dev_put(pci_dev);
+
+ /*
+ * Remove this pci device from its iommu domain.
+ */
+ if (iommu_found())
+ iommu_detach_device(NULL, dev);
+
return 0;
}


\
 
 \ /
  Last update: 2009-10-02 23:25    [from the cache]
©2003-2011 Jasper Spaans