Skip to contentSkip to conversation

pci: fix pci bridge fw path

PATCH Applied Gerd Hoffmann 3 participants 7 messages Dec 6, 2013 – Dec 9, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci: fix pci bridge fw path

qemu uses "pci" as name for pci bridges in the firmware device path. seabios expects "pci-bridge". Result is that bootorder is broken for devices behind pci bridges.

Some googling suggests that "pci-bridge" is the correct one. At least PPC-based Apple machines are using this. See question "How do I boot from a device attached to a PCI card" here:
http://www.netbsd.org/ports/macppc/faq.html

So lets change qemu to use "pci-bridge" too.

---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci.c +1 -1
index 49eca95..82c11ec 100644
@@ -1330,7 +1330,7 @@ static const pci_class_desc pci_class_descriptions[] =
     { 0x0601, "ISA bridge", "isa"},
     { 0x0602, "EISA bridge", "eisa"},
     { 0x0603, "MC bridge", "mca"},
-    { 0x0604, "PCI bridge", "pci"},
+    { 0x0604, "PCI bridge", "pci-bridge"},
     { 0x0605, "PCMCIA bridge", "pcmcia"},
     { 0x0606, "NUBUS bridge", "nubus"},
     { 0x0607, "CARDBUS bridge", "cardbus"},
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 4 lines · Gerd Hoffmann

qemu uses "pci" as name for pci bridges in the firmware device path. seabios expects "pci-bridge". Result is that bootorder is broken for devices behind pci bridges.

Quoted 8 lines

Some googling suggests that "pci-bridge" is the correct one. At least PPC-based Apple machines are using this. See question "How do I boot from a device attached to a PCI card" here:
http://www.netbsd.org/ports/macppc/faq.html

So lets change qemu to use "pci-bridge" too.

Sounds good but this needs to be enabled for new machine types only - otherwise guest will read corrupted data since bootindex is in FW CFG.

Alternatively, extend
04920fc0faa4760f9c4fc0e73b992b768099be70
to work for all fw cfg file entries.

I think the whole boot index thing needs
to be reworked: we also have the long-standing feature request to allow booting from a device added by hot add.

Quoted 19 lines
---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci.c +1 -1
index 49eca95..82c11ec 100644
@@ -1330,7 +1330,7 @@ static const pci_class_desc pci_class_descriptions[] =
     { 0x0601, "ISA bridge", "isa"},
     { 0x0602, "EISA bridge", "eisa"},
     { 0x0603, "MC bridge", "mca"},
-    { 0x0604, "PCI bridge", "pci"},
+    { 0x0604, "PCI bridge", "pci-bridge"},
     { 0x0605, "PCMCIA bridge", "pcmcia"},
     { 0x0606, "NUBUS bridge", "nubus"},
     { 0x0607, "CARDBUS bridge", "cardbus"},
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Gerd Hoffmann

qemu uses "pci" as name for pci bridges in the firmware device path. seabios expects "pci-bridge". Result is that bootorder is broken for devices behind pci bridges.

Some googling suggests that "pci-bridge" is the correct one. At least PPC-based Apple machines are using this. See question "How do I boot from a device attached to a PCI card" here:
http://www.netbsd.org/ports/macppc/faq.html

Quoted 7 lines
Quoted 3 lines

So lets change qemu to use "pci-bridge" too.

Sounds good but this needs to be enabled for new machine types only - otherwise guest will read corrupted data since bootindex is in FW CFG.

Come on, that is seriously over-engineering.

First, the chance that you'll find setup in the field where this can actually happen in practice is very low as bootorder for devices behind pci bridges does not work at all without this patch.

Second, the race window is so tiny that nobody has ever seen that happen in testing.

Quoted 7 lines

Alternatively, extend
04920fc0faa4760f9c4fc0e73b992b768099be70
to work for all fw cfg file entries.

I think the whole boot index thing needs
to be reworked: we also have the long-standing feature request to allow booting from a device added by hot add.

I'm not going to rewrite bootorder just to get a one-liner bugfix merged.

cheers,
Gerd

#3 lore raw
Quoted 13 lines · Gerd Hoffmann
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Gerd Hoffmann

qemu uses "pci" as name for pci bridges in the firmware device path. seabios expects "pci-bridge". Result is that bootorder is broken for devices behind pci bridges.

Some googling suggests that "pci-bridge" is the correct one. At least PPC-based Apple machines are using this. See question "How do I boot from a device attached to a PCI card" here:
http://www.netbsd.org/ports/macppc/faq.html

So lets change qemu to use "pci-bridge" too.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Sounds good but this needs to be enabled for new machine types only - otherwise guest will read corrupted data since bootindex is in FW CFG.

Come on, that is seriously over-engineering.

Does this change affects migration in any way?

Quoted 12 lines

First, the chance that you'll find setup in the field where this can actually happen in practice is very low as bootorder for devices behind pci bridges does not work at all without this patch.

Second, the race window is so tiny that nobody has ever seen that happen in testing.

Quoted 4 lines

Alternatively, extend
04920fc0faa4760f9c4fc0e73b992b768099be70
to work for all fw cfg file entries.

Quoted 6 lines
Quoted 3 lines

I think the whole boot index thing needs
to be reworked: we also have the long-standing feature request to allow booting from a device added by hot add.

I'm not going to rewrite bootorder just to get a one-liner bugfix merged.

Why? You could rewrite Qemu in C++, then rewrite the bootorder (easier, because of C++) and finally get your bugfix in... but again, your patch would look exactly the same :)

Thanks,
Marcel

Quoted 5 lines

cheers,
Gerd

#4 lore raw
Quoted 14 lines · Marcel Apfelbaum
Quoted 13 lines · Gerd Hoffmann
Quoted 12 lines · Michael S. Tsirkin
Quoted 11 lines · Gerd Hoffmann

qemu uses "pci" as name for pci bridges in the firmware device path. seabios expects "pci-bridge". Result is that bootorder is broken for devices behind pci bridges.

Some googling suggests that "pci-bridge" is the correct one. At least PPC-based Apple machines are using this. See question "How do I boot from a device attached to a PCI card" here:
http://www.netbsd.org/ports/macppc/faq.html

So lets change qemu to use "pci-bridge" too.

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Sounds good but this needs to be enabled for new machine types only - otherwise guest will read corrupted data since bootindex is in FW CFG.

Come on, that is seriously over-engineering.

Does this change affects migration in any way?

If you live-migrate from a machine without the fix to a machine with the fix *and* you have bootorder configured for a device behind the pci bridge then size of the etc/bootorder fw_cfg file will change.

So, in case of the following event sequence ...

(a) firmware reads fw_fg directory index (with file sizes)
(b) live migration
(c) firmware reads etc/bootorder

... the firmware will read the new content with old size, i.e. it will miss a few bytes or have trailing garbage (or zeros? Not sure what qemu emulation does if you read over the end of a fw_cfg files).

Result might be that bootorder isn't applied correctly. But that is the case _anyway_ on the machine with the unfixed qemu version. So making this machine type dependent buys us nothing but churn for no reason.

cheers,
Gerd

#5 lore raw
In reply to Gerd Hoffmann
Quoted 19 lines · Gerd Hoffmann
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Gerd Hoffmann

qemu uses "pci" as name for pci bridges in the firmware device path. seabios expects "pci-bridge". Result is that bootorder is broken for devices behind pci bridges.

Some googling suggests that "pci-bridge" is the correct one. At least PPC-based Apple machines are using this. See question "How do I boot from a device attached to a PCI card" here:
http://www.netbsd.org/ports/macppc/faq.html

Quoted 7 lines
Quoted 3 lines

So lets change qemu to use "pci-bridge" too.

Sounds good but this needs to be enabled for new machine types only - otherwise guest will read corrupted data since bootindex is in FW CFG.

Quoted 5 lines

Come on, that is seriously over-engineering.

First, the chance that you'll find setup in the field where this can actually happen in practice is very low as bootorder for devices behind pci bridges does not work at all without this patch.

That's a good point, thanks.

Quoted 16 lines

Second, the race window is so tiny that nobody has ever seen that happen in testing.

Quoted 7 lines

Alternatively, extend
04920fc0faa4760f9c4fc0e73b992b768099be70
to work for all fw cfg file entries.

I think the whole boot index thing needs
to be reworked: we also have the long-standing feature request to allow booting from a device added by hot add.

I'm not going to rewrite bootorder just to get a one-liner bugfix merged.

cheers,
Gerd

Signature · 1 line
MST
#6 lore raw
In reply to Gerd Hoffmann
Quoted 4 lines · Gerd Hoffmann

qemu uses "pci" as name for pci bridges in the firmware device path. seabios expects "pci-bridge". Result is that bootorder is broken for devices behind pci bridges.

Quoted 8 lines

Some googling suggests that "pci-bridge" is the correct one. At least PPC-based Apple machines are using this. See question "How do I boot from a device attached to a PCI card" here:
http://www.netbsd.org/ports/macppc/faq.html

So lets change qemu to use "pci-bridge" too.

Applied, thanks.

Quoted 19 lines
---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci.c +1 -1
index 49eca95..82c11ec 100644
@@ -1330,7 +1330,7 @@ static const pci_class_desc pci_class_descriptions[] =
     { 0x0601, "ISA bridge", "isa"},
     { 0x0602, "EISA bridge", "eisa"},
     { 0x0603, "MC bridge", "mca"},
-    { 0x0604, "PCI bridge", "pci"},
+    { 0x0604, "PCI bridge", "pci-bridge"},
     { 0x0605, "PCMCIA bridge", "pcmcia"},
     { 0x0606, "NUBUS bridge", "nubus"},
     { 0x0607, "CARDBUS bridge", "cardbus"},
Signature · 1 line
1.8.3.1