From patchwork Mon Jul 2 06:52:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev\" via" X-Patchwork-Id: 10500541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0C3A160284 for ; Mon, 2 Jul 2018 06:53:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE4CE287AE for ; Mon, 2 Jul 2018 06:53:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E20D7287B6; Mon, 2 Jul 2018 06:53:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E5840287B1 for ; Mon, 2 Jul 2018 06:53:56 +0000 (UTC) Received: from localhost ([::1]:57309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZsih-0005xz-S5 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 02 Jul 2018 02:53:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fZshw-0005dp-Kt for qemu-devel@nongnu.org; Mon, 02 Jul 2018 02:53:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fZsht-0001SY-GY for qemu-devel@nongnu.org; Mon, 02 Jul 2018 02:53:08 -0400 Received: from smtp33.i.mail.ru ([94.100.177.93]:42540) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fZsht-0001Ol-5a for qemu-devel@nongnu.org; Mon, 02 Jul 2018 02:53:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Message-Id:Date:Subject:Cc:To:From; bh=b4zy0tj+GeztVoyEIHe8amE3N83PeLpc+QlH0lKILK4=; b=gHh2JwZtjd2KrIDBstZGUl85WwPxS5+/9NQIubRe9Bla+kntUz+dSsi9bwImFIB6mb7JIhLyHSdGtbHfr1GkfmQimbPRLoWbo9JVr2SMc1bd9v0Q+tpsVYHAwXGgihDUaVkBh+pzsWCCXlRnLTxMLwx/5yPY+rJLDUu9SP82bTI=; Received: by smtp33.i.mail.ru with esmtpa (envelope-from ) id 1fZshm-0006qi-Ro; Mon, 02 Jul 2018 09:52:59 +0300 To: qemu-devel@nongnu.org Date: Mon, 2 Jul 2018 09:52:37 +0300 Message-Id: <20180702065237.27899-1-jusual@mail.ru> X-Mailer: git-send-email 2.17.1 Authentication-Results: smtp33.i.mail.ru; auth=pass smtp.auth=jusual@mail.ru smtp.mailfrom=jusual@mail.ru X-7FA49CB5: 0D63561A33F958A561F6899EFAA7F09C9A8C43B465814B2CA6D6C243A2D470C10A6AB1C7CE11FEE34AF66DFF1D4D208B76E601842F6C81A1F004C906525384306FED454B719173D6725E5C173C3A84C30B8B320EE581A760F5682F2AD49D4FF85E97997F8902A7B9C4224003CC836476C0CAF46E325F83A50BF2EBBBDD9D6B0FECB2555BB02FD5A93B503F486389A921A5CC5B56E945C8DA X-Mailru-Sender: 7766D515518070DE138AAC7428EA760D24BAFD5794538C025D29AAB6CE85562FE13D01DA4558E8017C4160E8B47E48163DDE9B364B0DF2898CB68AF7A628805D594FB4C9F0DBF412AE208404248635DF X-Mras: OK X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 94.100.177.93 Subject: [Qemu-devel] [PATCH] qtest: Use cpu address space instead of system memory X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Julia Suvorova via Qemu-devel From: "Denis V. Lunev\" via" Reply-To: Julia Suvorova Cc: Peter Maydell , Jim Mussared , =?UTF-8?q?Steffen=20G=C3=B6rtz?= , Joel Stanley , Stefan Hajnoczi , Paolo Bonzini , Julia Suvorova Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Stefan Hajnoczi --- 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");