From nobody Tue Feb 10 16:22:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530827678982594.9368432621012; Thu, 5 Jul 2018 14:54:38 -0700 (PDT) Received: from localhost ([::1]:54942 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbCD0-00023o-9a for importer@patchew.org; Thu, 05 Jul 2018 17:54:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbCA4-0000Tr-4N for qemu-devel@nongnu.org; Thu, 05 Jul 2018 17:51:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fbCA1-0000G5-1S for qemu-devel@nongnu.org; Thu, 05 Jul 2018 17:51:36 -0400 Received: from smtp39.i.mail.ru ([94.100.177.99]:58784) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fbCA0-0000F7-Pe for qemu-devel@nongnu.org; Thu, 05 Jul 2018 17:51:32 -0400 Received: by smtp39.i.mail.ru with esmtpa (envelope-from ) id 1fbC9y-0007IQ-TI; Fri, 06 Jul 2018 00:51:31 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=Iqwgw1AmpCeOMK+FtjGhwZzlNEyu93a52V80bEbwa9Q=; b=Exj4vjxMMltjgPsqpePDdw+GcGiiqBPUYDPPwiVppR8nhgk1kyYr2JXUUOwKkF0ANViW9OfCOaCuWtShcLBRpCagtl72iOv4KtiUe32uADmU68yZlGmQbKohAivwAt71jNYTGsJF790ElmGrb+eybIVw1JLPPVhnaosfJi4LvM0=; To: qemu-devel@nongnu.org Date: Fri, 6 Jul 2018 00:50:52 +0300 Message-Id: <20180705215052.8795-3-jusual@mail.ru> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180705215052.8795-1-jusual@mail.ru> References: <20180705215052.8795-1-jusual@mail.ru> Authentication-Results: smtp39.i.mail.ru; auth=pass smtp.auth=jusual@mail.ru smtp.mailfrom=jusual@mail.ru X-7FA49CB5: 0D63561A33F958A5CC387DB3934711635E321A400C02D8ABB760903688ECE4590A6AB1C7CE11FEE3EB7D890E3377C531BA3038C0950A5D36B5C8C57E37DE458B4C7702A67D5C33162DBA43225CD8A89F0A35B161A8BF67C18D91E33B04C50BB10FDD63A5C042FD3943847C11F186F3C5E7DDDDC251EA7DABCC89B49CDF41148F458B267F216095A92623479134186CDE6BA297DBC24807EABDAD6C7F3747799A X-Mailru-Sender: 7766D515518070DE138AAC7428EA760DE71244350F3CFE71F9B11F5F7FC8B2D0A1280B80C886AB447C4160E8B47E48163DDE9B364B0DF2898CB68AF7A628805D594FB4C9F0DBF412AE208404248635DF X-Mras: OK X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 94.100.177.99 Subject: [Qemu-devel] [RFC v2 2/2] tests: Add ARMv6-M reserved register test 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: , From: Julia Suvorova via Qemu-devel Reply-To: Julia Suvorova Cc: Peter Maydell , Jim Mussared , =?UTF-8?q?Steffen=20G=C3=B6rtz?= , Joel Stanley , Stefan Hajnoczi , Julia Suvorova Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Check that reserved SCS registers return 0 at read, and writes are ignored. Based-on: <20180627143815.1829-1-joel@jms.id.au> Based-on: <20180630091343.14391-1-stefanha@redhat.com> Signed-off-by: Julia Suvorova --- Test will work if Joel's patches will use ARMv6-M. tests/Makefile.include | 2 ++ tests/tcg/arm/test-reserved-reg.c | 60 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 tests/tcg/arm/test-reserved-reg.c diff --git a/tests/Makefile.include b/tests/Makefile.include index d323c42682..8ab0b0d15f 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -387,6 +387,7 @@ gcov-files-arm-y +=3D hw/timer/arm_mptimer.c check-qtest-arm-y +=3D tests/boot-serial-test$(EXESUF) check-qtest-arm-y +=3D tests/sdhci-test$(EXESUF) check-qtest-arm-y +=3D tests/hexloader-test$(EXESUF) +check-qtest-arm-y +=3D tests/tcg/arm/test-reserved-reg$(EXESUF) =20 check-qtest-aarch64-y =3D tests/numa-test$(EXESUF) check-qtest-aarch64-y +=3D tests/sdhci-test$(EXESUF) @@ -771,6 +772,7 @@ tests/device-introspect-test$(EXESUF): tests/device-int= rospect-test.o tests/rtc-test$(EXESUF): tests/rtc-test.o tests/m48t59-test$(EXESUF): tests/m48t59-test.o tests/hexloader-test$(EXESUF): tests/hexloader-test.o +tests/test-reserved-reg$(EXESUF): tests/tcg/arm/test-reserved-reg.o tests/endianness-test$(EXESUF): tests/endianness-test.o tests/spapr-phb-test$(EXESUF): tests/spapr-phb-test.o $(libqos-obj-y) tests/prom-env-test$(EXESUF): tests/prom-env-test.o $(libqos-obj-y) diff --git a/tests/tcg/arm/test-reserved-reg.c b/tests/tcg/arm/test-reserve= d-reg.c new file mode 100644 index 0000000000..97273ff24d --- /dev/null +++ b/tests/tcg/arm/test-reserved-reg.c @@ -0,0 +1,60 @@ +/* + * Test ARMv6-M SCS reserved registers + * + * Copyright (c) 2018 Julia Suvorova + * + * This work is licensed under the terms of the GNU GPL, version 2 + * or later. See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "libqtest.h" + +static void test_reserved_reg(void) +{ + QTestState *s; + int i; + static const uint64_t reserved_reg[] =3D { 0xe000ed10, /* SCR */ + 0xe000ed18, /* SHPR1 */ + 0xe000ed28, /* CFSR */ + 0xe000ed2c, /* HFSR */ + 0xe000ed34, /* MMFAR */ + 0xe000ed38, /* BFAR */ + 0xe000ed3c, /* AFSR */ + 0xe000ed40, /* CPUID */ + 0xe000ed88, /* CPACR */ + 0xe000ef00 /* STIR */ }; + static const uint8_t mini_kernel[] =3D { 0x00, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00 }; + ssize_t wlen, kernel_size =3D sizeof(mini_kernel); + int code_fd; + char codetmp[] =3D "/tmp/reserved-reg-test-XXXXXX"; + + code_fd =3D mkstemp(codetmp); + wlen =3D write(code_fd, mini_kernel, sizeof(mini_kernel)); + g_assert(wlen =3D=3D kernel_size); + close(code_fd); + + s =3D qtest_startf("-kernel %s -M microbit -nographic", codetmp); + + for (i =3D 0; i < ARRAY_SIZE(reserved_reg); i++) { + int res; + qtest_writel(s, reserved_reg[i], 1); + res =3D qtest_readl(s, reserved_reg[i]); + g_assert(!res); + } + + qtest_quit(s); +} + +int main(int argc, char **argv) +{ + int ret; + + g_test_init(&argc, &argv, NULL); + + qtest_add_func("tcg/arm/test-reserved-reg", test_reserved_reg); + ret =3D g_test_run(); + + return ret; +} --=20 2.17.1