lkml.org 
[lkml]   [2022]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v10 04/12] iommu: Add attach/detach_dev_pasid iommu interface
On Tue, Aug 02, 2022 at 10:19:08AM +0800, Baolu Lu wrote:
> Hi Jason,
>
> On 7/26/22 9:57 PM, Jason Gunthorpe wrote:
> > > + /*
> > > + * Block PASID attachment in all cases where the PCI fabric is
> > > + * routing based on address. ACS disables it.
> > > + */
> > > + if (dev_is_pci(dev) &&
> > > + !pci_acs_path_enabled(to_pci_dev(dev), NULL, REQ_ACS_FLAGS))
> > > + return -ENODEV;
> > I would probably still put this in a function just to be clear, and
> > probably even a PCI layer funcion 'pci_is_pasid_supported' that
> > clearly indicates that the fabric path can route a PASID packet
> > without mis-routing it.
>
> I am fine with putting above in a function to make it clear. But I am
> hesitant to move this part of logic into the PCI layer.
>
> From the perspective of IOMMU, TLPs with PASID prefix form distinct
> address spaces, so it's reasonable to require ACS protection on the
> upstream path.
>
> But PCI spec doesn't require this. The interfaces defined in drivers/pci
> /ats.c should work as well even the IOMMU is disabled.

No, I don't think so, that is useless.

PCI SIG has given a bunch of tools, and it is up to the system
software to figure out how to use them.

There is no reasonable case where Linux would want PASID and broken
fabric routing - so just block it at the PCI layer.

> Yes, agreed. The iommu groups are not an issue any more. But just like
> iommu_attach_device(), if multiple devices share a group, there must be
> some mechanism to make sure that device drivers are aware of this fact
> and only attach a shared domain to any PASID of those devices.'
> Otherwise, the iommu_attach/detach_dev_pasid() might be misused.

I think it is the same as the existing attach logic for groups, with
the sharing, owern and everything else did. No change for pasid.

> Considering that all existing PASID use cases are singleton group case,
> probably we can start our support from the simple singleton group case?

Don't make confusing unnecessary special cases please.

Jason

\
 
 \ /
  Last update: 2022-08-02 14:37    [W:0.282 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site