qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 6/9] hw/core/null-machine: Allow to use the MMIO 'test' devic


From: Philippe Mathieu-Daudé
Subject: [RFC PATCH 6/9] hw/core/null-machine: Allow to use the MMIO 'test' device
Date: Mon, 17 Aug 2020 18:18:50 +0200

The MMIO 'test' device (TYPE_MMIO_TESTDEV) can be mapped almost
anywhere on the sysbus memory. Allow the 'none' machine to
instantiate it from the command line, such:

  $ qemu-system-sh4 -M none -monitor stdio \
    -device mmio-testdev,address=0x00000000 -monitor stdio
  (qemu) info mtree
  address-space: memory
    0000000000000000-ffffffffffffffff (prio 0, i/o): system
      0000000000000000-000000001fffffff (prio 0, i/o): testdev
        0000000000000000-00000000000007ff (prio 0, ram): testdev-sram
        0000000010000000-0000000017ffffff (prio 0, i/o): interleaver-container
          0000000011608000-00000000116081ff (prio 0, i/o): interleaver-16x8
          0000000013208000-00000000132083ff (prio 0, i/o): interleaver-32x8
          0000000013216000-00000000132161ff (prio 0, i/o): interleaver-32x16
          0000000016408000-00000000164087ff (prio 0, i/o): interleaver-64x8
          0000000016416000-00000000164163ff (prio 0, i/o): interleaver-64x16
          0000000016432000-00000000164321ff (prio 0, i/o): interleaver-64x32

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/core/null-machine.c | 2 ++
 hw/misc/mmio-testdev.c | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/hw/core/null-machine.c b/hw/core/null-machine.c
index 7e693523d7..d8be17092f 100644
--- a/hw/core/null-machine.c
+++ b/hw/core/null-machine.c
@@ -17,6 +17,7 @@
 #include "sysemu/sysemu.h"
 #include "exec/address-spaces.h"
 #include "hw/core/cpu.h"
+#include "hw/misc/testdev.h"
 
 static void machine_none_init(MachineState *mch)
 {
@@ -55,6 +56,7 @@ static void machine_none_machine_init(MachineClass *mc)
     mc->no_floppy = 1;
     mc->no_cdrom = 1;
     mc->no_sdcard = 1;
+    machine_class_allow_dynamic_sysbus_dev(mc, TYPE_MMIO_TESTDEV);
 }
 
 DEFINE_MACHINE("none", machine_none_machine_init)
diff --git a/hw/misc/mmio-testdev.c b/hw/misc/mmio-testdev.c
index 3b7a8057b2..42eed16f2d 100644
--- a/hw/misc/mmio-testdev.c
+++ b/hw/misc/mmio-testdev.c
@@ -9,6 +9,10 @@
 /*
  * This device is mostly used to test QEMU internal MMIO devices.
  * Accesses using CPU core are not allowed.
+ *
+ * This device is meant to be used for testing, like:
+ *
+ *   qemu-system-sh4 -M none -device mmio-testdev,address=0x10000000
  */
 
 #include "qemu/osdep.h"
-- 
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]