On 7/1/25 9:04 PM, Jason Gunthorpe wrote:
On Tue, Jul 01, 2025 at 01:29:05PM -0600, Alex Williamson wrote:
On Mon, 30 Jun 2025 19:28:33 -0300
Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index d265de874b14b6..f4584ffacbc03d 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -65,8 +65,16 @@ struct iommu_group {
struct list_head entry;
unsigned int owner_cnt;
void *owner;
+
+ /* Used by the device_group() callbacks */
+ u32 bus_data;
};
+/*
+ * Everything downstream of this group should share it.
+ */
+#define BUS_DATA_PCI_UNISOLATED BIT(0)
NON_ISOLATED for consistency w/ enum from the previous patch?
Yes
- /* No shared group found, allocate new */
- return iommu_group_alloc();
+ switch (pci_bus_isolated(pdev->bus)) {
+ case PCIE_ISOLATED:
+ /* Check multi-function groups and same-bus devfn aliases */
+ group = pci_get_alias_group(pdev);
+ if (group)
+ return group;
+
+ /* No shared group found, allocate new */
+ return iommu_group_alloc();
I'm not following how we'd handle a multi-function root port w/o
consistent ACS isolation here. How/where does the resulting group get
the UNISOLATED flag set?
Still wobbly on the root port/root bus.. So the answer is probably
that it doesn't.
What does a multi-function root port with different ACS flags even
mean and how should we treat it? I had in mind that the first root
port is the TA and immediately goes the IOMMU.
I'm looking for clarification what you are asking...
when you say 'multi-function root port', do you mean an RP that is a function
in a MFD in an RC ? other? A more explicit (complex?) example be given to
clarify?
IMO, the rule of MFD in an RC applies here, and that means the per-function ACS rules
for an MFD apply -- well, that's how I read section 6.12 (PCIe 7.0.-1.0-PUB).
This may mean checking ACS P2P Egress Control. Table 6-11 may help wrt Egress control bits & RPs & Fcns.
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.
- Don
If you can explain a bit more about how you see the root ports working
I can try to make an implementation.
AFAICT the spec sort of says 'implementation defined' for ACS on root
ports??
Thanks,
Jason