[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/arm: Introduce pci_find_host_bridge_node helper
commit 8858dfac1d83acd1b28643c616318631e3a4134d Author: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx> AuthorDate: Fri Oct 8 15:43:26 2021 -0700 Commit: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx> CommitDate: Fri Oct 8 15:43:26 2021 -0700 xen/arm: Introduce pci_find_host_bridge_node helper Get host bridge node given a PCI device attached to it. This helper will be re-used for adding PCI devices by the subsequent patches. Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> Reviewed-by: Rahul Singh <rahul.singh@xxxxxxx> Tested-by: Rahul Singh <rahul.singh@xxxxxxx> --- xen/arch/arm/pci/pci-host-common.c | 16 ++++++++++++++++ xen/include/asm-arm/pci.h | 1 + 2 files changed, 17 insertions(+) diff --git a/xen/arch/arm/pci/pci-host-common.c b/xen/arch/arm/pci/pci-host-common.c index c5941b10e9..af208e7298 100644 --- a/xen/arch/arm/pci/pci-host-common.c +++ b/xen/arch/arm/pci/pci-host-common.c @@ -236,6 +236,22 @@ err_exit: return err; } +/* + * Get host bridge node given a device attached to it. + */ +struct dt_device_node *pci_find_host_bridge_node(struct device *dev) +{ + struct pci_host_bridge *bridge; + struct pci_dev *pdev = dev_to_pci(dev); + + bridge = pci_find_host_bridge(pdev->seg, pdev->bus); + if ( unlikely(!bridge) ) + { + printk(XENLOG_ERR "Unable to find PCI bridge for %pp\n", &pdev->sbdf); + return NULL; + } + return bridge->dt_node; +} /* * This function will lookup an hostbridge based on the segment and bus * number. diff --git a/xen/include/asm-arm/pci.h b/xen/include/asm-arm/pci.h index 8551704de3..ed76508002 100644 --- a/xen/include/asm-arm/pci.h +++ b/xen/include/asm-arm/pci.h @@ -89,6 +89,7 @@ int pci_generic_config_write(struct pci_host_bridge *bridge, pci_sbdf_t sbdf, void __iomem *pci_ecam_map_bus(struct pci_host_bridge *bridge, pci_sbdf_t sbdf, uint32_t where); struct pci_host_bridge *pci_find_host_bridge(uint16_t segment, uint8_t bus); +struct dt_device_node *pci_find_host_bridge_node(struct device *dev); static always_inline bool is_pci_passthrough_enabled(void) { -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |