On Thu, 26 Mar 2020 16:40:07 +1100 David Gibson <da...@gibson.dropbear.id.au> wrote:
> This adds a simple exported helper function which determins if a given > (supposedly) PCI device is actually an NVLink2 device, which has some > special considerations. > > Signed-off-by: David Gibson <da...@gibson.dropbear.id.au> > --- Reviewed-by: Greg Kurz <gr...@kaod.org> > hw/ppc/spapr_pci_nvlink2.c | 5 +++++ > include/hw/pci-host/spapr.h | 1 + > 2 files changed, 6 insertions(+) > > diff --git a/hw/ppc/spapr_pci_nvlink2.c b/hw/ppc/spapr_pci_nvlink2.c > index 7d3a685421..0cec1ae02b 100644 > --- a/hw/ppc/spapr_pci_nvlink2.c > +++ b/hw/ppc/spapr_pci_nvlink2.c > @@ -449,6 +449,11 @@ static bool is_nvnpu(PCIDevice *dev, SpaprPhbState > *sphb, int *slot, int *link) > return false; > } > > +bool spapr_phb_is_nvlink_dev(PCIDevice *dev, SpaprPhbState *sphb) > +{ > + return is_nvgpu(dev, sphb, NULL) || is_nvnpu(dev, sphb, NULL, NULL); > +} > + > void spapr_phb_nvgpu_populate_pcidev_dt(PCIDevice *dev, void *fdt, int > offset, > SpaprPhbState *sphb) > { > diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h > index 8877ff51fb..eaba4a5825 100644 > --- a/include/hw/pci-host/spapr.h > +++ b/include/hw/pci-host/spapr.h > @@ -156,6 +156,7 @@ void spapr_phb_nvgpu_free(SpaprPhbState *sphb); > void spapr_phb_nvgpu_populate_dt(SpaprPhbState *sphb, void *fdt, int bus_off, > Error **errp); > void spapr_phb_nvgpu_ram_populate_dt(SpaprPhbState *sphb, void *fdt); > +bool spapr_phb_is_nvlink_dev(PCIDevice *dev, SpaprPhbState *sphb); > void spapr_phb_nvgpu_populate_pcidev_dt(PCIDevice *dev, void *fdt, int > offset, > SpaprPhbState *sphb); > #else