Skip to contentSkip to conversation

Add emulation of MEN Chameleon Hardware

PATCH Superseded Johannes Thumshirn 2 participants 7 messages Apr 6, 2023 – Apr 10, 2023 Arm/Amlogic Meson SoC support

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#1 lore raw

PATCH v2 1/4 Add MEN Chameleon Bus emulation

In reply to Johannes Thumshirn

The MEN Chameleon Bus (MCB) is an on-chip bus system exposing IP Cores of an FPGA to a outside bus system like PCIe.

---
 MAINTAINERS          |   6 ++
 hw/Kconfig           |   1 +
 hw/mcb/Kconfig       |   2 +
 hw/mcb/mcb.c         | 182 +++++++++++++++++++++++++++++++++++++++++++
 hw/mcb/meson.build   |   1 +
 hw/meson.build       |   1 +
 include/hw/mcb/mcb.h | 106 +++++++++++++++++++++++++
 7 files changed, 299 insertions(+)
 create mode 100644 hw/mcb/Kconfig
 create mode 100644 hw/mcb/mcb.c
 create mode 100644 hw/mcb/meson.build
 create mode 100644 include/hw/mcb/mcb.h
MAINTAINERS +6 -0
index 98cb2d64cf..badec8abdd 100644
@@ -1947,6 +1947,12 @@ R: Paolo Bonzini <[email protected]>
 S: Odd Fixes
 F: hw/char/
 
+MEN Chameleon Bus
+M: Johannes Thumshirn <[email protected]>
+S: Maintained
+F: hw/mcb/
+F: include/hw/mcb/
+
 Network devices
 M: Jason Wang <[email protected]>
 S: Odd Fixes
hw/Kconfig +1 -0
index ba62ff6417..f5ef84b10b 100644
@@ -18,6 +18,7 @@ source intc/Kconfig
 source ipack/Kconfig
 source ipmi/Kconfig
 source isa/Kconfig
+source mcb/Kconfig
 source mem/Kconfig
 source misc/Kconfig
 source net/Kconfig
hw/mcb/Kconfig new file +2 -0
new file mode 100644
index 0000000000..36a7a583a8
@@ -0,0 +1,2 @@
+config MCB
+    bool
hw/mcb/mcb.c new file +182 -0

182 lines not on this page · raw message

hw/mcb/meson.build new file +1 -0
new file mode 100644
index 0000000000..a385edc07c
@@ -0,0 +1 @@
+softmmu_ss.add(when: 'CONFIG_MCB', if_true: files('mcb.c'))
hw/meson.build +1 -0
index c7ac7d3d75..3d1462ad8b 100644
@@ -18,6 +18,7 @@ subdir('intc')
 subdir('ipack')
 subdir('ipmi')
 subdir('isa')
+subdir('mcb')
 subdir('mem')
 subdir('misc')
 subdir('net')
include/hw/mcb/mcb.h new file +106 -0

106 lines not on this page · raw message

Signature · 1 line
2.39.2
#6 lore raw

PATCH v2 4/4 wdt_z069: Add support for MEN 16z069 Watchdog

In reply to Johannes Thumshirn

Add 16z069 Watchdog over MEN Chameleon BUS emulation.

---
 hw/watchdog/Kconfig     |   5 +
 hw/watchdog/meson.build |   1 +
 hw/watchdog/wdt_z069.c  | 218 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 224 insertions(+)
 create mode 100644 hw/watchdog/wdt_z069.c
hw/watchdog/Kconfig +5 -0
index 66e1d029e3..a3f1196f66 100644
@@ -20,3 +20,8 @@ config WDT_IMX2
 
 config WDT_SBSA
     bool
+
+config WDT_Z069
+    bool
+    default y if MCB
+    depends on MCB
hw/watchdog/meson.build +1 -0
index 8974b5cf4c..7bc353774e 100644
@@ -6,4 +6,5 @@ softmmu_ss.add(when: 'CONFIG_WDT_DIAG288', if_true: files('wdt_diag288.c'))
 softmmu_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('wdt_aspeed.c'))
 softmmu_ss.add(when: 'CONFIG_WDT_IMX2', if_true: files('wdt_imx2.c'))
 softmmu_ss.add(when: 'CONFIG_WDT_SBSA', if_true: files('sbsa_gwdt.c'))
+softmmu_ss.add(when: 'CONFIG_WDT_Z069', if_true: files('wdt_z069.c'))
 specific_ss.add(when: 'CONFIG_PSERIES', if_true: files('spapr_watchdog.c'))
hw/watchdog/wdt_z069.c new file +218 -0

218 lines not on this page · raw message

Signature · 1 line
2.39.2
#4 lore raw

PATCH v2 2/4 Add MEN Chameleon Bus via PCI carrier

In reply to Johannes Thumshirn

Add PCI based MEN Chameleon Bus carrier emulation.

---
 hw/mcb/Kconfig      |   6 +
 hw/mcb/mcb-pci.c    | 297 ++++++++++++++++++++++++++++++++++++++++++++
 hw/mcb/meson.build  |   1 +
 hw/mcb/trace-events |   3 +
 hw/mcb/trace.h      |   1 +
 meson.build         |   1 +
 6 files changed, 309 insertions(+)
 create mode 100644 hw/mcb/mcb-pci.c
 create mode 100644 hw/mcb/trace-events
 create mode 100644 hw/mcb/trace.h
hw/mcb/Kconfig +6 -0
index 36a7a583a8..7deb96c2fe 100644
@@ -1,2 +1,8 @@
 config MCB
     bool
+
+config MCB_PCI
+    bool
+    default y if PCI_DEVICES
+    depends on PCI
+    select MCB
hw/mcb/mcb-pci.c new file +297 -0

297 lines not on this page · raw message

hw/mcb/meson.build +1 -0
index a385edc07c..4e1a0f0cdb 100644
@@ -1 +1,2 @@
 softmmu_ss.add(when: 'CONFIG_MCB', if_true: files('mcb.c'))
+softmmu_ss.add(when: 'CONFIG_MCB_PCI', if_true: files('mcb-pci.c'))
hw/mcb/trace-events new file +3 -0
new file mode 100644
index 0000000000..e1adf9c8e3
@@ -0,0 +1,3 @@
+# mcb-pci.c
+mpci_chamtbl_read(unsigned long addr, unsigned int size) "read from address 0x%lx size %d"
+mpci_chamtbl_write(unsigned long addr, uint64_t val) "invalid write to 0x%lx: 0x%" PRIx64
hw/mcb/trace.h new file +1 -0
new file mode 100644
index 0000000000..35653b3381
@@ -0,0 +1 @@
+#include "trace/trace-hw_mcb.h"
meson.build +1 -0
index 29f8644d6d..ff8305440b 100644
@@ -2986,6 +2986,7 @@ if have_system
     'hw/input',
     'hw/intc',
     'hw/isa',
+    'hw/mcb',
     'hw/mem',
     'hw/mips',
     'hw/misc',
Signature · 1 line
2.39.2
#0 lore raw

v2 cover Add emulation of MEN Chameleon Hardware

Add emulation of MEN Chameleon Hardware to Qemu.
This emulation is specifically designed to test the upstream Linux kernel drivers when one has no access to the hardware.

The emulation consists of the bus itself, a PCI hardware target creating the bus, MEN Micro Electronic's 8250 based UART via MCB and a watchdog timer.

Changes since v1:
- Converted DPRINTF() to tracing infrastructure (Alistair)
- Fixed style issues (Alistair)

Johannes Thumshirn (4):
Add MEN Chameleon Bus emulation
Add MEN Chameleon Bus via PCI carrier
serial-mcb: Add serial via MEN chameleon bus
wdt_z069: Add support for MEN 16z069 Watchdog

 MAINTAINERS             |   6 +
 hw/Kconfig              |   1 +
 hw/char/Kconfig         |   6 +
 hw/char/meson.build     |   1 +
 hw/char/serial-mcb.c    | 115 ++++++++++++++++
 hw/mcb/Kconfig          |   8 ++
 hw/mcb/mcb-pci.c        | 297 ++++++++++++++++++++++++++++++++++++++++
 hw/mcb/mcb.c            | 182 ++++++++++++++++++++++++
 hw/mcb/meson.build      |   2 +
 hw/mcb/trace-events     |   3 +
 hw/mcb/trace.h          |   1 +
 hw/meson.build          |   1 +
 hw/watchdog/Kconfig     |   5 +
 hw/watchdog/meson.build |   1 +
 hw/watchdog/wdt_z069.c  | 218 +++++++++++++++++++++++++++++
 include/hw/mcb/mcb.h    | 106 ++++++++++++++
 meson.build             |   1 +
 17 files changed, 954 insertions(+)
 create mode 100644 hw/char/serial-mcb.c
 create mode 100644 hw/mcb/Kconfig
 create mode 100644 hw/mcb/mcb-pci.c
 create mode 100644 hw/mcb/mcb.c
 create mode 100644 hw/mcb/meson.build
 create mode 100644 hw/mcb/trace-events
 create mode 100644 hw/mcb/trace.h
 create mode 100644 hw/watchdog/wdt_z069.c
 create mode 100644 include/hw/mcb/mcb.h

base-commit: 652737c8090eb3792f8b4c4b22ab12d7cc32073f

Signature · 1 line
2.39.2
#5 lore raw

PATCH v2 3/4 serial-mcb: Add serial via MEN chameleon bus

Add MEN z125 UART over MEN Chameleon Bus emulation.

---
 hw/char/Kconfig      |   6 +++
 hw/char/meson.build  |   1 +
 hw/char/serial-mcb.c | 115 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 122 insertions(+)
 create mode 100644 hw/char/serial-mcb.c
hw/char/Kconfig +6 -0
index 6b6cf2fc1d..9e8ebf1d3d 100644
@@ -71,3 +71,9 @@ config GOLDFISH_TTY
 
 config SHAKTI_UART
     bool
+
+config SERIAL_MCB
+    bool
+    default y if MCB
+    depends on MCB
+    select SERIAL
hw/char/meson.build +1 -0
index e02c60dd54..d5893a142d 100644
@@ -20,6 +20,7 @@ softmmu_ss.add(when: 'CONFIG_SHAKTI_UART', if_true: files('shakti_uart.c'))
 softmmu_ss.add(when: 'CONFIG_VIRTIO_SERIAL', if_true: files('virtio-console.c'))
 softmmu_ss.add(when: 'CONFIG_XEN_BUS', if_true: files('xen_console.c'))
 softmmu_ss.add(when: 'CONFIG_XILINX', if_true: files('xilinx_uartlite.c'))
+softmmu_ss.add(when: 'CONFIG_SERIAL_MCB', if_true: files('serial-mcb.c'))
 
 softmmu_ss.add(when: 'CONFIG_AVR_USART', if_true: files('avr_usart.c'))
 softmmu_ss.add(when: 'CONFIG_COLDFIRE', if_true: files('mcf_uart.c'))
hw/char/serial-mcb.c new file +115 -0

115 lines not on this page · raw message

Signature · 1 line
2.39.2
#2 lore raw

Re: [PATCH v2 1/4] Add MEN Chameleon Bus emulation

In reply to Johannes Thumshirn
Quoted 7 lines · Johannes Thumshirn

The MEN Chameleon Bus (MCB) is an on-chip bus system exposing IP Cores of an FPGA to a outside bus system like PCIe.

hw/mcb/mcb.c line 8

Quoted 8 lines
hw/mcb/mcb.c new file +8 -0
@@ -0,0 +1,182 @@
+/*
+ * QEMU MEN Chameleon Bus emulation
+ *
+ * Copyright (C) 2023 Johannes Thumshirn <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */

Really version-2-only? We prefer 2-or-later, as noted in LICENSE...

thanks
-- PMM

#3 lore raw

Re: [PATCH v2 1/4] Add MEN Chameleon Bus emulation

Quoted 19 lines · Peter Maydell
Quoted 7 lines · Johannes Thumshirn

The MEN Chameleon Bus (MCB) is an on-chip bus system exposing IP Cores of an FPGA to a outside bus system like PCIe.

hw/mcb/mcb.c line 8

Quoted 8 lines
hw/mcb/mcb.c new file +8 -0
@@ -0,0 +1,182 @@
+/*
+ * QEMU MEN Chameleon Bus emulation
+ *
+ * Copyright (C) 2023 Johannes Thumshirn <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */

Really version-2-only? We prefer 2-or-later, as noted in LICENSE...

Quoted 2 lines

thanks
-- PMM

Sure will do.