mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Yinghai Lu <yhlu.kernel@gmail.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>,
	"Barnes, Jesse" <jesse.barnes@intel.com>,
	Greg KH <gregkh@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	torvalds@linux-foundation.org, jbarnes@virtuousgeek.org,
	stable@kernel.org, iommu@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [stable][PATCH] PCIe hot-plug for Intel IOMMU
Date: Sat, 28 Nov 2009 06:17:37 +0000	[thread overview]
Message-ID: <1259389057.3691.2186.camel@macbook.infradead.org> (raw)
In-Reply-To: <86802c440911111327o49bb2b09xc8ab801ce281d04@mail.gmail.com>

On Wed, 2009-11-11 at 13:27 -0800, Yinghai Lu wrote:
> On Wed, Nov 11, 2009 at 7:23 AM, Fenghua Yu <fenghua.yu@intel.com> wrote:
> > To support PCIe hot plug in IOMMU, we register a notifier to respond to device
> > change action.
> >
> > When the notifier gets BUS_NOTIFY_UNBOUND_DRIVER, it removes the device from its
> > DMAR domain.
> >
> > 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.
> >
> > Without the patch, after a hot-remove, a hot-added device on the same slot will
> > not work.
> >
> > Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
> 
> Tested-by: Yinghai Lu <yinghai@kernel.org>

But not with 'intel_iommu=igfx_off', I note. The call to find_domain()
will oops when it runs on the graphics device with ->archdata.iommu ==
DUMMY_DEVICE_DOMAIN_INFO (== -1). All other calls to find_domain() are
guaranteed not to happen for such devices.

One might argue that find_domain() should cope, but do we really want to
be doing that extra check in the unmap fast path?

Testing this fix now...

diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 1840a05..f44a015 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -3228,6 +3228,9 @@ static int device_notifier(struct notifier_block *nb,
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct dmar_domain *domain;
 
+	if (iommu_no_mapping(dev))
+		return 0;
+
 	domain = find_domain(pdev);
 	if (!domain)
 		return 0;


-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation


  reply	other threads:[~2009-11-28  6:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-04 22:59 [PATCH] intel-iommu: Obey coherent_dma_mask for alloc_coherent on passthrough Alex Williamson
2009-11-06  2:41 ` FUJITA Tomonori
2009-11-06  3:19   ` Alex Williamson
2009-11-06  3:34     ` FUJITA Tomonori
2009-11-06  4:09       ` Alex Williamson
2009-11-09 23:02   ` David Woodhouse
2009-11-09 23:32     ` Alex Williamson
2009-11-10  0:19       ` David Woodhouse
2009-11-11 15:23     ` [stable][PATCH] PCIe hot-plug for Intel IOMMU Fenghua Yu
2009-11-11 21:27       ` Yinghai Lu
2009-11-28  6:17         ` David Woodhouse [this message]
2009-11-12  2:37       ` David Woodhouse
2009-11-12 23:32         ` Yu, Fenghua
2009-11-10  0:46 ` [PATCH] intel-iommu: Obey coherent_dma_mask for alloc_coherent on passthrough David Woodhouse
2009-11-10  1:01   ` David Woodhouse
2009-11-10  1:28     ` Alex Williamson

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=1259389057.3691.2186.camel@macbook.infradead.org \
    --to=dwmw2@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=fenghua.yu@intel.com \
    --cc=gregkh@suse.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jbarnes@virtuousgeek.org \
    --cc=jesse.barnes@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=yhlu.kernel@gmail.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

all inboxes | Powered by JetHome®