From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z32zD-000058-WA for qemu-devel@nongnu.org; Thu, 11 Jun 2015 09:57:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z32zB-0007ss-A8 for qemu-devel@nongnu.org; Thu, 11 Jun 2015 09:57:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z32zB-0007sd-2r for qemu-devel@nongnu.org; Thu, 11 Jun 2015 09:57:37 -0400 Message-ID: <557993CB.9080307@redhat.com> Date: Thu, 11 Jun 2015 15:57:31 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <1434029828-31954-1-git-send-email-marcel@redhat.com> In-Reply-To: <1434029828-31954-1-git-send-email-marcel@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH V2] pci: fixes to allow booting from extra root pci buses. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum , seabios@seabios.org Cc: kevin@koconnor.net, qemu-devel@nongnu.org, mst@redhat.com On 06/11/15 15:37, Marcel Apfelbaum wrote: > The fixes solves the following issue: > The PXB device exposes a new pci root bridge with the > fw path: /pci-root@4/..., in which 4 is the root bus number. > Before this patch the fw path was wrongly computed: > /pci-root@1/pci@i0cf8/... > Fix the above issues: Correct the bus number and remove the > extra host bridge description. >=20 > The IEEE Std 1275-1994: >=20 > IEEE Standard for Boot (Initialization Configuration) > Firmware: Core Requirements and Practices > 3.2.1.1 Node names > Each node in the device tree is identified by a node name > using the following notation: > driver-name@unit-address:device-arguments >=20 > The driver name field is a sequence of between one and 31 > letters [...]. By convention, this name includes the name of > the device=E2=80=99s manufacturer and the device=E2=80=99s mo= del name separated by > a =E2=80=9C,=E2=80=9D. >=20 > The unit address field is the text representation of the > physical address of the device within the address space > defined by its parent node. The form of the text > representation is bus-dependent. > 3.2.1.2 Path names > A particular node is uniquely identified by describing its posi= tion > in the device tree by completely specifying the > path from the root node through all intermediate nodes to the n= ode > in question. The textual representation of a > such a path is called a device path. Device paths are composed = as > follows: > /node-name0/node-name1/ ... /node-nameN > When Open Firmware is searching for a particular node, and eith= er > the driver name or @unit-address portion of > the node name is not given, Open Firmware shall arbitrarily cho= ose a > node matching the portion that is present. >=20 > Signed-off-by: Marcel Apfelbaum > --- > v1->v2: > - fixed a bug preventing the boot of devices behind the main host bri= dge > This approach leaves previous code paths intact so it will work the= same > as before if no PXB is present. > - Added spec for fw path naming conventions. (Michael S. Tsirkin) >=20 > src/boot.c | 3 ++- > src/hw/pci.c | 2 +- > 2 files changed, 3 insertions(+), 2 deletions(-) >=20 > diff --git a/src/boot.c b/src/boot.c > index ec59c37..e241d1c 100644 > --- a/src/boot.c > +++ b/src/boot.c > @@ -114,7 +114,8 @@ build_pci_path(char *buf, int max, const char *devn= ame, struct pci_device *pci) > } else { > if (pci->rootbus) > p +=3D snprintf(p, max, "/pci-root@%x", pci->rootbus); > - p +=3D snprintf(p, buf+max-p, "%s", FW_PCI_DOMAIN); > + else > + p +=3D snprintf(p, buf+max-p, "%s", FW_PCI_DOMAIN); > } > =20 > int dev =3D pci_bdf_to_dev(pci->bdf), fn =3D pci_bdf_to_fn(pci->bd= f); > diff --git a/src/hw/pci.c b/src/hw/pci.c > index 0379b55..9e77af4 100644 > --- a/src/hw/pci.c > +++ b/src/hw/pci.c > @@ -133,7 +133,7 @@ pci_probe_devices(void) > if (bus !=3D lastbus) > rootbuses++; > lastbus =3D bus; > - rootbus =3D rootbuses; > + rootbus =3D bus; > if (bus > MaxPCIBus) > MaxPCIBus =3D bus; > } else { >=20 I think the commit message is somewhat overkill, but I'll leave that to Michael. :) Regardig the rootbus question. As far as I can see, the last hunk changes the dev->rootbus assignment for parentless devices, so they pick up the last bus rather than the number of buses found. Then, the only difference this makes is in build_pci_path() -- I grepped the tree for whole-word "rootbus". (It's quite a serendipity that my v3 qemu patchset produces exactly this pattern in OFW device paths, without my then-knowledge of the SeaBIOS code. Although, admittedly, the fw_name :=3D "pci-root" change there was suggested by Marcel.) So, unless I'm missing something: Reviewed-by: Laszlo Ersek