[Very RFC 06/46] powerpc/iov: Move VF pdev fixup into pcibios_fixup_iov()
Oliver O'Halloran
oohall at gmail.com
Mon Nov 25 15:41:58 AEDT 2019
On Thu, Nov 21, 2019 at 3:34 PM Alexey Kardashevskiy <aik at ozlabs.ru> wrote:
>
>
>
> On 20/11/2019 12:28, Oliver O'Halloran wrote:
> > Move this out of the PHB's dma_dev_setup() callback and into the
> > ppc_md.pcibios_fixup_iov callback. This ensures that the VF PE's
> > pdev pointer is always valid for the whole time the device is
> > added the bus.
>
> Yeah it would be nice if dma setup did just dma stuff.
>
> > This isn't strictly required, but it's slightly a slightly more logical
>
> s/slightly a slightly/slightly (slightly)/ ? :)
>
>
> > place to do the fixup and it makes dma_dev_setup a bit simpler.
> >
> > Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
> > ---
> > arch/powerpc/platforms/powernv/pci-ioda.c | 35 +++++++++++------------
> > 1 file changed, 17 insertions(+), 18 deletions(-)
> >
> > diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> > index 45f974258766..c6ea7a504e04 100644
> > --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> > +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> > @@ -2910,9 +2910,6 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci_dev *pdev)
> > struct pci_dn *pdn;
> > int mul, total_vfs;
> >
> > - if (!pdev->is_physfn || pci_dev_is_added(pdev))
> > - return;
> > -
> > pdn = pci_get_pdn(pdev);
> > pdn->vfs_expanded = 0;
> > pdn->m64_single_mode = false;
> > @@ -2987,6 +2984,22 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci_dev *pdev)
> > res->end = res->start - 1;
> > }
> > }
> > +
> > +static void pnv_pci_ioda_fixup_iov(struct pci_dev *pdev)
> > +{
> > + if (WARN_ON(pci_dev_is_added(pdev)))
> > + return;
> > +
> > + if (pdev->is_virtfn) {
> > + /* Fix the VF PE's pdev pointer */
> > + struct pnv_ioda_pe *pe = pnv_ioda_get_pe(pdev);
> > + pe->pdev = pdev;
> > +
> > + WARN_ON(!(pe->flags & PNV_IODA_PE_VF));
>
>
> return;
>
> > + } else if (pdev->is_physfn) {
>
>
>
> > + pnv_pci_ioda_fixup_iov_resources(pdev);
>
>
> and open code pnv_pci_ioda_fixup_iov_resources() right here?
pnv_pci_ioda_fixup_iov_resources() is pretty hairy so I'd rather keep
it as a separate function. I'd like to get rid of it entirely at some
point, but that's a problem for another day.
More information about the Linuxppc-dev
mailing list