[Very RFC 37/46] powernv/pci: Use the PHB's rmap for pnv_ioda_to_pe()
Alexey Kardashevskiy
aik at ozlabs.ru
Thu Nov 21 14:50:21 AEDT 2019
On 20/11/2019 12:28, Oliver O'Halloran wrote:
> Rather than using the pdn->pe_number for a device as an index into the
> IODA PE array we can use the reverse map. This maps the RID (i.e. bdfn)
> to the PE number associated with it. Firmware maintains a copy of the
> rmap which is used by the hardware for determining which PE to use
> when handling a DMA so this gets us a bit closer to the model used
> by the HW, which is comprehensible by mortals, rather than... whatever
s/comprensible/comprehensible/ ?
> the hell is going on currently.
Merge this into 02/46?
>
> Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
> ---
> arch/powerpc/platforms/powernv/pci-ioda.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index 8525642b1256..d111a50fbe68 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -672,13 +672,9 @@ struct pnv_ioda_pe *__pnv_ioda_get_pe(struct pnv_phb *phb, u16 bdfn)
> struct pnv_ioda_pe *pnv_ioda_get_pe(struct pci_dev *dev)
> {
> struct pnv_phb *phb = pci_bus_to_pnvhb(dev->bus);
> - struct pci_dn *pdn = pci_get_pdn(dev);
> + u16 bdfn = (dev->bus->number << 8) | dev->devfn;
>
> - if (!pdn)
> - return NULL;
> - if (pdn->pe_number == IODA_INVALID_PE)
> - return NULL;
> - return &phb->ioda.pe_array[pdn->pe_number];
> + return __pnv_ioda_get_pe(phb, bdfn);
> }
>
> static int pnv_ioda_set_one_peltv(struct pnv_phb *phb,
>
--
Alexey
More information about the Linuxppc-dev
mailing list