* [Qemu-devel] [PATCH] qtest: Use cpu address space instead of system memory
@ 2018-07-02 6:52 Julia Suvorova
2018-07-02 8:51 ` Stefan Hajnoczi
2018-07-02 15:25 ` Paolo Bonzini
0 siblings, 2 replies; 3+ messages in thread
From: Julia Suvorova @ 2018-07-02 6:52 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Peter Maydell, Stefan Hajnoczi, Joel Stanley,
Jim Mussared, Steffen Görtz, Julia Suvorova
Some devices (like nvic in armv7m) are not accessable through
address_space_memory, therefore can not be tested with qtest.
Signed-off-by: Julia Suvorova <jusual@mail.ru>
---
qtest.c | 39 ++++++++++++++++++++++++++-------------
1 file changed, 26 insertions(+), 13 deletions(-)
diff --git a/qtest.c b/qtest.c
index cbbfb71114..69b9e9962b 100644
--- a/qtest.c
+++ b/qtest.c
@@ -387,19 +387,23 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
if (words[0][5] == 'b') {
uint8_t data = value;
- cpu_physical_memory_write(addr, &data, 1);
+ address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
+ &data, 1, true);
} else if (words[0][5] == 'w') {
uint16_t data = value;
tswap16s(&data);
- cpu_physical_memory_write(addr, &data, 2);
+ address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
+ (uint8_t *) &data, 2, true);
} else if (words[0][5] == 'l') {
uint32_t data = value;
tswap32s(&data);
- cpu_physical_memory_write(addr, &data, 4);
+ address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
+ (uint8_t *) &data, 4, true);
} else if (words[0][5] == 'q') {
uint64_t data = value;
tswap64s(&data);
- cpu_physical_memory_write(addr, &data, 8);
+ address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
+ (uint8_t *) &data, 8, true);
}
qtest_send_prefix(chr);
qtest_send(chr, "OK\n");
@@ -417,18 +421,22 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
if (words[0][4] == 'b') {
uint8_t data;
- cpu_physical_memory_read(addr, &data, 1);
+ address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
+ &data, 1, false);
value = data;
} else if (words[0][4] == 'w') {
uint16_t data;
- cpu_physical_memory_read(addr, &data, 2);
+ address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
+ (uint8_t *) &data, 2, false);
value = tswap16(data);
} else if (words[0][4] == 'l') {
uint32_t data;
- cpu_physical_memory_read(addr, &data, 4);
+ address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
+ (uint8_t *) &data, 4, false);
value = tswap32(data);
} else if (words[0][4] == 'q') {
- cpu_physical_memory_read(addr, &value, 8);
+ address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
+ (uint8_t *) &value, 8, false);
tswap64s(&value);
}
qtest_send_prefix(chr);
@@ -448,7 +456,8 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
g_assert(len);
data = g_malloc(len);
- cpu_physical_memory_read(addr, data, len);
+ address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
+ data, len, false);
enc = g_malloc(2 * len + 1);
for (i = 0; i < len; i++) {
@@ -473,7 +482,8 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
g_assert(ret == 0);
data = g_malloc(len);
- cpu_physical_memory_read(addr, data, len);
+ address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
+ data, len, false);
b64_data = g_base64_encode(data, len);
qtest_send_prefix(chr);
qtest_sendf(chr, "OK %s\n", b64_data);
@@ -507,7 +517,8 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
data[i] = 0;
}
}
- cpu_physical_memory_write(addr, data, len);
+ address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
+ data, len, true);
g_free(data);
qtest_send_prefix(chr);
@@ -529,7 +540,8 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
if (len) {
data = g_malloc(len);
memset(data, pattern, len);
- cpu_physical_memory_write(addr, data, len);
+ address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
+ data, len, true);
g_free(data);
}
@@ -562,7 +574,8 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
out_len = MIN(out_len, len);
}
- cpu_physical_memory_write(addr, data, out_len);
+ address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
+ data, len, true);
qtest_send_prefix(chr);
qtest_send(chr, "OK\n");
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Qemu-devel] [PATCH] qtest: Use cpu address space instead of system memory
2018-07-02 6:52 [Qemu-devel] [PATCH] qtest: Use cpu address space instead of system memory Julia Suvorova
@ 2018-07-02 8:51 ` Stefan Hajnoczi
2018-07-02 15:25 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2018-07-02 8:51 UTC (permalink / raw)
To: Julia Suvorova
Cc: qemu-devel, Peter Maydell, Jim Mussared, Steffen Görtz,
Joel Stanley, Stefan Hajnoczi, Paolo Bonzini
[-- Attachment #1: Type: text/plain, Size: 436 bytes --]
On Mon, Jul 02, 2018 at 09:52:37AM +0300, Julia Suvorova via Qemu-devel wrote:
> Some devices (like nvic in armv7m) are not accessable through
> address_space_memory, therefore can not be tested with qtest.
>
> Signed-off-by: Julia Suvorova <jusual@mail.ru>
> ---
> qtest.c | 39 ++++++++++++++++++++++++++-------------
> 1 file changed, 26 insertions(+), 13 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] qtest: Use cpu address space instead of system memory
2018-07-02 6:52 [Qemu-devel] [PATCH] qtest: Use cpu address space instead of system memory Julia Suvorova
2018-07-02 8:51 ` Stefan Hajnoczi
@ 2018-07-02 15:25 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2018-07-02 15:25 UTC (permalink / raw)
To: Julia Suvorova, qemu-devel
Cc: Peter Maydell, Stefan Hajnoczi, Joel Stanley, Jim Mussared,
Steffen Görtz
On 02/07/2018 08:52, Julia Suvorova wrote:
> Some devices (like nvic in armv7m) are not accessable through
> address_space_memory, therefore can not be tested with qtest.
>
> Signed-off-by: Julia Suvorova <jusual@mail.ru>
> ---
> qtest.c | 39 ++++++++++++++++++++++++++-------------
> 1 file changed, 26 insertions(+), 13 deletions(-)
>
> diff --git a/qtest.c b/qtest.c
> index cbbfb71114..69b9e9962b 100644
> --- a/qtest.c
> +++ b/qtest.c
> @@ -387,19 +387,23 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
>
> if (words[0][5] == 'b') {
> uint8_t data = value;
> - cpu_physical_memory_write(addr, &data, 1);
> + address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
> + &data, 1, true);
> } else if (words[0][5] == 'w') {
> uint16_t data = value;
> tswap16s(&data);
> - cpu_physical_memory_write(addr, &data, 2);
> + address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
> + (uint8_t *) &data, 2, true);
> } else if (words[0][5] == 'l') {
> uint32_t data = value;
> tswap32s(&data);
> - cpu_physical_memory_write(addr, &data, 4);
> + address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
> + (uint8_t *) &data, 4, true);
> } else if (words[0][5] == 'q') {
> uint64_t data = value;
> tswap64s(&data);
> - cpu_physical_memory_write(addr, &data, 8);
> + address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
> + (uint8_t *) &data, 8, true);
> }
> qtest_send_prefix(chr);
> qtest_send(chr, "OK\n");
> @@ -417,18 +421,22 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
>
> if (words[0][4] == 'b') {
> uint8_t data;
> - cpu_physical_memory_read(addr, &data, 1);
> + address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
> + &data, 1, false);
> value = data;
> } else if (words[0][4] == 'w') {
> uint16_t data;
> - cpu_physical_memory_read(addr, &data, 2);
> + address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
> + (uint8_t *) &data, 2, false);
> value = tswap16(data);
> } else if (words[0][4] == 'l') {
> uint32_t data;
> - cpu_physical_memory_read(addr, &data, 4);
> + address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
> + (uint8_t *) &data, 4, false);
> value = tswap32(data);
> } else if (words[0][4] == 'q') {
> - cpu_physical_memory_read(addr, &value, 8);
> + address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
> + (uint8_t *) &value, 8, false);
> tswap64s(&value);
> }
> qtest_send_prefix(chr);
> @@ -448,7 +456,8 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
> g_assert(len);
>
> data = g_malloc(len);
> - cpu_physical_memory_read(addr, data, len);
> + address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
> + data, len, false);
>
> enc = g_malloc(2 * len + 1);
> for (i = 0; i < len; i++) {
> @@ -473,7 +482,8 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
> g_assert(ret == 0);
>
> data = g_malloc(len);
> - cpu_physical_memory_read(addr, data, len);
> + address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
> + data, len, false);
> b64_data = g_base64_encode(data, len);
> qtest_send_prefix(chr);
> qtest_sendf(chr, "OK %s\n", b64_data);
> @@ -507,7 +517,8 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
> data[i] = 0;
> }
> }
> - cpu_physical_memory_write(addr, data, len);
> + address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
> + data, len, true);
> g_free(data);
>
> qtest_send_prefix(chr);
> @@ -529,7 +540,8 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
> if (len) {
> data = g_malloc(len);
> memset(data, pattern, len);
> - cpu_physical_memory_write(addr, data, len);
> + address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
> + data, len, true);
> g_free(data);
> }
>
> @@ -562,7 +574,8 @@ static void qtest_process_command(CharBackend *chr, gchar **words)
> out_len = MIN(out_len, len);
> }
>
> - cpu_physical_memory_write(addr, data, out_len);
> + address_space_rw(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED,
> + data, len, true);
>
> qtest_send_prefix(chr);
> qtest_send(chr, "OK\n");
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-02 15:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-02 6:52 [Qemu-devel] [PATCH] qtest: Use cpu address space instead of system memory Julia Suvorova
2018-07-02 8:51 ` Stefan Hajnoczi
2018-07-02 15:25 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).