[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5f4uclyawwh57u5pdwlk5q36keeg3oyhk5hw42xgnryz6xs7ph@rrkulj4ex2xb>
Date: Sat, 4 Oct 2025 23:04:35 +0530
From: Manivannan Sadhasivam <mani@...nel.org>
To: Robin Murphy <robin.murphy@....com>
Cc: Bjorn Helgaas <helgaas@...nel.org>,
manivannan.sadhasivam@....qualcomm.com, Bjorn Helgaas <bhelgaas@...gle.com>,
Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>, linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
Joerg Roedel <jroedel@...e.de>, iommu@...ts.linux.dev, Anders Roxell <anders.roxell@...aro.org>,
Naresh Kamboju <naresh.kamboju@...aro.org>, Pavankumar Kondeti <quic_pkondeti@...cinc.com>,
Xingang Wang <wangxingang5@...wei.com>, Marek Szyprowski <m.szyprowski@...sung.com>,
stable@...r.kernel.org
Subject: Re: [PATCH 2/2] iommu/of: Call pci_request_acs() before enumerating
the Root Port device
On Wed, Sep 24, 2025 at 08:49:26PM +0100, Robin Murphy wrote:
[...]
> > I don't doubt that the current code doesn't detect presence or use of
> > IOMMU until later. But that feels like an implementation defect
> > because logically the IOMMU is upstream of any PCI device that uses
> > it, so architecturally I would expect it to be *possible* to detect it
> > before PCI enumeration.
> >
> > More to the point, it's not at all obvious how to infer that
> > 'iommu-map' in the devicetree means the IOMMU will be used.
>
> Indeed, I would say the way to go down that route would be to echo what we
> do for "iommus", and defer probing the entire host controller driver until
> the targets of an "iommu-map" are either present or assumed to never be
> appearing. (And of course an ACPI equivalent for that would be tricky...)
>
Maybe we should just call pci_enable_acs() only when the iommu is detected for
the device? But ofc, this is not possible for non-OF platforms as they tend to
call pci_request_acs() pretty early.
> However, even that isn't necessarily the full solution, as just as it's not
> really appropriate for PCI to force ACS without knowing whether an IOMMU is
> actually present to make it meaningful, it's also not strictly appropriate
> for an IOMMU driver to request ACS globally without knowing that it actually
> serves any relevant PCIe devices. Even in the ideal scenario, I think the
> point of actually knowing is still a bit too late for the current API
> design:
>
> pci_device_add
> pci_init_capabilities
> pci_acs_init
> pci_enable_acs
> device_add
> iommu_bus_notifier
> iommu_probe_device
> //logically, request ACS for dev here
>
> (at the moment, iommu_probe_device() will actually end up calling into the
> same of_iommu_configure()->pci_request_acs() path, but the plan is still to
> eventually shorten and streamline that.)
>
What is worrying me is that of_iommu_configure() is called for each PCI device,
as opposed to just one time on other platforms. But I think that's a good thing
to have as the IOMMU driver can have a per-device ACS policy, instead of a
global one.
> I guess we might want to separate the actual ACS enablement from the basic
> capability init, or at least perhaps just call pci_enable_acs() again after
> the IOMMU notifier may have changed the policy?
>
Is this applicable to other platforms as well? Not just OF?
- Mani
--
மணிவண்ணன் சதாசிவம்
Powered by blists - more mailing lists