From: Fenghua Yu <fenghua.yu@intel.com>
To: David Woodhouse <dwmw2@infradead.org>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
Francois Isabelle <Francois.Isabelle@ca.kontron.com>
Cc: Weidong Han <weidong.han@intel.com>,
iommu@lists.linux-foundation.org,
Grant Grundler <grundler@parisc-linux.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] pciehp_driver.c: PCIe hot plug for Intel iommu - call IOMMU API in hot remove
Date: Fri, 2 Oct 2009 14:18:44 -0700 [thread overview]
Message-ID: <20091002211844.GA14352@linux-os.sc.intel.com> (raw)
In-Reply-To: <72D8A09E39A89147BE9CFBB6F0C73C30607344552A@rrsmsx501.amr.corp.intel.com>
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;
}
next parent reply other threads:[~2009-10-02 21:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <72D8A09E39A89147BE9CFBB6F0C73C306073445396@rrsmsx501.amr.corp.intel.com>
[not found] ` <6E2431EDEB6AE64F827F8A1B0D0DA1A603C322CF@azsmsx501.amr.corp.intel.com>
[not found] ` <72D8A09E39A89147BE9CFBB6F0C73C30607344552A@rrsmsx501.amr.corp.intel.com>
2009-10-02 21:18 ` Fenghua Yu [this message]
2009-10-02 21:50 ` [PATCH 2/2] pciehp_driver.c: PCIe hot plug for Intel iommu - call IOMMU API in hot remove Joerg Roedel
2009-10-03 0:01 ` Fenghua Yu
2009-10-06 18:23 ` [PATCH] PCIe hot plug for Intel iommu Fenghua Yu
2009-10-22 7:07 ` Yinghai Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091002211844.GA14352@linux-os.sc.intel.com \
--to=fenghua.yu@intel.com \
--cc=Francois.Isabelle@ca.kontron.com \
--cc=dwmw2@infradead.org \
--cc=grundler@parisc-linux.org \
--cc=iommu@lists.linux-foundation.org \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=weidong.han@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox