Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1705823 > unrolled thread
| Started by | Jon Derrick <jonathan.derrick@intel.com> |
|---|---|
| First post | 2017-08-07 22:00 +0200 |
| Last post | 2017-08-11 20:20 +0200 |
| Articles | 7 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH 1/3] MAINTAINERS: Add Jonathan Derrick as VMD maintainer Jon Derrick <jonathan.derrick@intel.com> - 2017-08-07 22:00 +0200
[PATCH 3/3] iommu: prevent VMD child devices from being remapping targets Jon Derrick <jonathan.derrick@intel.com> - 2017-08-07 22:00 +0200
Re: [PATCH 3/3] iommu: prevent VMD child devices from being remapping targets Bjorn Helgaas <helgaas@kernel.org> - 2017-08-11 19:20 +0200
Re: [PATCH 3/3] iommu: prevent VMD child devices from being remapping targets Robin Murphy <robin.murphy@arm.com> - 2017-08-11 20:30 +0200
Re: [PATCH 3/3] iommu: prevent VMD child devices from being remapping targets Jon Derrick <jonathan.derrick@intel.com> - 2017-08-11 20:50 +0200
Re: [PATCH 1/3] MAINTAINERS: Add Jonathan Derrick as VMD maintainer Bjorn Helgaas <helgaas@kernel.org> - 2017-08-11 19:30 +0200
Re: [PATCH 1/3] MAINTAINERS: Add Jonathan Derrick as VMD maintainer Keith Busch <keith.busch@intel.com> - 2017-08-11 20:20 +0200
| From | Jon Derrick <jonathan.derrick@intel.com> |
|---|---|
| Date | 2017-08-07 22:00 +0200 |
| Subject | [PATCH 1/3] MAINTAINERS: Add Jonathan Derrick as VMD maintainer |
| Message-ID | <ubWlX-4Np-3@gated-at.bofh.it> |
Add myself as VMD maintainer Signed-off-by: Jon Derrick <jonathan.derrick@intel.com> --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index f66488d..3ec39df 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10090,6 +10090,7 @@ F: drivers/pci/dwc/*imx6* PCI DRIVER FOR INTEL VOLUME MANAGEMENT DEVICE (VMD) M: Keith Busch <keith.busch@intel.com> +M: Jonathan Derrick <jonathan.derrick@intel.com> L: linux-pci@vger.kernel.org S: Supported F: drivers/pci/host/vmd.c -- 2.9.4
[toc] | [next] | [standalone]
| From | Jon Derrick <jonathan.derrick@intel.com> |
|---|---|
| Date | 2017-08-07 22:00 +0200 |
| Subject | [PATCH 3/3] iommu: prevent VMD child devices from being remapping targets |
| Message-ID | <ubWlY-4Np-21@gated-at.bofh.it> |
| In reply to | #1705823 |
VMD child devices must use the VMD endpoint's ID as the DMA source. Because of this, there needs to be a way to link the parent VMD endpoint's DMAR domain to the VMD child devices' DMAR domain such that attaching and detaching child devices modify the endpoint's DMAR mapping and prevents early detaching. This is outside the scope of VMD, so disable binding child devices to prevent unforeseen issues. This functionality may be implemented in the future. This patch prevents VMD child devices from returning an IOMMU, which prevents it from exposing iommu_group sysfs directories and subsequent binding by userspace-access drivers such as VFIO. Signed-off-by: Jon Derrick <jonathan.derrick@intel.com> --- drivers/iommu/intel-iommu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 687f18f..651a6cd 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -905,6 +905,11 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf * the PF instead to find the IOMMU. */ pf_pdev = pci_physfn(pdev); dev = &pf_pdev->dev; + + /* VMD child devices currently cannot be handled individually */ + if (pci_bus_is_vmd(pdev->bus)) + return NULL; + segment = pci_domain_nr(pdev->bus); } else if (has_acpi_companion(dev)) dev = &ACPI_COMPANION(dev)->dev; -- 2.9.4
[toc] | [prev] | [next] | [standalone]
| From | Bjorn Helgaas <helgaas@kernel.org> |
|---|---|
| Date | 2017-08-11 19:20 +0200 |
| Subject | Re: [PATCH 3/3] iommu: prevent VMD child devices from being remapping targets |
| Message-ID | <udlLj-6j5-7@gated-at.bofh.it> |
| In reply to | #1705826 |
On Mon, Aug 07, 2017 at 01:57:13PM -0600, Jon Derrick wrote: > VMD child devices must use the VMD endpoint's ID as the DMA source. > Because of this, there needs to be a way to link the parent VMD > endpoint's DMAR domain to the VMD child devices' DMAR domain such that > attaching and detaching child devices modify the endpoint's DMAR mapping > and prevents early detaching. > > This is outside the scope of VMD, so disable binding child devices to > prevent unforeseen issues. This functionality may be implemented in the > future. > > This patch prevents VMD child devices from returning an IOMMU, which > prevents it from exposing iommu_group sysfs directories and subsequent > binding by userspace-access drivers such as VFIO. > > Signed-off-by: Jon Derrick <jonathan.derrick@intel.com> > --- > drivers/iommu/intel-iommu.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c > index 687f18f..651a6cd 100644 > --- a/drivers/iommu/intel-iommu.c > +++ b/drivers/iommu/intel-iommu.c > @@ -905,6 +905,11 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf > * the PF instead to find the IOMMU. */ > pf_pdev = pci_physfn(pdev); > dev = &pf_pdev->dev; > + > + /* VMD child devices currently cannot be handled individually */ > + if (pci_bus_is_vmd(pdev->bus)) Aah, this is the bigger reason why you want a general "is VMD" thing. But this is still basically x86-specific code (I do see the ia64 in Kconfig, so I guess maybe ia64 as well). But pci_bus_is_vmd() doesn't feel like a generally useful concept. I see why you need things like this quirk, but it's not clear what useful things other code could do with pci_bus_is_vmd() because we don't have a generic concept of how VMD buses are different than other PCI buses. > + return NULL; > + > segment = pci_domain_nr(pdev->bus); > } else if (has_acpi_companion(dev)) > dev = &ACPI_COMPANION(dev)->dev; > -- > 2.9.4 >
[toc] | [prev] | [next] | [standalone]
| From | Robin Murphy <robin.murphy@arm.com> |
|---|---|
| Date | 2017-08-11 20:30 +0200 |
| Subject | Re: [PATCH 3/3] iommu: prevent VMD child devices from being remapping targets |
| Message-ID | <udmR3-6UV-3@gated-at.bofh.it> |
| In reply to | #1705826 |
On 07/08/17 20:57, Jon Derrick wrote: > VMD child devices must use the VMD endpoint's ID as the DMA source. > Because of this, there needs to be a way to link the parent VMD > endpoint's DMAR domain to the VMD child devices' DMAR domain such that > attaching and detaching child devices modify the endpoint's DMAR mapping > and prevents early detaching. That sounds like either pci_device_group() needs modifying, or perhaps that intel-iommu needs its own extended iommu_ops::device_group implementation, to ensure that VMD child devices get put in the same group as their parent - if they share requester IDs they can't feasibly be attached to different domains anyway. Robin. > This is outside the scope of VMD, so disable binding child devices to > prevent unforeseen issues. This functionality may be implemented in the > future. > > This patch prevents VMD child devices from returning an IOMMU, which > prevents it from exposing iommu_group sysfs directories and subsequent > binding by userspace-access drivers such as VFIO. > > Signed-off-by: Jon Derrick <jonathan.derrick@intel.com> > --- > drivers/iommu/intel-iommu.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c > index 687f18f..651a6cd 100644 > --- a/drivers/iommu/intel-iommu.c > +++ b/drivers/iommu/intel-iommu.c > @@ -905,6 +905,11 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf > * the PF instead to find the IOMMU. */ > pf_pdev = pci_physfn(pdev); > dev = &pf_pdev->dev; > + > + /* VMD child devices currently cannot be handled individually */ > + if (pci_bus_is_vmd(pdev->bus)) > + return NULL; > + > segment = pci_domain_nr(pdev->bus); > } else if (has_acpi_companion(dev)) > dev = &ACPI_COMPANION(dev)->dev; >
[toc] | [prev] | [next] | [standalone]
| From | Jon Derrick <jonathan.derrick@intel.com> |
|---|---|
| Date | 2017-08-11 20:50 +0200 |
| Subject | Re: [PATCH 3/3] iommu: prevent VMD child devices from being remapping targets |
| Message-ID | <udnap-72o-13@gated-at.bofh.it> |
| In reply to | #1709903 |
Hi Robin, thanks for the reply. On 08/11/2017 12:25 PM, Robin Murphy wrote: > On 07/08/17 20:57, Jon Derrick wrote: >> VMD child devices must use the VMD endpoint's ID as the DMA source. >> Because of this, there needs to be a way to link the parent VMD >> endpoint's DMAR domain to the VMD child devices' DMAR domain such that >> attaching and detaching child devices modify the endpoint's DMAR mapping >> and prevents early detaching. > > That sounds like either pci_device_group() needs modifying, or perhaps > that intel-iommu needs its own extended iommu_ops::device_group > implementation, to ensure that VMD child devices get put in the same > group as their parent - if they share requester IDs they can't feasibly > be attached to different domains anyway. > > Robin. Yes it seems like that to me too. I have a high-level understanding of the changes required but not too much in the nitty-gritty details. It's a bit more complicated anyways because VMD emerges a set of root ports, and AFAICT, PCI ACS end at the root ports and iommu groups rely on ACS to group devices. Either way it's not within the scope of VMD.
[toc] | [prev] | [next] | [standalone]
| From | Bjorn Helgaas <helgaas@kernel.org> |
|---|---|
| Date | 2017-08-11 19:30 +0200 |
| Message-ID | <udlUZ-6mk-21@gated-at.bofh.it> |
| In reply to | #1705823 |
On Mon, Aug 07, 2017 at 01:57:11PM -0600, Jon Derrick wrote: > Add myself as VMD maintainer > > Signed-off-by: Jon Derrick <jonathan.derrick@intel.com> Keith, I'm looking for an ack from you since you're currently listed in MAINTAINERS. > --- > MAINTAINERS | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index f66488d..3ec39df 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -10090,6 +10090,7 @@ F: drivers/pci/dwc/*imx6* > > PCI DRIVER FOR INTEL VOLUME MANAGEMENT DEVICE (VMD) > M: Keith Busch <keith.busch@intel.com> > +M: Jonathan Derrick <jonathan.derrick@intel.com> > L: linux-pci@vger.kernel.org > S: Supported > F: drivers/pci/host/vmd.c > -- > 2.9.4 >
[toc] | [prev] | [next] | [standalone]
| From | Keith Busch <keith.busch@intel.com> |
|---|---|
| Date | 2017-08-11 20:20 +0200 |
| Message-ID | <udmHn-6RA-11@gated-at.bofh.it> |
| In reply to | #1705823 |
On Mon, Aug 07, 2017 at 01:57:11PM -0600, Jon Derrick wrote: > Add myself as VMD maintainer > > Signed-off-by: Jon Derrick <jonathan.derrick@intel.com> Thanks for adding. Acked-by: Keith Busch <keith.busch@intel.com> > --- > MAINTAINERS | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index f66488d..3ec39df 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -10090,6 +10090,7 @@ F: drivers/pci/dwc/*imx6* > > PCI DRIVER FOR INTEL VOLUME MANAGEMENT DEVICE (VMD) > M: Keith Busch <keith.busch@intel.com> > +M: Jonathan Derrick <jonathan.derrick@intel.com> > L: linux-pci@vger.kernel.org > S: Supported > F: drivers/pci/host/vmd.c > -- > 2.9.4 >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web