From patchwork Mon Oct 9 12:09:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13413529 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F78AE95A91 for ; Mon, 9 Oct 2023 12:13:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B574A8D0066; Mon, 9 Oct 2023 08:13:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AE9198D0031; Mon, 9 Oct 2023 08:13:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 959438D0066; Mon, 9 Oct 2023 08:13:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 80D2B8D0031 for ; Mon, 9 Oct 2023 08:13:56 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5D59916021D for ; Mon, 9 Oct 2023 12:13:56 +0000 (UTC) X-FDA: 81325814472.01.D0C9F5C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf03.hostedemail.com (Postfix) with ESMTP id 88A742002C for ; Mon, 9 Oct 2023 12:13:54 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NeKlb9iq; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf03.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696853634; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3LteIt8O7624ija+2djMB3vPztMKKOmv2YeJHHC1qmA=; b=DrNfj3K62xxMy+RN/x976NVerzWp7UOVgz5zGeZCDCor1zYECrN1xpdECCoz9Dj+X1/vQB mA/GiFFpwbFQjKbrFm5jWPlEbDwc+uFVv7SdYnwLmdp0Zx4tC2P9FTh2PsaY2/AhP1l8XD OIDFiSYMpZSjAPyPQP3LIvm5XlHeQsY= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NeKlb9iq; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf03.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696853634; a=rsa-sha256; cv=none; b=pTOIivUmLvK+6X1C6+EP6qvOCWYTIGXzyFV22dCeKdWhdienSkffDWSZj1UXZPbCFYgcQS PkKPVhQ8/HLaXtZZD6LKUlZsxsr2PmMHRorEEPl5fmTyMVj3vcN14sTnC9MKXtYZYUcfXc Mf0YXHwLzmwvIxp1vA0RWuIArbMAFrw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B598A61120; Mon, 9 Oct 2023 12:13:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A219C4339A; Mon, 9 Oct 2023 12:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696853633; bh=CQJ0Nn/FrNQwik1UANJ8xSGTPojw3dSDEOcln7FrjBk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NeKlb9iqE4AGE1VnnuuEDi9x2qHDhG39YDOtQOygNJGcp/7puO71yjWwEgjDhH3Ok EsjeQrTlMbsE9cdsW802P0C4KwKQrLhXCAVPvYoMyhwdzLylGiRYrjWH/2pZ60L35S a9jKGbTd5a1hArbwkwropJxQO7vTjD7c0Xx2znQT6EoNdzaeRtiC4g26P+M7uLgWrS b3oQO2OsLcUn+5vvhhOIDKBd0jOw7N1t0STVQxilRLL4vRA2LTeFElBL2WUiAMl4Hv HOWchYwqBex8aqYopW1sVnLkcj0J6hahyC/X4knAzKLC7SCmnLWKhbRz/SG+nIDF/N IhyAEtwkn59tQ== From: Mark Brown Date: Mon, 09 Oct 2023 13:09:02 +0100 Subject: [PATCH v6 28/38] kselftest/arm64: Verify the GCS hwcap MIME-Version: 1.0 Message-Id: <20231009-arm64-gcs-v6-28-78e55deaa4dd@kernel.org> References: <20231009-arm64-gcs-v6-0-78e55deaa4dd@kernel.org> In-Reply-To: <20231009-arm64-gcs-v6-0-78e55deaa4dd@kernel.org> To: Catalin Marinas , Will Deacon , Jonathan Corbet , Andrew Morton , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Arnd Bergmann , Oleg Nesterov , Eric Biederman , Kees Cook , Shuah Khan , "Rick P. Edgecombe" , Deepak Gupta , Ard Biesheuvel , Szabolcs Nagy Cc: "H.J. Lu" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Florian Weimer , Christian Brauner , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Brown X-Mailer: b4 0.13-dev-0438c X-Developer-Signature: v=1; a=openpgp-sha256; l=1190; i=broonie@kernel.org; h=from:subject:message-id; bh=CQJ0Nn/FrNQwik1UANJ8xSGTPojw3dSDEOcln7FrjBk=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlI+2nVuVBXqjsn2LJUIT0YQm3p4RqL6b7G3kTo12X jK0EkTuJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZSPtpwAKCRAk1otyXVSH0DpxB/ oD/2yjl18oaUFoxgjlXboHnU3Vdbj18snA/U+HNmjP8ycDMAla/rlRZJTMobzcc6q3xUzjBw6Qby42 XQwsre3+1XKPZXNnbbU4/AE729y6HgZeTm9fQ6OYXPXHqyLSUC70l8Mo4jdi6hLBwPh6S8TQSHX7NQ gwp1jXGMDhHgNWm9OEXmFTt5+FD7DPoWDWt02MDae8YapOFbDrFRg5urZTSdSJLdZnCDJ77TJT4QQP vhmv94GFddGFi32RfpOmDdfT0/fr2hdAfocT2Sv6jv7q5XCYP8ofxBQ1QvfGbrhqxoMKQwleOK6puP vrqiRdibSz+Kgt6dLzej/2YoOwjid2 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 88A742002C X-Stat-Signature: doiwc3jgt3bqcnweidxzhxh5c933ebxb X-HE-Tag: 1696853634-257931 X-HE-Meta: U2FsdGVkX19lNLq1UiW5gke10lEaugewHuC3BlWIYT7wHGOS9ByDG32X5ZohZd1R8n5uUOiGhFjHZh6t6Xq6WxyatIU/dpdp/cMXuYgiemAMlLUv6/9Y49eeL9oa14Y7cuFxsPUmdW3NrceFG0WwHj6/7zSMw34qrPikDWv+LAUhqTIPFvg6kgrV9+zlzFBnfxd7VXvFeRWSMsXfuiu1t4bJMo+shx9ceOtfVQ0GJfljUL1J0la4W7l8p0yCsU1DjxmLx9kh8ef2QLC4VJtLrty0k1qZtlczhRKCtcLU3JJCMM2hyRjHMdrbftvKdOzsvR07EuWvyHFxpz5BJZBtTuSFFVRoFGaKtuvSdNI2LNRmDis06R7qiWICEws91DKtTCgbcSxS6l0Ah6JY8nux00EqAecptoDxXbp/MuRs8J3Mn6vVxfA7IYmYJ4lab/ZIt45hzsJiAHbieJe7+EUiur5doRLnFXrhl11udlTns5hQGkyyTfA7C8DRiFgZIPXd3iYZc4ZLyFxnx3hqqCPCid0y0znnB9hOsOTEP/i2sD2CeFua0kHbcrSrYDqgYWELG6x9oUfHKZ7Tuca9I4I16km+N0GkBH7k/aHMKpdLZyer9B7G2cMfOZmIFXjd3SC4tKONbVA4p8IJtoDmyWevJRoOJh6mgfvMgezbXaWOxnjD4fWGH4muzgkwd+nLeTYLPwSDV3/RsBs9Ox//5Tqu1nQUb+A8IWpfeFxFODAetQhRhBSV55XbhEVPSgoEYYFUJgWkGoqrVNcaNoSDvwNCb7jZt3SPnP0Bjc+rxRHnWfhiC3UbJ4/UGlqKtXeaQynOJQUaK88Vz7ZUAgMNrk9suND4PYPI2wLWQ+Q6v3qkAJxPGMLsyhcAZ7Wt5RYHA+JFCdK++zmqcPbGu5LLHxZTr91rbkTR01dHOS7Apke92QyuYZWa3XFNwauTipndeHx7pxq6Oyud2z0+QFCrhzH uH/0BbgS qoE8csTd7hlqw8vYugaLmoW8ZDh4qU1oQZykVfZpqb0aqPLjyt2zHXkyx3DDURWBb7P2V6duh7AmSAXebS4yEBLVAGuBjGTQDO7EDwv7jw+qCAX9XXiHTeQ6giznO/jIA+KxRjTtpUrZVQ/8dL8usmDSUyg+ccABxPlnJ61IlbLaRIyaH9gsWs1K+i8fg/Ks6pqaz4NzdqoW2bzbWc3ydpM066MOmcjqqDbBqQTpEnzR2d0wCl86BaW7+rkQ6t4aS9mc8sYS686mL0C4HUwLmIz0ArXOEfgtjBomTmKiQc+IPcsZd540m9gtKJzDqjja+LTnwSRfB1Dy8/qA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add coverage of the GCS hwcap to the hwcap selftest, using a read of GCSPR_EL0 to generate SIGILL without having to worry about enabling GCS. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/abi/hwcap.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests/arm64/abi/hwcap.c index e3d262831d91..785c9a4ad666 100644 --- a/tools/testing/selftests/arm64/abi/hwcap.c +++ b/tools/testing/selftests/arm64/abi/hwcap.c @@ -63,6 +63,17 @@ static void fp_sigill(void) asm volatile("fmov s0, #1"); } +static void gcs_sigill(void) +{ + unsigned long *gcspr; + + asm volatile( + "mrs %0, S3_3_C2_C5_1" + : "=r" (gcspr) + : + : "cc"); +} + static void ilrcpc_sigill(void) { /* LDAPUR W0, [SP, #8] */ @@ -327,6 +338,14 @@ static const struct hwcap_data { .cpuinfo = "fp", .sigill_fn = fp_sigill, }, + { + .name = "GCS", + .at_hwcap = AT_HWCAP2, + .hwcap_bit = HWCAP2_GCS, + .cpuinfo = "gcs", + .sigill_fn = gcs_sigill, + .sigill_reliable = true, + }, { .name = "JSCVT", .at_hwcap = AT_HWCAP,