qemu-devel
[Top][All Lists]
Advanced

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

[RFC PATCH 3/9] qtest: Directly use global address_space_memory when no


From: Philippe Mathieu-Daudé
Subject: [RFC PATCH 3/9] qtest: Directly use global address_space_memory when no CPU available
Date: Mon, 17 Aug 2020 18:18:47 +0200

Currently all qtest MMIO access are dispatched via the first CPU
available. This limitation doesn't allow use to use the 'none'
machine to run tests. Unleash this limitation by selecting the
global address_space_memory when no CPU is available.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 softmmu/qtest.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/softmmu/qtest.c b/softmmu/qtest.c
index 81b5110783..7f018d2faf 100644
--- a/softmmu/qtest.c
+++ b/softmmu/qtest.c
@@ -19,6 +19,7 @@
 #include "chardev/char-fe.h"
 #include "exec/ioport.h"
 #include "exec/memory.h"
+#include "exec/address-spaces.h"
 #include "hw/irq.h"
 #include "sysemu/accel.h"
 #include "sysemu/cpus.h"
@@ -276,6 +277,13 @@ static void qtest_irq_handler(void *opaque, int n, int 
level)
 /* Default address space for MMIO accesses */
 static AddressSpace *qtest_mem_as(void)
 {
+    if (!first_cpu) {
+        /*
+         * The 'none' machine doesn't have any CPU,
+         * directly access the main address space.
+         */
+        return &address_space_memory;
+    }
     return first_cpu->as;
 }
 
-- 
2.26.2




reply via email to

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