On Fri, 01 Nov 2024 21:04:39 +0000, Frank Li <Frank.Li@xxxxxxx> wrote: > > Some PCIe host bridges require special handling when enabling or disabling > PCIe Endpoints. For example, the i.MX95 platform has a lookup table to map > Requester IDs to StreamIDs, which are used by the SMMU and MSI controller > to identify the source of DMA accesses. > > Without this mapping, DMA accesses may target unintended memory, which > would corrupt memory or read the wrong data. > > Add a host bridge .enable_device() hook the imx6 driver can use to > configure the Requester ID to StreamID mapping. The hardware table isn't > big enough to map all possible Requester IDs, so this hook may fail if no > table space is available. In that case, return failure from > pci_enable_device(). > > It might make more sense to make pci_set_master() decline to enable bus > mastering and return failure, but it currently doesn't have a way to return > failure. > > Acked-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx> > Signed-off-by: Frank Li <Frank.Li@xxxxxxx> I converted the fruity PCIe controller over to this infrastructure, and things seem to work fine. FWIW: Reviewed-by: Marc Zyngier <maz@xxxxxxxxxx> Tested-by: Marc Zyngier <maz@xxxxxxxxxx> M. -- Without deviation from the norm, progress is not possible.