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 1/2] intel-iommu: PCIe hot plug for Intel iommu - IOMMU API
Date: Fri, 2 Oct 2009 14:18:27 -0700 [thread overview]
Message-ID: <20091002211826.GA11326@linux-os.sc.intel.com> (raw)
In-Reply-To: <C2866F9FC4CB034EB51A633DF168598605E2D2EE@ssbarcelone>
We expand existing IOMMU API iommu_detach_device for PCIe hot remove. We don't
need IOMMU API for hot add.
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
drivers/pci/intel-iommu.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 855dd7c..5c12283 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -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);
}
next parent reply other threads:[~2009-10-02 21:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <A6AD88C3F2289247BE726C37303E1EB8BC06E356@orsmsx505.amr.corp.intel.com>
[not found] ` <715D42877B251141A38726ABF5CABF2C05505A7433@pdsmsx503.ccr.corp.intel.com>
[not found] ` <C2866F9FC4CB034EB51A633DF168598605E2D2EE@ssbarcelone>
2009-10-02 21:18 ` Fenghua Yu [this message]
2009-10-05 6:59 ` [PATCH 1/2] intel-iommu: PCIe hot plug for Intel iommu - IOMMU API David Woodhouse
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=20091002211826.GA11326@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