summaryrefslogtreecommitdiff
path: root/arch/um
diff options
context:
space:
mode:
authorVincent Whitchurch <vincent.whitchurch@axis.com>2023-01-20 11:02:32 +0300
committerRichard Weinberger <richard@nod.at>2023-02-13 12:14:31 +0300
commit314a1408b79a844dafdcde867d90de5d509409b7 (patch)
tree07bbe7d277fd56a17451954fcc012c89c9c94b10 /arch/um
parent83e913f52aba69149261742aa9ea4ceea7bf182d (diff)
downloadlinux-314a1408b79a844dafdcde867d90de5d509409b7.tar.xz
um: virt-pci: implement pcibios_get_phb_of_node()
Implement pcibios_get_phb_of_node() as x86 does in order to allow PCI busses to be associated with devicetree nodes. Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/drivers/virt-pci.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/um/drivers/virt-pci.c b/arch/um/drivers/virt-pci.c
index 3ac220dafec4..6884e1be38e4 100644
--- a/arch/um/drivers/virt-pci.c
+++ b/arch/um/drivers/virt-pci.c
@@ -533,6 +533,25 @@ static void um_pci_irq_vq_cb(struct virtqueue *vq)
}
}
+/* Copied from arch/x86/kernel/devicetree.c */
+struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
+{
+ struct device_node *np;
+
+ for_each_node_by_type(np, "pci") {
+ const void *prop;
+ unsigned int bus_min;
+
+ prop = of_get_property(np, "bus-range", NULL);
+ if (!prop)
+ continue;
+ bus_min = be32_to_cpup(prop);
+ if (bus->number == bus_min)
+ return np;
+ }
+ return NULL;
+}
+
static int um_pci_init_vqs(struct um_pci_device *dev)
{
struct virtqueue *vqs[2];