Skip to contentSkip to conversation

pci: fixes to allow booting from extra root pci buses.

PATCH Superseded Marcel Apfelbaum 3 participants 4 messages Jun 11, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci: fixes to allow booting from extra root pci buses.

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.

---
Laszlo worked on supporting pxb for OVMF and discovered that there is a problem when booting devices from a PXB.

This is a link to the latest QEMU series:

    https://www.mail-archive.com/[email protected]/msg302493.html

Thanks,
Marcel

 src/boot.c   | 1 -
 src/hw/pci.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
src/boot.c +0 -1
index ec59c37..a3bb13b 100644
@@ -114,7 +114,6 @@ build_pci_path(char *buf, int max, const char *devname, struct pci_device *pci)
     } else {
         if (pci->rootbus)
             p += snprintf(p, max, "/pci-root@%x", pci->rootbus);
-        p += snprintf(p, buf+max-p, "%s", FW_PCI_DOMAIN);
     }
 
     int dev = pci_bdf_to_dev(pci->bdf), fn = pci_bdf_to_fn(pci->bdf);
src/hw/pci.c +1 -1
index 0379b55..9e77af4 100644
@@ -133,7 +133,7 @@ pci_probe_devices(void)
                 if (bus != lastbus)
                     rootbuses++;
                 lastbus = bus;
-                rootbus = rootbuses;
+                rootbus = bus;
                 if (bus > MaxPCIBus)
                     MaxPCIBus = bus;
             } else {
Signature · 1 line
2.1.0
#1 lore raw
Quoted 8 lines · Marcel Apfelbaum

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.

I would like a unit test for various paths, they are part of guest ABI so we can never change them. Could you add a unit test please?

Also can you please quote the open firmware spec text that says this is the correct format?

Quoted 41 lines

---
Laszlo worked on supporting pxb for OVMF and discovered that there is a problem when booting devices from a PXB.

This is a link to the latest QEMU series:

    https://www.mail-archive.com/[email protected]/msg302493.html

Thanks,
Marcel

 src/boot.c   | 1 -
 src/hw/pci.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
src/boot.c +0 -1
index ec59c37..a3bb13b 100644
@@ -114,7 +114,6 @@ build_pci_path(char *buf, int max, const char *devname, struct pci_device *pci)
     } else {
         if (pci->rootbus)
             p += snprintf(p, max, "/pci-root@%x", pci->rootbus);
-        p += snprintf(p, buf+max-p, "%s", FW_PCI_DOMAIN);
     }
 
     int dev = pci_bdf_to_dev(pci->bdf), fn = pci_bdf_to_fn(pci->bdf);
src/hw/pci.c +1 -1
index 0379b55..9e77af4 100644
@@ -133,7 +133,7 @@ pci_probe_devices(void)
                 if (bus != lastbus)
                     rootbuses++;
                 lastbus = bus;
-                rootbus = rootbuses;
+                rootbus = bus;
                 if (bus > MaxPCIBus)
                     MaxPCIBus = bus;
             } else {
Signature · 1 line
2.1.0
#2 lore raw
Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Marcel Apfelbaum

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.

Quoted 5 lines
Quoted 1 line

I would like a unit test for various paths, they are part of guest ABI so we can never change them. Could you add a unit test please?

A QEMU unit-test you mean?
By the way, I found an issue with this patch, please do not merge it yet.

Quoted 3 lines

Also can you please quote the open firmware spec text that says this is the correct format?

Laszlo has found something, I'll look up something to quote, sure.

Thanks,
Marcel

Quoted 42 lines
Quoted 42 lines

---
Laszlo worked on supporting pxb for OVMF and discovered that there is a problem when booting devices from a PXB.

This is a link to the latest QEMU series:

     https://www.mail-archive.com/[email protected]/msg302493.html

Thanks,
Marcel

  src/boot.c   | 1 -
  src/hw/pci.c | 2 +-
  2 files changed, 1 insertion(+), 2 deletions(-)
src/boot.c +0 -1
index ec59c37..a3bb13b 100644
@@ -114,7 +114,6 @@ build_pci_path(char *buf, int max, const char *devname, struct pci_device *pci)
      } else {
          if (pci->rootbus)
              p += snprintf(p, max, "/pci-root@%x", pci->rootbus);
-        p += snprintf(p, buf+max-p, "%s", FW_PCI_DOMAIN);
      }
 
      int dev = pci_bdf_to_dev(pci->bdf), fn = pci_bdf_to_fn(pci->bdf);
src/hw/pci.c +1 -2
index 0379b55..9e77af4 100644
@@ -133,7 +133,7 @@ pci_probe_devices(void)
                  if (bus != lastbus)
                      rootbuses++;
                  lastbus = bus;
-                rootbus = rootbuses;
+                rootbus = bus;
                  if (bus > MaxPCIBus)
                      MaxPCIBus = bus;
              } else {
--

2.1.0

#3 lore raw
Quoted 14 lines · Marcel Apfelbaum
Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Marcel Apfelbaum

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.

Quoted 5 lines
Quoted 1 line

I would like a unit test for various paths, they are part of guest ABI so we can never change them. Could you add a unit test please?

Quoted 8 lines

A QEMU unit-test you mean?
By the way, I found an issue with this patch, please do not merge it yet.

Quoted 3 lines

Also can you please quote the open firmware spec text that says this is the correct format?

Laszlo has found something, I'll look up something to quote, sure.

The OFW specification has been named (and even linked) in the history of SeaBIOS, see eg. Markus's recent commit 275672eb. The spec has a base part and some bindings.

The thing I quoted earlier was IEEE Std 1275-1994:

IEEE Standard for Boot (Initialization Configuration)
Firmware: Core Requirements and Practices

3.2.1.1 Node names

for the generic syntax rules. (I'm not linking it because it seems to live at a different place every second week, so go ahead and google it. For example, the particular binding referenced in Markus's commit 275672eb is not available at that location any longer.)

Thanks
Laszlo

Quoted 47 lines

Thanks,
Marcel

Quoted 43 lines
Quoted 43 lines

---
Laszlo worked on supporting pxb for OVMF and discovered that there is a problem when booting devices from a PXB.

This is a link to the latest QEMU series:

     https://www.mail-archive.com/[email protected]/msg302493.html

Thanks,
Marcel

  src/boot.c   | 1 -
  src/hw/pci.c | 2 +-
  2 files changed, 1 insertion(+), 2 deletions(-)
src/boot.c +0 -1
index ec59c37..a3bb13b 100644
@@ -114,7 +114,6 @@ build_pci_path(char *buf, int max, const char
 *devname, struct pci_device *pci)
      } else {
          if (pci->rootbus)
              p += snprintf(p, max, "/pci-root@%x", pci->rootbus);
-        p += snprintf(p, buf+max-p, "%s", FW_PCI_DOMAIN);
      }
 
      int dev = pci_bdf_to_dev(pci->bdf), fn = pci_bdf_to_fn(pci->bdf);
src/hw/pci.c +1 -1
index 0379b55..9e77af4 100644
@@ -133,7 +133,7 @@ pci_probe_devices(void)
                  if (bus != lastbus)
                      rootbuses++;
                  lastbus = bus;
-                rootbus = rootbuses;
+                rootbus = bus;
                  if (bus > MaxPCIBus)
                      MaxPCIBus = bus;
              } else {
Signature · 1 line
2.1.0