Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1714275 > unrolled thread

[PATCH v2 0/4] VMD fixups

Started byJon Derrick <jonathan.derrick@intel.com>
First post2017-08-17 20:20 +0200
Last post2017-08-24 18:10 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/4] VMD fixups Jon Derrick <jonathan.derrick@intel.com> - 2017-08-17 20:20 +0200
    [PATCH v2 4/4] iommu: Prevent VMD child devices from being remapping targets Jon Derrick <jonathan.derrick@intel.com> - 2017-08-17 20:20 +0200
      Re: [PATCH v2 4/4] iommu: Prevent VMD child devices from being  remapping targets Bjorn Helgaas <helgaas@kernel.org> - 2017-08-18 18:10 +0200
        Re: [PATCH v2 4/4] iommu: Prevent VMD child devices from being  remapping targets Robin Murphy <robin.murphy@arm.com> - 2017-08-18 18:40 +0200
        Re: [PATCH v2 4/4] iommu: Prevent VMD child devices from being  remapping targets Bjorn Helgaas <helgaas@kernel.org> - 2017-08-24 18:10 +0200

#1714275 — [PATCH v2 0/4] VMD fixups

FromJon Derrick <jonathan.derrick@intel.com>
Date2017-08-17 20:20 +0200
Subject[PATCH v2 0/4] VMD fixups
Message-ID<ufxyF-7o-3@gated-at.bofh.it>
Mostly just cleanup in this revision, eg, trying to limit scope of vmd code to
x86

Previous:
https://patchwork.kernel.org/patch/9886095/
https://patchwork.kernel.org/patch/9886097/
https://patchwork.kernel.org/patch/9886101/


Jon Derrick (4):
  MAINTAINERS: Add Jonathan Derrick as VMD maintainer
  pci/x86: Move VMD quirks to x86 fixups
  x86/PCI: Use is_vmd rather than relying on the domain number
  iommu: Prevent VMD child devices from being remapping targets

 MAINTAINERS                 |  1 +
 arch/x86/pci/fixup.c        | 18 ++++++++++++++++++
 drivers/iommu/intel-iommu.c |  5 +++++
 drivers/pci/quirks.c        | 17 -----------------
 4 files changed, 24 insertions(+), 17 deletions(-)

-- 
2.9.4

[toc] | [next] | [standalone]


#1714277 — [PATCH v2 4/4] iommu: Prevent VMD child devices from being remapping targets

FromJon Derrick <jonathan.derrick@intel.com>
Date2017-08-17 20:20 +0200
Subject[PATCH v2 4/4] iommu: Prevent VMD child devices from being remapping targets
Message-ID<ufxyG-7o-21@gated-at.bofh.it>
In reply to#1714275
VMD child devices must use the VMD endpoint's ID as the requester.
Because of this, there needs to be a way to link the parent VMD
endpoint's iommu group and associated mappings to the VMD child devices
such that attaching and detaching child devices modify the endpoint's
mappings, while preventing early detaching on a singular device removal
or unbinding.

The reassignment of individual VMD child devices devices to VMs is
outside the scope of VMD, but may be implemented in the future. For now
it is best to prevent any such attempts.

This patch prevents VMD child devices from returning an IOMMU, which
prevents it from exposing an iommu_group sysfs directories and allowing
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..94353a6e 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -901,6 +901,11 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf
 		struct pci_dev *pf_pdev;
 
 		pdev = to_pci_dev(dev);
+
+		/* VMD child devices currently cannot be handled individually */
+		if (is_vmd(pdev->bus))
+			return NULL;
+
 		/* VFs aren't listed in scope tables; we need to look up
 		 * the PF instead to find the IOMMU. */
 		pf_pdev = pci_physfn(pdev);
-- 
2.9.4

[toc] | [prev] | [next] | [standalone]


#1715290 — Re: [PATCH v2 4/4] iommu: Prevent VMD child devices from being remapping targets

FromBjorn Helgaas <helgaas@kernel.org>
Date2017-08-18 18:10 +0200
SubjectRe: [PATCH v2 4/4] iommu: Prevent VMD child devices from being remapping targets
Message-ID<ufS0q-63B-21@gated-at.bofh.it>
In reply to#1714277
[+cc Robin]

This series looks fine to me as far as PCI is concerned, and I'd be
happy to take it via my tree given an ack from David for this IOMMU
piece.  Alternatively, you can add my

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

to the other patches if you want to take it via another tree.

Robin raised a question about basically this same patch the first time
around.  Not sure whether there's still an objection there.

On Thu, Aug 17, 2017 at 12:10:14PM -0600, Jon Derrick wrote:
> VMD child devices must use the VMD endpoint's ID as the requester.
> Because of this, there needs to be a way to link the parent VMD
> endpoint's iommu group and associated mappings to the VMD child devices
> such that attaching and detaching child devices modify the endpoint's
> mappings, while preventing early detaching on a singular device removal
> or unbinding.
> 
> The reassignment of individual VMD child devices devices to VMs is
> outside the scope of VMD, but may be implemented in the future. For now
> it is best to prevent any such attempts.
> 
> This patch prevents VMD child devices from returning an IOMMU, which
> prevents it from exposing an iommu_group sysfs directories and allowing
> 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..94353a6e 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -901,6 +901,11 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf
>  		struct pci_dev *pf_pdev;
>  
>  		pdev = to_pci_dev(dev);
> +
> +		/* VMD child devices currently cannot be handled individually */
> +		if (is_vmd(pdev->bus))
> +			return NULL;
> +
>  		/* VFs aren't listed in scope tables; we need to look up
>  		 * the PF instead to find the IOMMU. */
>  		pf_pdev = pci_physfn(pdev);
> -- 
> 2.9.4
> 

[toc] | [prev] | [next] | [standalone]


#1715312 — Re: [PATCH v2 4/4] iommu: Prevent VMD child devices from being remapping targets

FromRobin Murphy <robin.murphy@arm.com>
Date2017-08-18 18:40 +0200
SubjectRe: [PATCH v2 4/4] iommu: Prevent VMD child devices from being remapping targets
Message-ID<ufStr-6iz-19@gated-at.bofh.it>
In reply to#1715290
On 18/08/17 17:04, Bjorn Helgaas wrote:
> [+cc Robin]
> 
> This series looks fine to me as far as PCI is concerned, and I'd be
> happy to take it via my tree given an ack from David for this IOMMU
> piece.  Alternatively, you can add my
> 
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> to the other patches if you want to take it via another tree.
> 
> Robin raised a question about basically this same patch the first time
> around.  Not sure whether there's still an objection there.

Oh, I don't actually mind the patch as-is - implementing proper IOMMU
group support for VMD almost certainly should be the longer-term goal,
but for all I know that may be non-trivial so in the meantime a quick
and simple way to make things safe is good, however heavy-handed.

Robin.

> On Thu, Aug 17, 2017 at 12:10:14PM -0600, Jon Derrick wrote:
>> VMD child devices must use the VMD endpoint's ID as the requester.
>> Because of this, there needs to be a way to link the parent VMD
>> endpoint's iommu group and associated mappings to the VMD child devices
>> such that attaching and detaching child devices modify the endpoint's
>> mappings, while preventing early detaching on a singular device removal
>> or unbinding.
>>
>> The reassignment of individual VMD child devices devices to VMs is
>> outside the scope of VMD, but may be implemented in the future. For now
>> it is best to prevent any such attempts.
>>
>> This patch prevents VMD child devices from returning an IOMMU, which
>> prevents it from exposing an iommu_group sysfs directories and allowing
>> 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..94353a6e 100644
>> --- a/drivers/iommu/intel-iommu.c
>> +++ b/drivers/iommu/intel-iommu.c
>> @@ -901,6 +901,11 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf
>>  		struct pci_dev *pf_pdev;
>>  
>>  		pdev = to_pci_dev(dev);
>> +
>> +		/* VMD child devices currently cannot be handled individually */
>> +		if (is_vmd(pdev->bus))
>> +			return NULL;
>> +
>>  		/* VFs aren't listed in scope tables; we need to look up
>>  		 * the PF instead to find the IOMMU. */
>>  		pf_pdev = pci_physfn(pdev);
>> -- 
>> 2.9.4
>>

[toc] | [prev] | [next] | [standalone]


#1719369 — Re: [PATCH v2 4/4] iommu: Prevent VMD child devices from being remapping targets

FromBjorn Helgaas <helgaas@kernel.org>
Date2017-08-24 18:10 +0200
SubjectRe: [PATCH v2 4/4] iommu: Prevent VMD child devices from being remapping targets
Message-ID<ui2RI-kG-31@gated-at.bofh.it>
In reply to#1715290
On Fri, Aug 18, 2017 at 11:04:33AM -0500, Bjorn Helgaas wrote:
> [+cc Robin]
> 
> This series looks fine to me as far as PCI is concerned, and I'd be
> happy to take it via my tree given an ack from David for this IOMMU
> piece.  Alternatively, you can add my
> 
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> to the other patches if you want to take it via another tree.
> 
> Robin raised a question about basically this same patch the first time
> around.  Not sure whether there's still an objection there.

Ping, David, any thoughts on this patch?

> On Thu, Aug 17, 2017 at 12:10:14PM -0600, Jon Derrick wrote:
> > VMD child devices must use the VMD endpoint's ID as the requester.
> > Because of this, there needs to be a way to link the parent VMD
> > endpoint's iommu group and associated mappings to the VMD child devices
> > such that attaching and detaching child devices modify the endpoint's
> > mappings, while preventing early detaching on a singular device removal
> > or unbinding.
> > 
> > The reassignment of individual VMD child devices devices to VMs is
> > outside the scope of VMD, but may be implemented in the future. For now
> > it is best to prevent any such attempts.
> > 
> > This patch prevents VMD child devices from returning an IOMMU, which
> > prevents it from exposing an iommu_group sysfs directories and allowing
> > 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..94353a6e 100644
> > --- a/drivers/iommu/intel-iommu.c
> > +++ b/drivers/iommu/intel-iommu.c
> > @@ -901,6 +901,11 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf
> >  		struct pci_dev *pf_pdev;
> >  
> >  		pdev = to_pci_dev(dev);
> > +
> > +		/* VMD child devices currently cannot be handled individually */
> > +		if (is_vmd(pdev->bus))
> > +			return NULL;
> > +
> >  		/* VFs aren't listed in scope tables; we need to look up
> >  		 * the PF instead to find the IOMMU. */
> >  		pf_pdev = pci_physfn(pdev);
> > -- 
> > 2.9.4
> > 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web