Skip to contentSkip to conversation

pegasos2 fixes for 8.1

PATCH In review BALATON Zoltan 2 participants 7 messages Jul 19, 2023 – Jul 22, 2023

lore
Share & tools
lore
#0 lore raw

cover pegasos2 fixes for 8.1

These are some small fixes when using pegasos2 with the QEMU built in VOF instead of the non-free board firmware that fix bugs in the generated device tree and matches the board firmware in the reset state of on-board USB devices. This fixes booting AmigaOS with VOF and only touches parts that are used with VOF only so I'd like these to be merged for 8.1.

Regards,

BALATON Zoltan (3):
ppc/pegasos2: Fix reset state of USB functions
ppc/pegasos2: Fix reg property of ROM BARs
ppc/pegasos2: Fix naming of device tree nodes

 hw/ppc/pegasos2.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
Signature · 1 line
2.30.9
#1 lore raw

PATCH 1/3 ppc/pegasos2: Fix reset state of USB functions

The original non-free board firmware sets the command register of the USB functions to 7 and some guests rely on this for working USB. Match what the board firmware does when using VOF instead.

---
 hw/ppc/pegasos2.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/ppc/pegasos2.c +4 -0
index 4447bbe8ec..4a2ab35f19 100644
@@ -324,9 +324,13 @@ static void pegasos2_machine_reset(MachineState *machine, ShutdownCause reason)
 
     pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 2) << 8) |
                               PCI_INTERRUPT_LINE, 2, 0x409);
+    pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 2) << 8) |
+                              PCI_COMMAND, 2, 0x7);
 
     pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 3) << 8) |
                               PCI_INTERRUPT_LINE, 2, 0x409);
+    pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 3) << 8) |
+                              PCI_COMMAND, 2, 0x7);
 
     pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 4) << 8) |
                               PCI_INTERRUPT_LINE, 2, 0x9);
Signature · 1 line
2.30.9
#2 lore raw

PATCH 2/3 ppc/pegasos2: Fix reg property of ROM BARs

In reply to BALATON Zoltan

The register offset of the ROM BAR is 0x30 not 0x28. This fixes the reg property entry of the ROM region in the device tree.

---
 hw/ppc/pegasos2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
hw/ppc/pegasos2.c +5 -1
index 4a2ab35f19..8ed13a42a2 100644
@@ -766,7 +766,11 @@ static void add_pci_device(PCIBus *bus, PCIDevice *d, void *opaque)
         if (!d->io_regions[i].size) {
             continue;
         }
-        cells[j] = cpu_to_be32(d->devfn << 8 | (PCI_BASE_ADDRESS_0 + i * 4));
+        cells[j] = PCI_BASE_ADDRESS_0 + i * 4;
+        if (cells[j] == 0x28) {
+            cells[j] = 0x30;
+        }
+        cells[j] = cpu_to_be32(d->devfn << 8 | cells[j]);
         if (d->io_regions[i].type & PCI_BASE_ADDRESS_SPACE_IO) {
             cells[j] |= cpu_to_be32(1 << 24);
         } else {
Signature · 1 line
2.30.9
#3 lore raw

PATCH 3/3 ppc/pegasos2: Fix naming of device tree nodes

In reply to BALATON Zoltan

The board firmware names devices by their class so match that for common devices. Also make sure the /rtas node has a name. This is needed because VOF otherwise does not include it in results got by nextprop which is how AmigaOS queries it and fails if no name property is found.

---
 hw/ppc/pegasos2.c | 8 ++++++++
 1 file changed, 8 insertions(+)
hw/ppc/pegasos2.c +8 -0
index 8ed13a42a2..6475acfbed 100644
@@ -739,6 +739,13 @@ static void add_pci_device(PCIBus *bus, PCIDevice *d, void *opaque)
                                      pci_get_word(&d->config[PCI_VENDOR_ID]),
                                      pci_get_word(&d->config[PCI_DEVICE_ID]));
 
+    if (pci_get_word(&d->config[PCI_CLASS_DEVICE])  ==
+        PCI_CLASS_NETWORK_ETHERNET) {
+        name = "ethernet";
+    } else if (pci_get_word(&d->config[PCI_CLASS_DEVICE]) >> 8 ==
+        PCI_BASE_CLASS_DISPLAY) {
+        name = "display";
+    }
     for (i = 0; device_map[i].id; i++) {
         if (!strcmp(pn, device_map[i].id)) {
             name = device_map[i].name;
@@ -929,6 +936,7 @@ static void *build_fdt(MachineState *machine, int *fdt_size)
     qemu_fdt_setprop_cell(fdt, "/rtas", "rtas-display-device", 0);
     qemu_fdt_setprop_cell(fdt, "/rtas", "rtas-size", 20);
     qemu_fdt_setprop_cell(fdt, "/rtas", "rtas-version", 1);
+    qemu_fdt_setprop_string(fdt, "/rtas", "name", "rtas");
 
     /* cpus */
     qemu_fdt_add_subnode(fdt, "/cpus");
Signature · 1 line
2.30.9
Reviewed-by on the v1 series
#4 lore raw
In reply to BALATON Zoltan
Quoted 6 lines · BALATON Zoltan

These are some small fixes when using pegasos2 with the QEMU built in VOF instead of the non-free board firmware that fix bugs in the generated device tree and matches the board firmware in the reset state of on-board USB devices. This fixes booting AmigaOS with VOF and only touches parts that are used with VOF only so I'd like these to be merged for 8.1.

And pushed to ppc-next. Thanks,

Daniel

Quoted 11 lines

Regards,

BALATON Zoltan (3):
ppc/pegasos2: Fix reset state of USB functions
ppc/pegasos2: Fix reg property of ROM BARs
ppc/pegasos2: Fix naming of device tree nodes

  hw/ppc/pegasos2.c | 18 +++++++++++++++++-
  1 file changed, 17 insertions(+), 1 deletion(-)
#5 lore raw
Quoted 8 lines · Daniel Henrique Barboza
Quoted 6 lines · BALATON Zoltan

These are some small fixes when using pegasos2 with the QEMU built in VOF instead of the non-free board firmware that fix bugs in the generated device tree and matches the board firmware in the reset state of on-board USB devices. This fixes booting AmigaOS with VOF and only touches parts that are used with VOF only so I'd like these to be merged for 8.1.

Quoted 4 lines

And pushed to ppc-next. Thanks,

Thank you. I've just sent another similar one I've found later so was missed from this series but I hope this can still get in. This should be the last one from me for 8.1 now, sorry for sending it so late.

Regards,
BALATON Zoltan

Quoted 15 lines

Daniel

Quoted 11 lines

Regards,

BALATON Zoltan (3):
ppc/pegasos2: Fix reset state of USB functions
ppc/pegasos2: Fix reg property of ROM BARs
ppc/pegasos2: Fix naming of device tree nodes

  hw/ppc/pegasos2.c | 18 +++++++++++++++++-
  1 file changed, 17 insertions(+), 1 deletion(-)
#6 lore raw
Quoted 9 lines · BALATON Zoltan
Quoted 8 lines · Daniel Henrique Barboza
Quoted 6 lines · BALATON Zoltan

These are some small fixes when using pegasos2 with the QEMU built in VOF instead of the non-free board firmware that fix bugs in the generated device tree and matches the board firmware in the reset state of on-board USB devices. This fixes booting AmigaOS with VOF and only touches parts that are used with VOF only so I'd like these to be merged for 8.1.

Quoted 6 lines
Quoted 4 lines

And pushed to ppc-next. Thanks,

Thank you. I've just sent another similar one I've found later so was missed from this series but I hope this can still get in. This should be the last one from me for 8.1 now, sorry for sending it so late.

It's fine. It's still a good time to push this kind of fixes. I'll take a look at that one.

Daniel

Quoted 19 lines

Regards,
BALATON Zoltan

Quoted 15 lines

Daniel

Quoted 11 lines

Regards,

BALATON Zoltan (3):
   ppc/pegasos2: Fix reset state of USB functions
   ppc/pegasos2: Fix reg property of ROM BARs
   ppc/pegasos2: Fix naming of device tree nodes

  hw/ppc/pegasos2.c | 18 +++++++++++++++++-

  1 file changed, 17 insertions(+), 1 deletion(-)