Skip to contentSkip to conversation

Pegasos2 emulation

RFC PATCH Superseded BALATON Zoltan 1 participant 3 messages Jan 9, 2021 Arm/Amlogic Meson SoC support

v2 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

v2 cover Pegasos2 emulation

Hello,

v2 adds missing file that's omitted from original series, still based on "[PATCH v2 0/3] Fix up sam460ex fixes"

Based-on: <[email protected]>

This is adding a new PPC board called pegasos2 currently posted as RFC because it depends on not yet merged VT8231 emulation currently under review. A working version with all patches can be found here:

https://osdn.net/projects/qmiga/scm/git/qemu/tree/pegasos2/

This may need some changes like a test case but I'm posting it now for getting feedback on what's needed to merge this. More info on it can be found at:

https://osdn.net/projects/qmiga/wiki/SubprojectPegasos2

Currently it needs a firmware ROM image that I cannot include due to original copyright holder (bPlan) did not release it under a free licence but I have plans to write a replacement in the future. With that firmware it can boot MorphOS now as:

qemu-system-ppc -M pegasos2 -cdrom morphos.iso -device ati-vga,romfile="" -serial stdio

then enter "boot cd boot.img" at the firmware "ok" prompt as described in the MorphOS.readme. To boot Linux use same command line with e.g. -cdrom debian-8.11.0-powerpc-netinst.iso then enter
"boot cd install/pegasos"

Patch 2 adds the actual board code after patch 1 adding MV64361 system controller chip. The mv643xx.h header file is taken from Linux and produces a bunch of checkpatch warnings due to different formatting rules it follows, I'm not sure we want to adopt it or keep it as it is given that it does not appear any more in recent Linux versions so we could reformat it as it's unlikely to get updated in the future.

Regards,
BALATON Zoltan

BALATON Zoltan (2):
hw/pci-host: Add emulation of Marvell MV64361 PPC system controller hw/ppc: Add emulation of Genesi/bPlan Pegasos II

 default-configs/devices/ppc-softmmu.mak |   2 +
 hw/pci-host/Kconfig                     |   3 +
 hw/pci-host/meson.build                 |   2 +
 hw/pci-host/mv64361.c                   | 966 ++++++++++++++++++++++++
 hw/pci-host/mv643xx.h                   | 919 ++++++++++++++++++++++
 hw/pci-host/trace-events                |   6 +
 hw/ppc/Kconfig                          |  10 +
 hw/ppc/meson.build                      |   2 +
 hw/ppc/pegasos2.c                       | 144 ++++
 include/hw/pci-host/mv64361.h           |   8 +
 include/hw/pci/pci_ids.h                |   1 +
 11 files changed, 2063 insertions(+)
 create mode 100644 hw/pci-host/mv64361.c
 create mode 100644 hw/pci-host/mv643xx.h
 create mode 100644 hw/ppc/pegasos2.c
 create mode 100644 include/hw/pci-host/mv64361.h
Signature · 1 line
2.21.3
#1 lore raw

RFC PATCH v2 1/2 hw/pci-host: Add emulation of Marvell MV64361 PPC system controller

The Marvell Discovery II aka. MV64361 is a PowerPC system controller chip that is used on the pegasos2 PPC board. This adds emulation of it that models the device enough to boot guests on this board. The mv643xx.h header with register definitions is taken from Linux 4.15.10 only fixing end of line white space errors and removing not needed parts, it's otherwise keeps Linux formatting.

---
 hw/pci-host/Kconfig           |   3 +
 hw/pci-host/meson.build       |   2 +
 hw/pci-host/mv64361.c         | 966 ++++++++++++++++++++++++++++++++++
 hw/pci-host/mv643xx.h         | 919 ++++++++++++++++++++++++++++++++
 hw/pci-host/trace-events      |   6 +
 include/hw/pci-host/mv64361.h |   8 +
 include/hw/pci/pci_ids.h      |   1 +
 7 files changed, 1905 insertions(+)
 create mode 100644 hw/pci-host/mv64361.c
 create mode 100644 hw/pci-host/mv643xx.h
 create mode 100644 include/hw/pci-host/mv64361.h
hw/pci-host/Kconfig +3 -0
index eb03f0489d..a3b0e4ec65 100644
@@ -65,3 +65,6 @@ config PCI_POWERNV
     select PCI_EXPRESS
     select MSI_NONBROKEN
     select PCIE_PORT
+
+config MV64361
+    bool
hw/pci-host/meson.build +2 -0
index da9d1a9964..cc7f2c1c0c 100644
@@ -17,6 +17,8 @@ pci_ss.add(when: 'CONFIG_GRACKLE_PCI', if_true: files('grackle.c'))
 pci_ss.add(when: 'CONFIG_UNIN_PCI', if_true: files('uninorth.c'))
 # PowerPC E500 boards
 pci_ss.add(when: 'CONFIG_PPCE500_PCI', if_true: files('ppce500.c'))
+# Pegasos2
+pci_ss.add(when: 'CONFIG_MV64361', if_true: files('mv64361.c'))
 
 # ARM devices
 pci_ss.add(when: 'CONFIG_VERSATILE_PCI', if_true: files('versatile.c'))
hw/pci-host/mv64361.c new file +966 -0

966 lines not on this page · raw message

hw/pci-host/mv643xx.h new file +919 -0

919 lines not on this page · raw message

hw/pci-host/trace-events +6 -0
index d19ca9aef6..5f85d88602 100644
@@ -3,6 +3,12 @@
 # grackle.c
 grackle_set_irq(int irq_num, int level) "set_irq num %d level %d"
 
+# mv64361.c
+mv64361_region_map(const char *name, uint64_t poffs, uint64_t size, uint64_t moffs) "Mapping %s 0x%"PRIx64"+0x%"PRIx64" @ 0x%"PRIx64
+mv64361_region_enable(const char *op, int num) "Should %s region %d"
+mv64361_reg_read(uint64_t addr, uint32_t val) "0x%"PRIx64" -> 0x%x"
+mv64361_reg_write(uint64_t addr, uint64_t val) "0x%"PRIx64" <- 0x%"PRIx64
+
 # sabre.c
 sabre_set_request(int irq_num) "request irq %d"
 sabre_clear_request(int irq_num) "clear request irq %d"
include/hw/pci-host/mv64361.h new file +8 -0
new file mode 100644
index 0000000000..9cdb35cb3c
@@ -0,0 +1,8 @@
+#ifndef MV64361_H
+#define MV64361_H
+
+#define TYPE_MV64361 "mv64361"
+
+PCIBus *mv64361_get_pci_bus(DeviceState *dev, int n);
+
+#endif
include/hw/pci/pci_ids.h +1 -0
index 463ffa054e..7788482cfa 100644
@@ -211,6 +211,7 @@
 #define PCI_DEVICE_ID_VIA_8231_PM        0x8235
 
 #define PCI_VENDOR_ID_MARVELL            0x11ab
+#define PCI_DEVICE_ID_MARVELL_MV6436X    0x6460
 
 #define PCI_VENDOR_ID_SILICON_MOTION     0x126f
 #define PCI_DEVICE_ID_SM501              0x0501
Signature · 1 line
2.21.3
#2 lore raw

RFC PATCH v2 2/2 hw/ppc: Add emulation of Genesi/bPlan Pegasos II

In reply to BALATON Zoltan

Add new machine called pegasos2 emulating the Genesi/bPlan Pegasos II, a PowerPC board based on the Marvell MV64361 system controller and the VIA VT8231 integrated south bridge/superio chips. It can run Linux, AmigaOS and a wide range of MorphOS versions. Currently a firmware ROM image is needed to boot and only MorphOS has a video driver to produce graphics output. Linux could work too but distros that supported this machine don't include usual video drivers so those only run with serial console for now.

---
 default-configs/devices/ppc-softmmu.mak |   2 +
 hw/ppc/Kconfig                          |  10 ++
 hw/ppc/meson.build                      |   2 +
 hw/ppc/pegasos2.c                       | 144 ++++++++++++++++++++++++
 4 files changed, 158 insertions(+)
 create mode 100644 hw/ppc/pegasos2.c
default-configs/devices/ppc-softmmu.mak +2 -0
index 61b78b844d..4535993d8d 100644
@@ -14,5 +14,7 @@ CONFIG_SAM460EX=y
 CONFIG_MAC_OLDWORLD=y
 CONFIG_MAC_NEWWORLD=y
 
+CONFIG_PEGASOS2=y
+
 # For PReP
 CONFIG_PREP=y
hw/ppc/Kconfig +10 -0
index d11dc30509..98d8dd1a84 100644
@@ -68,6 +68,16 @@ config SAM460EX
     select USB_OHCI
     select FDT_PPC
 
+config PEGASOS2
+    bool
+    select MV64361
+    select VT82C686
+    select IDE_VIA
+    select SMBUS_EEPROM
+# These should come with VT82C686
+    select APM
+    select ACPI_X86
+
 config PREP
     bool
     imply PCI_DEVICES
hw/ppc/meson.build +2 -0
index ffa2ec37fa..66a69898d2 100644
@@ -77,5 +77,7 @@ ppc_ss.add(when: 'CONFIG_E500', if_true: files(
 ))
 # PowerPC 440 Xilinx ML507 reference board.
 ppc_ss.add(when: 'CONFIG_VIRTEX', if_true: files('virtex_ml507.c'))
+# Pegasos2
+ppc_ss.add(when: 'CONFIG_PEGASOS2', if_true: files('pegasos2.c'))
 
 hw_arch += {'ppc': ppc_ss}
hw/ppc/pegasos2.c new file +144 -0

144 lines not on this page · raw message

Signature · 1 line
2.21.3