qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC PATCH 2/4] qtest: make read/write operation appear to be from C


From: Philippe Mathieu-Daudé
Subject: Re: [RFC PATCH 2/4] qtest: make read/write operation appear to be from CPU
Date: Fri, 16 Sep 2022 16:40:27 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.0

On 15/9/22 10:08, Richard Henderson wrote:
On 9/14/22 17:09, Alex Bennée wrote:
The point of qtest is to simulate how running code might interact with
the system. However because it's not a real system we have places in
the code which especially handle check qtest_enabled() before
referencing current_cpu. Now we can encode these details in the
MemTxAttrs lets do that so we can start removing them.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
  softmmu/qtest.c | 31 +++++++++++++++++++------------
  1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/softmmu/qtest.c b/softmmu/qtest.c
index f8acef2628..c086bd34b7 100644
--- a/softmmu/qtest.c
+++ b/softmmu/qtest.c
@@ -362,6 +362,13 @@ static void qtest_clock_warp(int64_t dest)
      qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
  }
+/*
+ * QTest memory accesses are treated as though they come from the
+ * first (non-existent) CPU. We need to expose this via MemTxAttrs for
+ * those bits of HW which care which core is accessing them.
+ */
+#define MEMTXATTRS_QTEST ((MemTxAttrs) { .requester_cpu = 1 })

Maybe clearer as { .requester_cpu = true, .requester_id = 0 }?
Otherwise it kinda looks like we're setting the second cpu (index 1).

We could rename the field as 'requester_is_cpu'.

Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~





reply via email to

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