On 9/9/25 8:18 AM, Jason Gunthorpe wrote:
On Tue, Sep 09, 2025 at 12:14:00AM -0400, Donald Dutile wrote:
-/*
- * Use standard PCI bus topology, isolation features, and DMA alias quirks
- * to find or create an IOMMU group for a device.
- */
-struct iommu_group *pci_device_group(struct device *dev)
+static struct iommu_group *pci_group_alloc_non_isolated(void)
Maybe iommu_group_alloc_non_isolated() would be a better name, since that's all it does.
The way I've organized it makes the bus data a per-bus thing, so
having pci in the name when setting BUS_DATA_PCI_NON_ISOLATED is
correct.
What I did was turn iommu_group_alloc() into
static struct iommu_group *iommu_group_alloc_data(u32 bus_data)
Then
struct iommu_group *iommu_group_alloc(void)
{
return iommu_group_alloc_data(0);
}
And instead of pci_group_alloc_non_isolated() it is just:
return iommu_group_alloc_data(BUS_DATA_PCI_NON_ISOLATED);
So everything is setup generically if someday another bus would like
to have its own data.
/my bad, I scanned pci_group_alloc_non_isolated() as calling iommu_group_alloc() & not iommu_group_alloc_data() as you pointed out.
Looks good.
Reviewed-by: Donald Dutile <ddutile@xxxxxxxxxx>
Jason