From patchwork Mon Apr 24 11:45:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13222067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF42FC7618E for ; Mon, 24 Apr 2023 11:46:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqudt-0003GY-Sp; Mon, 24 Apr 2023 07:46:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqudo-0003Fb-Gq; Mon, 24 Apr 2023 07:45:58 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqudg-0002Fu-W8; Mon, 24 Apr 2023 07:45:51 -0400 Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33OBVrwL003081; Mon, 24 Apr 2023 11:45:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=oQi+a+taoN7Q99Be/Lk838eknecFSA5JLW96ukaTG+c=; b=dI4gYUBxI71aBDBUNRxev1G9ME2COYxNGnwdE/B9lzQ4fL+OI0fZy+QxMFCQ0kbYNfsk quzxGqUFWXrmOyuItuCnrcX3KpR55FVAeXb+omb8EHYHYvl89JB23Hw03saMozFebrEM jIPrt9XCqN7itIVcg4wxy2ZvS3j4JCXVaC8FbvX7Vyy74qwtX/wbInNFX4I7qeH+UITN ViuSL5uyx6cx1lH4dpZjXMcvo6CA31KvWxACtFcehduNMG9W0xrSXkiobch7z+TvaaRn tkTiRX/CptU4hIlt4w3tdFEQeLugBaO6I9c5xopkIlogEcNQUFpIkXFV4sFEXKJeVUzr pQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3q461c1nug-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Apr 2023 11:45:44 +0000 Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 33OBXBEx012292; Mon, 24 Apr 2023 11:45:44 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3q461c1nth-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Apr 2023 11:45:43 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 33NKq1vS001167; Mon, 24 Apr 2023 11:45:42 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma03ams.nl.ibm.com (PPS) with ESMTPS id 3q477712pa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Apr 2023 11:45:42 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 33OBjdqX28705282 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Apr 2023 11:45:39 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A839020043; Mon, 24 Apr 2023 11:45:39 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 287B320040; Mon, 24 Apr 2023 11:45:39 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.171.51.2]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 24 Apr 2023 11:45:39 +0000 (GMT) From: Ilya Leoshkevich To: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , David Hildenbrand Cc: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, =?utf-8?q?Thomas_Wei=C3=9F?= =?utf-8?q?schuh?= , Peter Maydell , Ilya Leoshkevich Subject: [PATCH v2 1/3] tests/tcg: Make the QEMU headers available to the tests Date: Mon, 24 Apr 2023 13:45:31 +0200 Message-Id: <20230424114533.1937153-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230424114533.1937153-1-iii@linux.ibm.com> References: <20230424114533.1937153-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: MFHccQG7PuIT4ChzQnsBzA0IReEs7LEf X-Proofpoint-ORIG-GUID: BsxpbBjRLNCFz7NPj_Erfn1sHVr3nfrV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-24_07,2023-04-21_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 mlxlogscore=706 clxscore=1015 mlxscore=0 priorityscore=1501 impostorscore=0 spamscore=0 malwarescore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304240104 Received-SPF: pass client-ip=148.163.158.5; envelope-from=iii@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The QEMU headers contain macros and functions that are useful in the test context. Add them to tests' include path. Also provide a header similar to "qemu/osdep.h" for use in the freestanding environment. Tests that include get QEMU's copy of , which does not work without . Make use of the new header in these tests in order to fix this. Signed-off-by: Ilya Leoshkevich --- tests/include/qemu/testdep.h | 14 ++++++++++++++ tests/tcg/Makefile.target | 4 ++-- tests/tcg/aarch64/sve-ioctls.c | 1 + tests/tcg/aarch64/sysregs.c | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 tests/include/qemu/testdep.h diff --git a/tests/include/qemu/testdep.h b/tests/include/qemu/testdep.h new file mode 100644 index 00000000000..ddf7c543bf4 --- /dev/null +++ b/tests/include/qemu/testdep.h @@ -0,0 +1,14 @@ +/* + * Common dependencies for QEMU tests. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef QEMU_TESTDEP_H +#define QEMU_TESTDEP_H + +#include +#include "qemu/compiler.h" + +#define g_assert_not_reached __builtin_trap + +#endif diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index 8318caf9247..5474395e693 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -85,8 +85,8 @@ TESTS= # additional tests which may re-use existing binaries EXTRA_TESTS= -# Start with a blank slate, the build targets get to add stuff first -CFLAGS= +# Start with the minimal build flags, the build targets will extend them +CFLAGS=-I$(SRC_PATH)/include -I$(SRC_PATH)/tests/include LDFLAGS= QEMU_OPTS= diff --git a/tests/tcg/aarch64/sve-ioctls.c b/tests/tcg/aarch64/sve-ioctls.c index 9544dffa0ee..11a0a4e47ff 100644 --- a/tests/tcg/aarch64/sve-ioctls.c +++ b/tests/tcg/aarch64/sve-ioctls.c @@ -8,6 +8,7 @@ * * SPDX-License-Identifier: GPL-2.0-or-later */ +#include "qemu/testdep.h" #include #include #include diff --git a/tests/tcg/aarch64/sysregs.c b/tests/tcg/aarch64/sysregs.c index 46b931f781d..35ec25026a9 100644 --- a/tests/tcg/aarch64/sysregs.c +++ b/tests/tcg/aarch64/sysregs.c @@ -11,6 +11,7 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ +#include "qemu/testdep.h" #include #include #include From patchwork Mon Apr 24 11:45:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13222066 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6DAE0C77B61 for ; Mon, 24 Apr 2023 11:46:45 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pque3-0003Hp-W9; Mon, 24 Apr 2023 07:46:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqudo-0003Fc-Ga; Mon, 24 Apr 2023 07:45:58 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqudi-0002H2-1N; Mon, 24 Apr 2023 07:45:52 -0400 Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33OBbTj1015680; Mon, 24 Apr 2023 11:45:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=lv0aImRKFa6aQroDMSiFz3Vpv3QT19wH5MfTxE81Llc=; b=LaAtq16henwALYZExEzya6YwQJp0hge7piXP+aR4oYUCIG/9b54SfDgbnensWpbT4OM/ eJhkwZT3n9wXsX31vDjd9P0eSqfr7dY1N9Od8Fp0z6h8SGo+gOs3oQq3M8rqw7PVb/fh NZt+pIb1q167yZl/Bs0wfxSGf88+FYM4NJoBkPK9t1SJHUCp3xWJj892GXgDWJVkeSwU nX2AUBxU35AkvzFUbTbHPVgi1IhhdLLN4kLSsA8oayVdFww64XDBO+eckreFxdEZb57S I9ntyBwC/IH0D6JJEzW48dtsJRIIB+T4YyHnVatr7UfUHE/B7IJlnKAQd1nM1BkuKHkb LQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3q47d52982-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Apr 2023 11:45:46 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 33OBbRQo015434; Mon, 24 Apr 2023 11:45:46 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3q47d5296b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Apr 2023 11:45:46 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 33O4XfGm023833; Mon, 24 Apr 2023 11:45:43 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma01fra.de.ibm.com (PPS) with ESMTPS id 3q47770wa8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Apr 2023 11:45:43 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 33OBjei717564174 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Apr 2023 11:45:41 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C789520049; Mon, 24 Apr 2023 11:45:40 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 48FF620043; Mon, 24 Apr 2023 11:45:40 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.171.51.2]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 24 Apr 2023 11:45:40 +0000 (GMT) From: Ilya Leoshkevich To: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , David Hildenbrand Cc: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, =?utf-8?q?Thomas_Wei=C3=9F?= =?utf-8?q?schuh?= , Peter Maydell , Ilya Leoshkevich Subject: [PATCH v2 2/3] tests/tcg/multiarch: Make the system memory test work on big-endian Date: Mon, 24 Apr 2023 13:45:32 +0200 Message-Id: <20230424114533.1937153-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230424114533.1937153-1-iii@linux.ibm.com> References: <20230424114533.1937153-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: uwelhukxIgJ48F-phmckvhCCs8yUh9eZ X-Proofpoint-GUID: s6zBqYXyQyEDky3amiTfWO0Dgps97vZ5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-24_07,2023-04-21_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 spamscore=0 impostorscore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304240104 Received-SPF: pass client-ip=148.163.156.1; envelope-from=iii@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Make sure values are stored in memory as little-endian regardless of the host endianness. Signed-off-by: Ilya Leoshkevich --- tests/tcg/multiarch/system/memory.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/tcg/multiarch/system/memory.c b/tests/tcg/multiarch/system/memory.c index 214f7d4f54b..3a15f3f494a 100644 --- a/tests/tcg/multiarch/system/memory.c +++ b/tests/tcg/multiarch/system/memory.c @@ -12,9 +12,11 @@ * - sign extension when loading */ +#include "qemu/testdep.h" #include #include #include +#include "qemu/bswap.h" #ifndef CHECK_UNALIGNED # error "Target does not specify CHECK_UNALIGNED" @@ -40,8 +42,7 @@ static void pdot(int count) } /* - * Helper macros for shift/extract so we can keep our endian handling - * in one place. + * Helper macros for shift/extract. */ #define BYTE_SHIFT(b, pos) ((uint64_t)b << (pos * 8)) #define BYTE_EXTRACT(b, pos) ((b >> (pos * 8)) & 0xff) @@ -49,9 +50,8 @@ static void pdot(int count) /* * Fill the data with ascending value bytes. * - * Currently we only support Little Endian machines so write in - * ascending address order. When we read higher address bytes should - * either be zero or higher than the lower bytes. + * Store the words in the Little Endian byte order. When we read higher address + * bytes should either be zero or higher than the lower bytes. */ static void init_test_data_u8(int unused_offset) @@ -121,7 +121,7 @@ static void init_test_data_u16(int offset) for (i = 0; i < max; i++) { uint8_t low = count++, high = count++; word = BYTE_SHIFT(high, 1) | BYTE_SHIFT(low, 0); - *ptr++ = word; + *ptr++ = cpu_to_le16(word); pdot(i); } ml_printf("done @ %p\n", ptr); @@ -142,7 +142,7 @@ static void init_test_data_u32(int offset) uint8_t b4 = count++, b3 = count++; uint8_t b2 = count++, b1 = count++; word = BYTE_SHIFT(b1, 3) | BYTE_SHIFT(b2, 2) | BYTE_SHIFT(b3, 1) | b4; - *ptr++ = word; + *ptr++ = cpu_to_le32(word); pdot(i); } ml_printf("done @ %p\n", ptr); @@ -167,7 +167,7 @@ static void init_test_data_u64(int offset) word = BYTE_SHIFT(b1, 7) | BYTE_SHIFT(b2, 6) | BYTE_SHIFT(b3, 5) | BYTE_SHIFT(b4, 4) | BYTE_SHIFT(b5, 3) | BYTE_SHIFT(b6, 2) | BYTE_SHIFT(b7, 1) | b8; - *ptr++ = word; + *ptr++ = cpu_to_le64(word); pdot(i); } ml_printf("done @ %p\n", ptr); @@ -183,7 +183,7 @@ static bool read_test_data_u16(int offset) for (i = 0; i < max; i++) { uint8_t high, low; - word = *ptr++; + word = le16_to_cpu(*ptr++); high = (word >> 8) & 0xff; low = word & 0xff; if (high < low && high != 0) { @@ -209,7 +209,7 @@ static bool read_test_data_u32(int offset) for (i = 0; i < max; i++) { uint8_t b1, b2, b3, b4; int zeros = 0; - word = *ptr++; + word = le32_to_cpu(*ptr++); b1 = word >> 24 & 0xff; b2 = word >> 16 & 0xff; @@ -250,7 +250,7 @@ static bool read_test_data_u64(int offset) for (i = 0; i < max; i++) { uint8_t b1, b2, b3, b4, b5, b6, b7, b8; int zeros = 0; - word = *ptr++; + word = le64_to_cpu(*ptr++); b1 = ((uint64_t) (word >> 56)) & 0xff; b2 = ((uint64_t) (word >> 48)) & 0xff; @@ -375,7 +375,7 @@ static bool read_test_data_s16(int offset, bool neg_first) offset, neg_first ? "neg" : "pos"); for (i = 0; i < max; i++) { - int32_t data = *ptr++; + int32_t data = le16_to_cpu(*ptr++); if (neg_first && data < 0) { pdot(i); @@ -400,7 +400,7 @@ static bool read_test_data_s32(int offset, bool neg_first) ptr, offset, neg_first ? "neg" : "pos"); for (i = 0; i < max; i++) { - int64_t data = *ptr++; + int64_t data = le32_to_cpu(*ptr++); if (neg_first && data < 0) { pdot(i); From patchwork Mon Apr 24 11:45:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 13222068 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE6ECC7618E for ; Mon, 24 Apr 2023 11:47:39 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pque4-0003IY-FV; Mon, 24 Apr 2023 07:46:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqudr-0003G1-Hb; Mon, 24 Apr 2023 07:45:59 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqudi-0002HG-6g; Mon, 24 Apr 2023 07:45:56 -0400 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33OBRusK018680; Mon, 24 Apr 2023 11:45:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=3sSmCqqp4PVVXUJxxxCqnolLDxJwdfS8G1LGJ7DoThk=; b=Zo4WxLJY7R0ye1X/QrxhL0pba4YJlfsJv+u8eGWzkfhcOUQypvGrWatqRJ1lfmOXaNJA QuTnsAi+qdJYpq98ZbDb6sX0fdzjzmd98WAP35Kc0kN23AzzZ8zHnpMGuTaryeJiNR/N UTEBiWh/J3GAq++9Vi0NByUdXVYalEhLJI6Vu1azLdmWsrRX+175j0ZfgNsxujZ3vao6 o+SmvKVJwgn/EJIfzqbkGPCVybCwz85k49sSRSxw4WSSCEI/887XQ7TP3K0qCTq+jHHU 2jW6mFAzT8xU8JGfm9biwVdEg4KwKBWhRRMbwktMtH2uA1HtSBExR3PStf+g6suZaOm8 fg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3q48jks5hm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Apr 2023 11:45:47 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 33OAw478021315; Mon, 24 Apr 2023 11:45:47 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3q48jks5g4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Apr 2023 11:45:46 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 33O4XfGn023833; Mon, 24 Apr 2023 11:45:44 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma01fra.de.ibm.com (PPS) with ESMTPS id 3q47770waa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Apr 2023 11:45:44 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 33OBjgri48955866 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Apr 2023 11:45:42 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E36BE20043; Mon, 24 Apr 2023 11:45:41 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 65C2320040; Mon, 24 Apr 2023 11:45:41 +0000 (GMT) Received: from heavy.boeblingen.de.ibm.com (unknown [9.171.51.2]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 24 Apr 2023 11:45:41 +0000 (GMT) From: Ilya Leoshkevich To: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , David Hildenbrand Cc: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, =?utf-8?q?Thomas_Wei=C3=9F?= =?utf-8?q?schuh?= , Peter Maydell , Ilya Leoshkevich Subject: [PATCH v2 3/3] tests/tcg/s390x: Enable the multiarch system tests Date: Mon, 24 Apr 2023 13:45:33 +0200 Message-Id: <20230424114533.1937153-4-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230424114533.1937153-1-iii@linux.ibm.com> References: <20230424114533.1937153-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: jLiGe9AYjyXThR6h35MfLjqIdgkSgGAs X-Proofpoint-GUID: Fzzk8Vu4dXmXgwDD3Ee2586-H_sFOsQA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-24_07,2023-04-21_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 adultscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304240104 Received-SPF: pass client-ip=148.163.156.1; envelope-from=iii@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Multiarch tests are written in C and need support for printing characters. Instead of implementing the runtime from scratch, just reuse the pc-bios/s390-ccw one. Run tests with -nographic in order to enable SCLP (enable this for the existing tests as well, since it does not hurt). Use the default linker script for the new tests. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 40 +++++++++++++++++-------- tests/tcg/s390x/console.c | 12 ++++++++ tests/tcg/s390x/head64.S | 31 +++++++++++++++++++ 3 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 tests/tcg/s390x/console.c create mode 100644 tests/tcg/s390x/head64.S diff --git a/tests/tcg/s390x/Makefile.softmmu-target b/tests/tcg/s390x/Makefile.softmmu-target index 3e7f72abcdc..e22df5e1c58 100644 --- a/tests/tcg/s390x/Makefile.softmmu-target +++ b/tests/tcg/s390x/Makefile.softmmu-target @@ -1,25 +1,41 @@ S390X_SRC=$(SRC_PATH)/tests/tcg/s390x VPATH+=$(S390X_SRC) -QEMU_OPTS=-action panic=exit-failure -kernel +QEMU_OPTS=-action panic=exit-failure -nographic -kernel LINK_SCRIPT=$(S390X_SRC)/softmmu.ld -LDFLAGS=-nostdlib -static -Wl,-T$(LINK_SCRIPT) -Wl,--build-id=none +CFLAGS+=-ggdb -O0 +LDFLAGS=-nostdlib -static %.o: %.S $(CC) -march=z13 -m64 -c $< -o $@ -%: %.o $(LINK_SCRIPT) +%.o: %.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -march=z13 -m64 -c $< -o $@ + +%: %.o $(CC) $< -o $@ $(LDFLAGS) -TESTS += unaligned-lowcore -TESTS += bal -TESTS += sam -TESTS += lpsw -TESTS += lpswe-early -TESTS += ssm-early -TESTS += stosm-early -TESTS += exrl-ssm-early +ASM_TESTS = \ + bal \ + exrl-ssm-early \ + sam \ + lpsw \ + lpswe-early \ + ssm-early \ + stosm-early \ + unaligned-lowcore include $(S390X_SRC)/pgm-specification.mak $(PGM_SPECIFICATION_TESTS): pgm-specification-softmmu.o $(PGM_SPECIFICATION_TESTS): LDFLAGS+=pgm-specification-softmmu.o -TESTS += $(PGM_SPECIFICATION_TESTS) +ASM_TESTS += $(PGM_SPECIFICATION_TESTS) + +$(ASM_TESTS): LDFLAGS += -Wl,-T$(LINK_SCRIPT) -Wl,--build-id=none +$(ASM_TESTS): $(LINK_SCRIPT) +TESTS += $(ASM_TESTS) + +S390X_MULTIARCH_RUNTIME_OBJS = head64.o console.o $(MINILIB_OBJS) +$(MULTIARCH_TESTS): $(S390X_MULTIARCH_RUNTIME_OBJS) +$(MULTIARCH_TESTS): LDFLAGS += $(S390X_MULTIARCH_RUNTIME_OBJS) +$(MULTIARCH_TESTS): CFLAGS += $(MINILIB_INC) +memory: CFLAGS += -DCHECK_UNALIGNED=0 +TESTS += $(MULTIARCH_TESTS) diff --git a/tests/tcg/s390x/console.c b/tests/tcg/s390x/console.c new file mode 100644 index 00000000000..d43ce3f44b4 --- /dev/null +++ b/tests/tcg/s390x/console.c @@ -0,0 +1,12 @@ +/* + * Console code for multiarch tests. + * Reuses the pc-bios/s390-ccw implementation. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include "../../../pc-bios/s390-ccw/sclp.c" + +void __sys_outc(char c) +{ + write(1, &c, sizeof(c)); +} diff --git a/tests/tcg/s390x/head64.S b/tests/tcg/s390x/head64.S new file mode 100644 index 00000000000..c6f36dfea4b --- /dev/null +++ b/tests/tcg/s390x/head64.S @@ -0,0 +1,31 @@ +/* + * Startup code for multiarch tests. + * Reuses the pc-bios/s390-ccw implementation. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#define main main_pre +#include "../../../pc-bios/s390-ccw/start.S" +#undef main + +main_pre: + aghi %r15,-160 /* reserve stack for C code */ + brasl %r14,sclp_setup + brasl %r14,main + larl %r1,success_psw /* check main() return code */ + ltgr %r2,%r2 + je 0f + larl %r1,failure_psw +0: + lpswe 0(%r1) + + .align 8 +success_psw: + .quad 0x2000180000000,0xfff /* see is_special_wait_psw() */ +failure_psw: + .quad 0x2000180000000,0 /* disabled wait */ + + .section .bss + .align 0x1000 +stack: + .skip 0x8000