{"id":2224585,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2224585/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260417164328.1009132-2-alex.bennee@linaro.org/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.2/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260417164328.1009132-2-alex.bennee@linaro.org>","list_archive_url":null,"date":"2026-04-17T16:43:21","name":"[1/7] tests/tcg: introduce a lib dir for aarch64 system tests","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"491d94fa66daf3cefe285d949eab0a01ec3c6e03","submitter":{"id":39532,"url":"http://patchwork.ozlabs.org/api/1.2/people/39532/?format=json","name":"Alex Bennée","email":"alex.bennee@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260417164328.1009132-2-alex.bennee@linaro.org/mbox/","series":[{"id":500373,"url":"http://patchwork.ozlabs.org/api/1.2/series/500373/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=500373","date":"2026-04-17T16:43:20","name":"tests/tcg: more capabilities for aarch64-softmmu tests","version":1,"mbox":"http://patchwork.ozlabs.org/series/500373/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2224585/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2224585/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=dqNyJVL8;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fy11t4tCSz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 02:44:34 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wDmI3-0003Nr-Bn; Fri, 17 Apr 2026 12:43:35 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <alex.bennee@linaro.org>)\n id 1wDmI1-0003Mm-Hc\n for qemu-devel@nongnu.org; Fri, 17 Apr 2026 12:43:33 -0400","from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <alex.bennee@linaro.org>)\n id 1wDmHz-0004rM-Tn\n for qemu-devel@nongnu.org; Fri, 17 Apr 2026 12:43:33 -0400","by mail-wm1-x32b.google.com with SMTP id\n 5b1f17b1804b1-488aa77a06eso15264025e9.0\n for <qemu-devel@nongnu.org>; Fri, 17 Apr 2026 09:43:31 -0700 (PDT)","from draig.lan ([185.124.0.195]) by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-43fe4e591cesm8147138f8f.36.2026.04.17.09.43.29\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 17 Apr 2026 09:43:29 -0700 (PDT)","from draig.lan (localhost [IPv6:::1])\n by draig.lan (Postfix) with ESMTP id 8AAE55F954;\n Fri, 17 Apr 2026 17:43:28 +0100 (BST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1776444210; x=1777049010; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=mnj1sUSGnQtu/nyeEQy5Pwcrz7WuG7Co9e+aKnd+EfA=;\n b=dqNyJVL8zRxEVKRVcz1044UmKq58C8986kveyz9Sfw/VG4ldkfKPTZSMqXLgc95519\n a5fvbkugTXmysQsD2vuN7o/0PNeWvDn74qYzEdq7eUoheILLAaQODwoFs725WEh69ZhO\n wUVRgwGu3j6XbdP7ne19KUEdB8Ojxhu5ZpiqF10ROq7sWsD1KA2rhDRjfQ0BsVd9VHqp\n VIJrxT9IEPjeOouBO0kVKkB4RCqmu58XvDaxid6khRJ+ijCq359oI89F3Tki4LHeS93U\n YZINKfLCu19GC+KIOCSsUP5zMkt43lfAVOv3+0fbmMo6hCR1vYVZ1sluXfRd/pbwP8Ik\n b2/A==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776444210; x=1777049010;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=mnj1sUSGnQtu/nyeEQy5Pwcrz7WuG7Co9e+aKnd+EfA=;\n b=BEdtexiZFPXG8zPgYRlso+QNw6JUIcDLk3FYKx8Pbdo38GSJe8UvHF2sZMAelJYBGd\n eO0UGToN0C1c7ytcicE2jqVLtGSZxSYkfeniSBREY3fDBy7sBUdT1oUN9AsEec2sQKTu\n wSlQa6vv/Y1Bj9KRmpcuabPwL/xHfJ6Jf4Xtbb5u+oGBobKSVXYkWpxxoOAxFeSwUM0d\n mYsbZctgnhopFdcmKuuiSYT5gd8XainpKO/izL6lUWVpLBkLt6yAnK9pKCWw1eRiNyL2\n AHlFpUldVxgIj2U89hwhbmyzIfP+F8j/PoeISFwGT/NPZ7KkLFFJaylr6UJwX+5buCab\n HOzQ==","X-Gm-Message-State":"AOJu0YzZawW7xLvLs0uCAXGkNLiMQICh0EDwupV6B+oiKL+ha1HQB4pP\n yTCTCpBLlVIgvN4IIpc7DIwGJtL/KOe90YuNK4Omixi2C7GNUndkAr+vXT+InusCMfM=","X-Gm-Gg":"AeBDiet5EaWiPQ1yrcJVBp3lq7LWFhFLSC9INuPCU9Gy4DqiL250pm6hWVUhpwjJYRs\n uyRKL7hPlyOezNtXr0/IrgaxBoxDXAjg3NYlx2+GdU7UEK1x5CUWGbCPZfTj7/glgrb6kG8rV30\n 6fzE6ufvefdMd3DRaoX+UniZcP7BrXb2pjHr2fDItZhL5yXO+6f2KPMJWKWebd/Uwl+i15trHGQ\n NJmDtQ5m3ZkSuh5qxEDBUeTYkFkQigsfaVbJpJKghEZBxdPkEoBlVE4S9hJwhXIVY6dFsixxRoz\n nBx9awJ6dUm3Ngg7L0KwXkY/KubDiDieUt6uJhifQDWazue/Apd/muJzRDVhlDj9lVhSc7O1d0L\n Slidk+rWhb1+mmuSXg3QQz33JwRSlb6a2VDOV9mDrspaketJFz05FewtQ4HTGaFZHJD1XtCxOT8\n tNBb2ciqDp9Z85rq63pBRikVM8d77p0yQgZ2LhmN6774SW","X-Received":"by 2002:a05:600c:444a:b0:487:1520:d107 with SMTP id\n 5b1f17b1804b1-488fb793580mr48989795e9.31.1776444209860;\n Fri, 17 Apr 2026 09:43:29 -0700 (PDT)","From":"=?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>","To":"qemu-devel@nongnu.org","Cc":"qemu-arm@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,\n\t=?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>","Subject":"[PATCH 1/7] tests/tcg: introduce a lib dir for aarch64 system tests","Date":"Fri, 17 Apr 2026 17:43:21 +0100","Message-ID":"<20260417164328.1009132-2-alex.bennee@linaro.org>","X-Mailer":"git-send-email 2.47.3","In-Reply-To":"<20260417164328.1009132-1-alex.bennee@linaro.org>","References":"<20260417164328.1009132-1-alex.bennee@linaro.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=2a00:1450:4864:20::32b;\n envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.google.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"We are about to add some more helpers but lets start by adding a\nsimple wrapper for reading and writing system registers.\n\nDo note the subtle switch of ordering for write_sysreg() which matches\nthe change the kernel made sometime in 2021 (see 272a067df in linux.git).\n\nSigned-off-by: Alex Bennée <alex.bennee@linaro.org>\n---\n tests/tcg/aarch64/system/lib/sysregs.h    | 22 ++++++++++++++++++++++\n tests/tcg/aarch64/system/vtimer.c         | 23 ++++-------------------\n tests/tcg/aarch64/Makefile.softmmu-target |  3 ++-\n 3 files changed, 28 insertions(+), 20 deletions(-)\n create mode 100644 tests/tcg/aarch64/system/lib/sysregs.h","diff":"diff --git a/tests/tcg/aarch64/system/lib/sysregs.h b/tests/tcg/aarch64/system/lib/sysregs.h\nnew file mode 100644\nindex 00000000000..b1c465e0746\n--- /dev/null\n+++ b/tests/tcg/aarch64/system/lib/sysregs.h\n@@ -0,0 +1,22 @@\n+/*\n+ * AArch64 system register helpers\n+ *\n+ * Based on the helpers from Linux\n+ *\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#define __stringify_1(x...) #x\n+#define __stringify(x...)   __stringify_1(x)\n+\n+#define read_sysreg(r) ({                                           \\\n+            uint64_t __val;                                         \\\n+            asm volatile(\"mrs %0, \" __stringify(r) : \"=r\" (__val)); \\\n+            __val;                                                  \\\n+})\n+\n+#define write_sysreg(v, r) do {                     \\\n+        uint64_t __val = (uint64_t)(v);             \\\n+        asm volatile(\"msr \" __stringify(r) \", %x0\"  \\\n+                 : : \"rZ\" (__val));                 \\\n+} while (0)\ndiff --git a/tests/tcg/aarch64/system/vtimer.c b/tests/tcg/aarch64/system/vtimer.c\nindex 7d725eced34..b6bde49ce30 100644\n--- a/tests/tcg/aarch64/system/vtimer.c\n+++ b/tests/tcg/aarch64/system/vtimer.c\n@@ -8,22 +8,7 @@\n \n #include <stdint.h>\n #include <minilib.h>\n-\n-/* grabbed from Linux */\n-#define __stringify_1(x...) #x\n-#define __stringify(x...)   __stringify_1(x)\n-\n-#define read_sysreg(r) ({                                           \\\n-            uint64_t __val;                                         \\\n-            asm volatile(\"mrs %0, \" __stringify(r) : \"=r\" (__val)); \\\n-            __val;                                                  \\\n-})\n-\n-#define write_sysreg(r, v) do {                     \\\n-        uint64_t __val = (uint64_t)(v);             \\\n-        asm volatile(\"msr \" __stringify(r) \", %x0\"  \\\n-                 : : \"rZ\" (__val));                 \\\n-} while (0)\n+#include \"sysregs.h\"\n \n int main(void)\n {\n@@ -31,9 +16,9 @@ int main(void)\n \n     ml_printf(\"VTimer Test\\n\");\n \n-    write_sysreg(cntvoff_el2, 1);\n-    write_sysreg(cntv_cval_el0, -1);\n-    write_sysreg(cntv_ctl_el0, 1);\n+    write_sysreg(1, cntvoff_el2);\n+    write_sysreg(-1, cntv_cval_el0);\n+    write_sysreg(1, cntv_ctl_el0);\n \n     ml_printf(\"cntvoff_el2=%lx\\n\", read_sysreg(cntvoff_el2));\n     ml_printf(\"cntv_cval_el0=%lx\\n\", read_sysreg(cntv_cval_el0));\ndiff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/Makefile.softmmu-target\nindex f7a7d2b800f..c7f44803c73 100644\n--- a/tests/tcg/aarch64/Makefile.softmmu-target\n+++ b/tests/tcg/aarch64/Makefile.softmmu-target\n@@ -4,6 +4,7 @@\n \n AARCH64_SRC=$(SRC_PATH)/tests/tcg/aarch64\n AARCH64_SYSTEM_SRC=$(AARCH64_SRC)/system\n+AARCH64_SYSTEM_LIB=$(AARCH64_SRC)/system/lib\n \n VPATH+=$(AARCH64_SYSTEM_SRC)\n \n@@ -24,7 +25,7 @@ LINK_SCRIPT=$(AARCH64_SYSTEM_SRC)/kernel.ld\n LDFLAGS=-Wl,-T$(LINK_SCRIPT)\n TESTS+=$(AARCH64_TESTS) $(MULTIARCH_TESTS)\n EXTRA_RUNS+=$(MULTIARCH_RUNS)\n-CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC)\n+CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC) -I $(AARCH64_SYSTEM_LIB)\n LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc\n \n config-cc.mak: Makefile\n","prefixes":["1/7"]}