From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: linuxppc-dev@lists.ozlabs.org
Cc: Sam Bobroff <sbobroff@linux.ibm.com>,
Alistair Popple <alistair@popple.id.au>,
kvm-ppc@vger.kernel.org, Oliver O'Halloran <oohall@gmail.com>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH kernel] powerpc/pci/of: Parse unassigned resources
Date: Fri, 14 Jun 2019 13:18:28 +1000 [thread overview]
Message-ID: <a9f5d1d7-a8dc-91eb-8197-a7aa9b45957b@ozlabs.ru> (raw)
In-Reply-To: <20190614025916.123589-1-aik@ozlabs.ru>
On 14/06/2019 12:59, Alexey Kardashevskiy wrote:
> The pseries platform uses the PCI_PROBE_DEVTREE method of PCI probing
> which is basically reading "assigned-addresses" of every PCI device.
> However if the property is missing or zero sized, then there is
> no fallback of any kind and the PCI resources remain undiscovered, i.e.
> pdev->resource[] array is empty.
>
> This adds a fallback which parses the "reg" property in pretty much same
> way except it marks resources as "unset" which later makes Linux assign
> those resources with proper addresses.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>
> This is an attempts to boot linux directly under QEMU without slof/rtas;
> the aim is to use petitboot instead and let the guest kernel configure
> devices.
>
> QEMU does not allocate resources, it creates correct "reg" and zero length
> "assigned-addresses" (which is probably a bug on its own) which is
> normally populated by SLOF later but not during this exercise.
>
> ---
> arch/powerpc/kernel/pci_of_scan.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
> index 64ad92016b63..cfe6ec3c6aaf 100644
> --- a/arch/powerpc/kernel/pci_of_scan.c
> +++ b/arch/powerpc/kernel/pci_of_scan.c
> @@ -82,10 +82,18 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
> const __be32 *addrs;
> u32 i;
> int proplen;
> + bool unset = false;
>
> addrs = of_get_property(node, "assigned-addresses", &proplen);
> if (!addrs)
> return;
Ah. Of course, these 2 lines above should go, my bad. I'll repost if
there are no other (and bigger) problems with this.
> + if (!addrs || !proplen) {
> + addrs = of_get_property(node, "reg", &proplen);
> + if (!addrs || !proplen)
> + return;
> + unset = true;
> + }
> +
> pr_debug(" parse addresses (%d bytes) @ %p\n", proplen, addrs);
> for (; proplen >= 20; proplen -= 20, addrs += 5) {
> flags = pci_parse_of_flags(of_read_number(addrs, 1), 0);
> @@ -110,6 +118,8 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
> continue;
> }
> res->flags = flags;
> + if (unset)
> + res->flags |= IORESOURCE_UNSET;
> res->name = pci_name(dev);
> region.start = base;
> region.end = base + size - 1;
>
--
Alexey
next prev parent reply other threads:[~2019-06-14 3:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-14 2:59 [PATCH kernel] powerpc/pci/of: Parse unassigned resources Alexey Kardashevskiy
2019-06-14 3:18 ` Alexey Kardashevskiy [this message]
2019-06-18 4:02 ` Sam Bobroff
2019-06-18 12:15 ` Michael Ellerman
2019-06-18 12:29 ` Benjamin Herrenschmidt
2019-06-19 1:20 ` Alexey Kardashevskiy
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=a9f5d1d7-a8dc-91eb-8197-a7aa9b45957b@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=alistair@popple.id.au \
--cc=david@gibson.dropbear.id.au \
--cc=kvm-ppc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=oohall@gmail.com \
--cc=sbobroff@linux.ibm.com \
/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).