qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH-for-10.0] system/qtest: Access memory using cpu_physical_memo


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH-for-10.0] system/qtest: Access memory using cpu_physical_memory_rw() API
Date: Thu, 28 Nov 2024 06:56:25 +0100
User-agent: Mozilla Thunderbird

On 27/11/24 23:35, Richard Henderson wrote:
On 11/27/24 13:19, Philippe Mathieu-Daudé wrote:
There is no vCPU within the QTest accelerator (well, they
are stubs doing nothing, see dummy_cpu_thread_fn).
Directly use the cpu_physical_memory_rw() API -- which
amusingly prefixed 'cpu_' does not use vCPU -- to access
memory. This reduces accesses to the global 'first_cpu'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
  system/qtest.c | 42 ++++++++++++++----------------------------
  1 file changed, 14 insertions(+), 28 deletions(-)

diff --git a/system/qtest.c b/system/qtest.c
index 12703a20455..a2de9a7d5a4 100644
--- a/system/qtest.c
+++ b/system/qtest.c
@@ -18,6 +18,7 @@
  #include "chardev/char-fe.h"
  #include "exec/ioport.h"
  #include "exec/memory.h"
+#include "exec/cpu-common.h"
  #include "exec/tswap.h"
  #include "hw/qdev-core.h"
  #include "hw/irq.h"
@@ -514,23 +515,19 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
          if (words[0][5] == 'b') {
              uint8_t data = value;
-            address_space_write(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
-                                &data, 1);
+            cpu_physical_memory_write(addr, &data, 1);

This just calls address_space_write with &address_space_memory.
I assume we'll get rid of address_space_memory too, at some point.

Certainly, but one thing at a time ;) For the first prototype
I'm focusing on being able to instantiate vCPUs from different
target architecture in "any machine we have now" (even if it
doesn't make much sense). I'll then move to HW modelling, likely
starting by vCPU Clusters and then address spaces.

But I suppose that's good enough for qtest for now.

Little win: less first_cpu accesses. What really bother me in
this file are the endianness mentions (and tswap calls).


r~





reply via email to

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