Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Donald Dutile <ddutile@redhat.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
	linux-pci@vger.kernel.org, Robin Murphy <robin.murphy@arm.com>,
	Will Deacon <will@kernel.org>,
	Lu Baolu <baolu.lu@linux.intel.com>,
	galshalom@nvidia.com, Joerg Roedel <jroedel@suse.de>,
	Kevin Tian <kevin.tian@intel.com>,
	kvm@vger.kernel.org, maorg@nvidia.com, patches@lists.linux.dev,
	tdave@nvidia.com, Tony Zhu <tony.zhu@intel.com>
Subject: Re: [PATCH 03/11] iommu: Compute iommu_groups properly for PCIe switches
Date: Mon, 22 Sep 2025 16:32:00 -0600	[thread overview]
Message-ID: <20250922163200.14025a41.alex.williamson@redhat.com> (raw)
In-Reply-To: <20250718133259.GD2250220@nvidia.com>

On Fri, 18 Jul 2025 10:32:59 -0300
Jason Gunthorpe <jgg@nvidia.com> wrote:

> On Thu, Jul 17, 2025 at 10:31:42PM -0400, Donald Dutile wrote:
>  
> > > > If no (optional) ACS P2P Egress control, and no other ACS control, then I read/decode
> > > > the spec to mean no p2p btwn functions is possible, b/c if it is possible, by spec,
> > > > it must have an ACS cap to control it; ergo, no ACS cap, no p2p capability/routing.  
> > > 
> > > Where did you see this? Linux has never worked this way, we have
> > > extensive ACS quirks specifically because we've assumed no ACS cap
> > > means P2P is possible and not controllable.
> > >   
> > e.g., Section 6.12.1.2 ACS Functions in SR-IOV, SIOV, and Multi-Function Devices
> >  ...
> >  ACS P2P Request Redirect: must be implemented by Functions that support peer-to-peer traffic with other Functions.
> >                            ^^^^
> > 
> > It's been noted/stated/admitted that MFDs have not followed the ACS
> > rules, and thus the quirks may/are needed.
> > 
> > Linux default code should not be opposite of the spec, i.e., if no
> > ACS, then P2P is possible, thus all fcns are part of an IOMMU group.
> > The spec states that ACS support must be provided if p2p traffic
> > with other functions is supported.  
> 
> Linux is definately the opposite of this.
> 
> Alex would you agree to reverse this logic for MFDs? If the MFD does
> not have ACS cap then the MFD does not do internal loopback P2P?
> 
> I think that solves all the MFD related problems.

Sorry, I'm way, way late to responding to this, but I interpret this to
mean that if a multifunction device implements an ACS capability, it
must implement ACS P2P RR if it supports P2P between functions.  If the
ACS capability does not implement ACS P2P RR then we can assume that the
device does not support P2P between functions, but if the device does
not implement an ACS capability at all, we cannot assume anything.

This is effectively why NIC vendors like Intel started implementing an
empty ACS capability, such that we can infer that there is no P2P
between functions.

I'm just catching up from some extended PTO, but this statement in the
cover of the new series is setting off red flags for me:

  For multi-function-devices, a PCIe topology like:

                    -- MFD 00:1f.0 ACS not supported
    Root 00:00.00 --|- MFD 00:1f.2 ACS not supported
                    |- MFD 00:1f.6 ACS = REQ_ACS_FLAGS

  Will group [1f.0, 1f.2] and 1f.6 gets a single device group. However from
  a spec perspective each device should get its own group, because ACS not
  supported can assume no loopback is possible by spec.

The ACS capability was only introduced in PCIe 2.0 and vendors have
only become more diligent about implementing it as it's become
important for device isolation and assignment.  IMO, we can't assume
anything at all about a multifunction device that does not implement
ACS.  Thanks,

Alex


  reply	other threads:[~2025-09-22 22:32 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30 22:28 [PATCH 00/11] Fix incorrect iommu_groups with PCIe switches Jason Gunthorpe
2025-06-30 22:28 ` [PATCH 01/11] PCI: Move REQ_ACS_FLAGS into pci_regs.h as PCI_ACS_ISOLATED Jason Gunthorpe
2025-06-30 22:28 ` [PATCH 02/11] PCI: Add pci_bus_isolation() Jason Gunthorpe
2025-07-01 19:28   ` Alex Williamson
2025-07-02  1:00     ` Jason Gunthorpe
2025-07-03 15:30     ` Jason Gunthorpe
2025-07-03 22:17       ` Alex Williamson
2025-07-03 23:08         ` Alex Williamson
2025-07-03 23:21           ` Jason Gunthorpe
2025-07-03 23:15         ` Jason Gunthorpe
2025-06-30 22:28 ` [PATCH 03/11] iommu: Compute iommu_groups properly for PCIe switches Jason Gunthorpe
2025-07-01 19:29   ` Alex Williamson
2025-07-02  1:04     ` Jason Gunthorpe
2025-07-17 19:25       ` Donald Dutile
2025-07-17 20:27         ` Jason Gunthorpe
2025-07-18  2:31           ` Donald Dutile
2025-07-18 13:32             ` Jason Gunthorpe
2025-09-22 22:32               ` Alex Williamson [this message]
2025-09-22 23:15                 ` Jason Gunthorpe
2025-09-23  0:51                   ` Donald Dutile
2025-09-23  1:17                     ` Alex Williamson
2025-09-23  1:10                   ` Alex Williamson
2025-09-23  2:26                     ` Donald Dutile
2025-09-23  2:50                       ` Alex Williamson
2025-09-23 12:32                         ` Jason Gunthorpe
2025-09-23 12:58                           ` Alex Williamson
2025-09-23 13:03                     ` Jason Gunthorpe
2025-09-23 21:29                       ` Alex Williamson
2025-09-25 12:20                         ` Jason Gunthorpe
2025-06-30 22:28 ` [PATCH 04/11] iommu: Organize iommu_group by member size Jason Gunthorpe
2025-06-30 22:28 ` [PATCH 05/11] PCI: Add pci_reachable_set() Jason Gunthorpe
2025-06-30 22:28 ` [PATCH 06/11] iommu: Use pci_reachable_set() in pci_device_group() Jason Gunthorpe
2025-06-30 22:28 ` [PATCH 07/11] iommu: Validate that pci_for_each_dma_alias() matches the groups Jason Gunthorpe
2025-06-30 22:28 ` [PATCH 08/11] PCI: Add the ACS Enhanced Capability definitions Jason Gunthorpe
2025-06-30 22:28 ` [PATCH 09/11] PCI: Enable ACS Enhanced bits for enable_acs and config_acs Jason Gunthorpe
2025-06-30 22:28 ` [PATCH 10/11] PCI: Check ACS DSP/USP redirect bits in pci_enable_pasid() Jason Gunthorpe
2025-06-30 22:28 ` [PATCH 11/11] PCI: Check ACS Extended flags for pci_bus_isolated() Jason Gunthorpe
2025-07-01 21:48 ` [PATCH 00/11] Fix incorrect iommu_groups with PCIe switches Alex Williamson
2025-07-02  1:47   ` Jason Gunthorpe
2025-07-04  0:37   ` Jason Gunthorpe
2025-07-11 14:55     ` Alex Williamson
2025-07-11 16:08       ` Jason Gunthorpe
2025-07-08 20:47   ` Jason Gunthorpe
2025-07-11 15:40     ` Alex Williamson
2025-07-11 16:14       ` Jason Gunthorpe

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=20250922163200.14025a41.alex.williamson@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=ddutile@redhat.com \
    --cc=galshalom@nvidia.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=jroedel@suse.de \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=maorg@nvidia.com \
    --cc=patches@lists.linux.dev \
    --cc=robin.murphy@arm.com \
    --cc=tdave@nvidia.com \
    --cc=tony.zhu@intel.com \
    --cc=will@kernel.org \
    /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