• Robin Murphy's avatar
    ACPI/IORT: Handle PCI aliases properly for IOMMUs · bc8648d4
    Robin Murphy authored
    When a PCI device has DMA quirks, we need to ensure that an upstream
    IOMMU knows about all possible aliases, since the presence of a DMA
    quirk does not preclude the device still also emitting transactions
    (e.g. MSIs) on its 'real' RID. Similarly, the rules for bridge aliasing
    are relatively complex, and some bridges may only take ownership of
    transactions under particular transient circumstances, leading again to
    multiple RIDs potentially being seen at the IOMMU for the given device.
    
    Take all this into account in iort_iommu_configure() by mapping every
    RID produced by the alias walk, not just whichever one comes out last.
    Since adding any more internal PTR_ERR() juggling would have confused me
    no end, a bit of refactoring happens in the process - we know where to
    find the ops if everything succeeded, so we're free to just pass regular
    error codes around up until then.
    
    CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    CC: Hanjun Guo <hanjun.guo@linaro.org>
    CC: Sudeep Holla <sudeep.holla@arm.com>
    Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
    [lorenzo.pieralisi@arm.com: tagged __get_pci_rid __maybe_unused]
    Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    bc8648d4
iort.c 28.1 KB