From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: Richard Weinberger <richard@nod.at>,
Anton Ivanov <anton.ivanov@cambridgegreys.com>,
Johannes Berg <johannes@sipsolutions.net>
Cc: <linux-um@lists.infradead.org>, <linux-pci@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Vincent Whitchurch <vincent.whitchurch@axis.com>,
<kernel@axis.com>
Subject: [PATCH] um: virt-pci: implement pcibios_get_phb_of_node()
Date: Fri, 20 Jan 2023 09:02:32 +0100 [thread overview]
Message-ID: <20230120-uml-pci-of-v1-1-134fb66643d8@axis.com> (raw)
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>
---
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@axis.com>
next reply other threads:[~2023-01-20 8:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 8:02 Vincent Whitchurch [this message]
2023-01-20 8:22 ` [PATCH] um: virt-pci: implement pcibios_get_phb_of_node() Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230120-uml-pci-of-v1-1-134fb66643d8@axis.com \
--to=vincent.whitchurch@axis.com \
--cc=anton.ivanov@cambridgegreys.com \
--cc=devicetree@vger.kernel.org \
--cc=johannes@sipsolutions.net \
--cc=kernel@axis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=richard@nod.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).