MIPS Virt machine
v3 cover MIPS Virt machine
Since v2:
- Remove mips64 from gitlab's build-without-defaults job
- Require libfdt for all MIPS targets
- Various changes described in each trickbox/virt patches
v2 cover from Jiaxun Yang:
This patchset is to add a new machine type for MIPS architecture, which is purely a VirtIO machine.
It is design to utilize existing VirtIO infrastures but also compatible with MIPS's existing internal simulation tools.
It should be able to cooperate with any MIPS core and boot Generic MIPS kernel.
Kernel patch available at:
https://lore.kernel.org/linux-mips/[email protected]/
Jiaxun Yang (2):
hw/misc: Add MIPS Trickbox device
hw/mips: Add MIPS virt board
Philippe Mathieu-Daudé (2):
gitlab-ci: Remove mips64-softmmu from build-without-defaults job configs/targets: Have all MIPS targets select FDT
.gitlab-ci.d/buildtest.yml | 4 +- MAINTAINERS | 7 + configs/devices/mips-softmmu/common.mak | 1 + configs/targets/mips-softmmu.mak | 1 + configs/targets/mips64-softmmu.mak | 1 + configs/targets/mipsel-softmmu.mak | 1 + docs/system/target-mips.rst | 22 + hw/mips/Kconfig | 16 + hw/mips/meson.build | 1 + hw/mips/virt.c | 913 ++++++++++++++++++++++++ hw/misc/Kconfig | 3 + hw/misc/meson.build | 1 + hw/misc/mips_trickbox.c | 97 +++ hw/misc/trace-events | 4 + include/hw/misc/mips_trickbox.h | 39 + 15 files changed, 1109 insertions(+), 2 deletions(-) create mode 100644 hw/mips/virt.c create mode 100644 hw/misc/mips_trickbox.c create mode 100644 include/hw/misc/mips_trickbox.h
Signature · 1 line
2.38.1
PATCH v3 1/4 gitlab-ci: Remove mips64-softmmu from build-without-defaults job
With the introduction of the MIPS virt machine in a pair of commits, all MIPS targets will require libfdt. Since the 'build-without-defaults' job is configured with '--disable-fdt', it won't be able to build any MIPS target. In particular this job triggers:
../meson.build:2809:2: ERROR: Problem encountered: fdt not available but required by targets mips64-softmmu
Remove 'mips64-softmmu' from the job TARGETS.
To still cover a big-endian target in qtests, replace it by the s390x target.
--- .gitlab-ci.d/buildtest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
.gitlab-ci.d/buildtest.yml +2 -2
@@ -526,9 +526,9 @@ build-without-defaults: --disable-pie --disable-qom-cast-debug --disable-strip - TARGETS: avr-softmmu mips64-softmmu s390x-softmmu sh4-softmmu + TARGETS: avr-softmmu s390x-softmmu sh4-softmmu sparc64-softmmu hexagon-linux-user i386-linux-user s390x-linux-user - MAKE_CHECK_ARGS: check-unit check-qtest-avr check-qtest-mips64 + MAKE_CHECK_ARGS: check-unit check-qtest-avr check-qtest-s390x build-libvhost-user: extends: .base_job_template
Signature · 1 line
2.38.1
Re: [PATCH v3 1/4] gitlab-ci: Remove mips64-softmmu from build-without-defaults job
Quoted 22 lines · Philippe Mathieu-Daudé
With the introduction of the MIPS virt machine in a pair of commits, all MIPS targets will require libfdt. Since the 'build-without-defaults' job is configured with '--disable-fdt', it won't be able to build any MIPS target. In particular this job triggers:
../meson.build:2809:2: ERROR: Problem encountered: fdt not available but required by targets mips64-softmmu
Remove 'mips64-softmmu' from the job TARGETS.
To still cover a big-endian target in qtests, replace it by the s390x target.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- .gitlab-ci.d/buildtest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-).gitlab-ci.d/buildtest.yml +0
-0
.gitlab-ci.d/buildtest.yml build-without-defaults: · line 531
Quoted 8 lines
.gitlab-ci.d/buildtest.yml +2
-2@@ -526,9 +526,9 @@ build-without-defaults: --disable-pie --disable-qom-cast-debug --disable-strip - TARGETS: avr-softmmu mips64-softmmu s390x-softmmu sh4-softmmu + TARGETS: avr-softmmu s390x-softmmu sh4-softmmu sparc64-softmmu hexagon-linux-user i386-linux-user s390x-linux-user - MAKE_CHECK_ARGS: check-unit check-qtest-avr check-qtest-mips64 + MAKE_CHECK_ARGS: check-unit check-qtest-avr check-qtest-s390x
Did you check whether this really works? IIRC the qtests fail with s390x if it is compiled with --without-default-devices ...?
Thomas
PATCH v3 2/4 configs/targets: Have all MIPS targets select FDT
In reply to Philippe Mathieu-DaudéWith the introduction of the MIPS virt machine in a pair of commits, all MIPS targets will require libfdt. Define TARGET_NEED_FDT in all mips*-softmmu.mak files.
--- configs/targets/mips-softmmu.mak | 1 + configs/targets/mips64-softmmu.mak | 1 + configs/targets/mipsel-softmmu.mak | 1 + 3 files changed, 3 insertions(+)
configs/targets/mips-softmmu.mak +1 -0
@@ -2,3 +2,4 @@ TARGET_ARCH=mips TARGET_ALIGNED_ONLY=y TARGET_BIG_ENDIAN=y TARGET_SUPPORTS_MTTCG=y +TARGET_NEED_FDT=y
configs/targets/mips64-softmmu.mak +1 -0
@@ -2,3 +2,4 @@ TARGET_ARCH=mips64 TARGET_BASE_ARCH=mips TARGET_ALIGNED_ONLY=y TARGET_BIG_ENDIAN=y +TARGET_NEED_FDT=y
configs/targets/mipsel-softmmu.mak +1 -0
@@ -1,3 +1,4 @@ TARGET_ARCH=mips TARGET_ALIGNED_ONLY=y TARGET_SUPPORTS_MTTCG=y +TARGET_NEED_FDT=y
Signature · 1 line
2.38.1
Re: [PATCH v3 2/4] configs/targets: Have all MIPS targets select FDT
Quoted 34 lines · Philippe Mathieu-Daudé
With the introduction of the MIPS virt machine in a pair of commits, all MIPS targets will require libfdt. Define
TARGET_NEED_FDTin all mips*-softmmu.mak files.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- configs/targets/mips-softmmu.mak | 1 + configs/targets/mips64-softmmu.mak | 1 + configs/targets/mipsel-softmmu.mak | 1 + 3 files changed, 3 insertions(+)configs/targets/mips-softmmu.mak +1
-0@@ -2,3 +2,4 @@ TARGET_ARCH=mips TARGET_ALIGNED_ONLY=y TARGET_BIG_ENDIAN=y TARGET_SUPPORTS_MTTCG=y +TARGET_NEED_FDT=yconfigs/targets/mips64-softmmu.mak +1
-0@@ -2,3 +2,4 @@ TARGET_ARCH=mips64 TARGET_BASE_ARCH=mips TARGET_ALIGNED_ONLY=y TARGET_BIG_ENDIAN=y +TARGET_NEED_FDT=yconfigs/targets/mipsel-softmmu.mak +0
-0
configs/targets/mipsel-softmmu.mak line 4
Quoted 4 lines
configs/targets/mipsel-softmmu.mak +1
-0@@ -1,3 +1,4 @@ TARGET_ARCH=mips TARGET_ALIGNED_ONLY=y TARGET_SUPPORTS_MTTCG=y +TARGET_NEED_FDT=y
PATCH v3 3/4 hw/misc: Add MIPS Trickbox device
In reply to Philippe Mathieu-DaudéFrom: Jiaxun Yang <[email protected]>
MIPS Trickbox is a emulated device present in MIPS's IASIM simulator for decades. It's capable of managing simulator status, signaling interrupts, doing DMA and EJTAG signal stimulations.
For now we just use definition of this device and implement power management related functions.
Message-Id: <[email protected]> [PMD: Remove pointless mask in mips_trickbox_write(),
declare QOM macros using OBJECT_DECLARE_SIMPLE_TYPE()]
--- hw/misc/Kconfig | 3 + hw/misc/meson.build | 1 + hw/misc/mips_trickbox.c | 97 +++++++++++++++++++++++++++++++++ hw/misc/trace-events | 4 ++ include/hw/misc/mips_trickbox.h | 39 +++++++++++++ 5 files changed, 144 insertions(+) create mode 100644 hw/misc/mips_trickbox.c create mode 100644 include/hw/misc/mips_trickbox.h
hw/misc/Kconfig +3 -0
@@ -85,6 +85,9 @@ config STM32F4XX_EXTI config MIPS_ITU bool +config MIPS_TRICKBOX + bool + config MPS2_FPGAIO bool select LED
hw/misc/meson.build +1 -0
@@ -136,6 +136,7 @@ specific_ss.add(when: 'CONFIG_MAC_VIA', if_true: files('mac_via.c')) specific_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('mips_cmgcr.c', 'mips_cpc.c')) specific_ss.add(when: 'CONFIG_MIPS_ITU', if_true: files('mips_itu.c')) +specific_ss.add(when: 'CONFIG_MIPS_TRICKBOX', if_true: files('mips_trickbox.c')) softmmu_ss.add(when: 'CONFIG_SBSA_REF', if_true: files('sbsa_ec.c'))
hw/misc/mips_trickbox.c new file +97 -0
97 lines not on this page · raw message
hw/misc/trace-events +4 -0
@@ -279,3 +279,7 @@ virt_ctrl_instance_init(void *dev) "ctrl: %p" lasi_chip_mem_valid(uint64_t addr, uint32_t val) "access to addr 0x%"PRIx64" is %d" lasi_chip_read(uint64_t addr, uint32_t val) "addr 0x%"PRIx64" val 0x%08x" lasi_chip_write(uint64_t addr, uint32_t val) "addr 0x%"PRIx64" val 0x%08x" + +# mips_trickbox.c +mips_trickbox_read(uint64_t addr, uint32_t val) "addr 0x%"PRIx64" val 0x%08x" +mips_trickbox_write(uint64_t addr, uint32_t val) "addr 0x%"PRIx64" val 0x%08x"
include/hw/misc/mips_trickbox.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* SPDX-License-Identifier: LGPL-2.0-or-later +* +* MIPS Trickbox +*/ + + +#ifndef HW_MIPS_TRICKBOX_H +#define HW_MIPS_TRICKBOX_H + +#include "hw/sysbus.h" +#include "qom/object.h" + +#define TYPE_MIPS_TRICKBOX "mips.trickbox" + +OBJECT_DECLARE_SIMPLE_TYPE(MIPSTrickboxState, MIPS_TRICKBOX) + +struct MIPSTrickboxState { +/*< private >*/ +SysBusDevice parent_obj; + +/*< public >*/ +MemoryRegion mmio; +}; + +#define REG_SIM_CMD 0x0 + +enum { +TRICK_PANIC =1 , +TRICK_HALT =2 , +TRICK_SUSPEND =3 , +TRICK_RESET =4 , +TRICK_FAIL_MIPS =0x2c00abc1 , +TRICK_PASS_MIPS =0x2c00abc2 , +TRICK_FAIL_NANOMIPS =0x80005bc1 , +TRICK_PASS_NANOMIPS =0x80005bc2 +}; + +#endif
Signature · 1 line
2.38.1
Re: [PATCH v3 3/4] hw/misc: Add MIPS Trickbox device
Quoted 56 lines · Philippe Mathieu-Daudé
From: Jiaxun Yang <[email protected]>
MIPS Trickbox is a emulated device present in MIPS's IASIM simulator for decades. It's capable of managing simulator status, signaling interrupts, doing DMA and EJTAG signal stimulations.
For now we just use definition of this device and implement power management related functions.
Signed-off-by Jiaxun Yang <[email protected]>Message-Id: <[email protected]> [PMD: Remove pointless mask in
mips_trickbox_write(),
declare QOM macros usingOBJECT_DECLARE_SIMPLE_TYPE()]Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/misc/Kconfig | 3 + hw/misc/meson.build | 1 + hw/misc/mips_trickbox.c | 97 +++++++++++++++++++++++++++++++++ hw/misc/trace-events | 4 ++ include/hw/misc/mips_trickbox.h | 39 +++++++++++++ 5 files changed, 144 insertions(+)create mode 100644
hw/misc/mips_trickbox.ccreate mode 100644include/hw/misc/mips_trickbox.hhw/misc/Kconfig +3
-0@@ -85,6 +85,9 @@ config STM32F4XX_EXTI config MIPS_ITU bool +config MIPS_TRICKBOX + bool + config MPS2_FPGAIO bool select LEDhw/misc/meson.build +1
-0@@ -136,6 +136,7 @@ specific_ss.add(when: 'CONFIG_MAC_VIA', if_true: files('mac_via.c')) specific_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('mips_cmgcr.c', 'mips_cpc.c')) specific_ss.add(when: 'CONFIG_MIPS_ITU', if_true: files('mips_itu.c')) +specific_ss.add(when: 'CONFIG_MIPS_TRICKBOX', if_true: files('mips_trickbox.c')) softmmu_ss.add(when: 'CONFIG_SBSA_REF', if_true: files('sbsa_ec.c'))hw/misc/mips_trickbox.c new file +0
-0
hw/misc/mips_trickbox.c line 4
Quoted 4 lines
hw/misc/mips_trickbox.c new file +4
-0@@ -0,0 +1,97 @@ +/* +* SPDX-License-Identifier: LGPL-2.0-or-later +* +* MIPS Trickbox
I'd maybe add the description from the commit message here to tell the one who's looking at this source code what this file is all about.
Quoted 9 lines
hw/misc/mips_trickbox.c new file +9
-0+*/ + +#include "qemu/osdep.h" +#include "hw/sysbus.h" +#include "qapi/error.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "trace.h" +#include "sysemu/runstate.h"
hw/misc/mips_trickbox.c line 23
Quoted 10 lines
hw/misc/mips_trickbox.c new file +10
-0+#include "hw/misc/mips_trickbox.h" + +static uint64_t mips_trickbox_read (void *opaque,hwaddr addr,unsigned int size) +{ +uint64_t value =0 ; + +qemu_log_mask (LOG_UNIMP , +"%s: unimplemented register read 0x%02" HWADDR_PRIx"\n" , + __func__, addr); +trace_mips_trickbox_read (size, value);
Does it really make sense to have both, a trace point and a log for the same thing?
Thomas
PATCH v3 4/4 hw/mips: Add MIPS virt board
In reply to Philippe Mathieu-DaudéFrom: Jiaxun Yang <[email protected]>
MIPS virt board is design to utilize existing VirtIO infrastures but also comptitable with MIPS's existing internal simulation tools.
It includes virtio-pci, virtio-mmio, pcie gpex, flash rom, fw_cfg, goldfish-rtc and MIPS CPS system.
It should be able to cooperate with any MIPS CPU cores.
Message-Id: <[email protected]> [PMD: Do not select PCI in Kconfig, compile virt.o using fdt flags
in meson.build, use HWADDR_PRIx, name MachineState var 'ms', declare QOM macros using OBJECT_DECLARE_SIMPLE_TYPE(), declare machine type using DEFINE_TYPES(), fix checkpatch.pl style violations, fix patch conflict in docs/system/target-mips.rst, set CPS 'num-vp' property instead of 'num-core']
--- MAINTAINERS | 7 + configs/devices/mips-softmmu/common.mak | 1 + docs/system/target-mips.rst | 22 + hw/mips/Kconfig | 16 + hw/mips/meson.build | 1 + hw/mips/virt.c | 913 ++++++++++++++++++++++++ 6 files changed, 960 insertions(+) create mode 100644 hw/mips/virt.c
MAINTAINERS +7 -0
@@ -1295,6 +1295,13 @@ F: hw/mips/boston.c F: hw/pci-host/xilinx-pcie.c F: include/hw/pci-host/xilinx-pcie.h +Virt +M: Jiaxun Yang <[email protected]> +S: Maintained +F: hw/mips/virt.c +F: hw/misc/mips_trickbox.c +F: include/hw/misc/mips_trickbox.h + OpenRISC Machines ----------------- or1k-sim
configs/devices/mips-softmmu/common.mak +1 -0
@@ -24,6 +24,7 @@ CONFIG_I8259=y CONFIG_MC146818RTC=y CONFIG_MIPS_CPS=y CONFIG_MIPS_ITU=y +CONFIG_MIPS_VIRT=y CONFIG_MALTA=y CONFIG_PCNET_PCI=y CONFIG_MIPSSIM=y
docs/system/target-mips.rst +22 -0
@@ -8,6 +8,8 @@ endian options, ``qemu-system-mips``, ``qemu-system-mipsel`` ``qemu-system-mips64`` and ``qemu-system-mips64el``. Five different machine types are emulated: +- Generic Virtual Platform \"virt\" + - The MIPS Malta prototype board \"malta\" - An ACER Pica \"pica61\". This machine needs the 64-bit emulator.
@@ -17,6 +19,26 @@ machine types are emulated: - A MIPS Magnum R4000 machine \"magnum\". This machine needs the 64-bit emulator. +The virt machine supports the following devices: + +- A range of MIPS CPUs, default is the P5600 (32-bit) or I6400 (64-bit) + +- MIPS CM (Coherence Manager) + +- CFI parallel NOR flash memory + +- 1 NS16550 compatible UART + +- 1 Google Goldfish RTC + +- 1 MIPS Trickbox device + +- 8 virtio-mmio transport devices + +- 1 generic PCIe host bridge + +- The fw_cfg device that allows a guest to obtain data from QEMU + The Malta emulation supports the following devices: - Core board with MIPS 24Kf CPU and Galileo system controller
hw/mips/Kconfig +16 -0
@@ -59,5 +59,21 @@ config MIPS_BOSTON select AHCI_ICH9 select SERIAL +config MIPS_VIRT + bool + imply PCI_DEVICES + imply VIRTIO_VGA + imply TEST_DEVICES + select MIPS_CPS + select MIPS_TRICKBOX + select SERIAL + select FW_CFG_MIPS + select GOLDFISH_RTC + select PCI_EXPRESS_GENERIC_BRIDGE + select PFLASH_CFI01 + select VIRTIO_MMIO + select FW_CFG_DMA + select PLATFORM_BUS + config FW_CFG_MIPS bool
hw/mips/meson.build +1 -0
@@ -1,6 +1,7 @@ mips_ss = ss.source_set() mips_ss.add(files('bootloader.c', 'mips_int.c')) mips_ss.add(when: 'CONFIG_FW_CFG_MIPS', if_true: files('fw_cfg.c')) +mips_ss.add(when: 'CONFIG_MIPS_VIRT', if_true: [files('virt.c'), fdt]) mips_ss.add(when: 'CONFIG_LOONGSON3V', if_true: files('loongson3_bootp.c', 'loongson3_virt.c')) mips_ss.add(when: 'CONFIG_MALTA', if_true: files('malta.c')) mips_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('cps.c'))
hw/mips/virt.c new file +913 -0
913 lines not on this page · raw message
Signature · 1 line
2.38.1