[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230120-uml-pci-of-v1-1-134fb66643d8@axis.com>
Date: Fri, 20 Jan 2023 09:02:32 +0100
From: Vincent Whitchurch <vincent.whitchurch@...s.com>
To: Richard Weinberger <richard@....at>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>,
Johannes Berg <johannes@...solutions.net>
CC: <linux-um@...ts.infradead.org>, <linux-pci@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Vincent Whitchurch <vincent.whitchurch@...s.com>,
<kernel@...s.com>
Subject: [PATCH] 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@...s.com>
---
arch/um/drivers/virt-pci.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
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];
---
base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2
change-id: 20230120-uml-pci-of-f21d5ba4b245
Best regards,
--
Vincent Whitchurch <vincent.whitchurch@...s.com>
Powered by blists - more mailing lists