From patchwork Thu Aug 1 12:06:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13750407 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 5E3D4C3DA64 for ; Thu, 1 Aug 2024 13:00:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E9C386B00C2; Thu, 1 Aug 2024 09:00:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E230D6B00C3; Thu, 1 Aug 2024 09:00:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9F936B00C4; Thu, 1 Aug 2024 09:00:36 -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 A2DC76B00C2 for ; Thu, 1 Aug 2024 09:00:36 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E649F120DBA for ; Thu, 1 Aug 2024 13:00:35 +0000 (UTC) X-FDA: 82403685630.24.745AC9C Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf29.hostedemail.com (Postfix) with ESMTP id 446E6120031 for ; Thu, 1 Aug 2024 13:00:32 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="tnrq9/ql"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of broonie@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=broonie@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722517187; a=rsa-sha256; cv=none; b=5Ue+jpafxRjelSmO7myEh3d9R7lrlvg04hk09xNHmHheyljkY+iEeQ64GCA/B13WUL0BG+ lUTv/aN6Tvf8ssuQFZpgEGeurCtAPm5H4JLA3H1+UXvfzLSv9jNNvchfqP+tblJuwSi0gL SDYlM/UQZfyxqD5Ovm8UcS2xbLIFhSQ= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="tnrq9/ql"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of broonie@kernel.org designates 145.40.73.55 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=1722517187; 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=lx1e4QZxBbCVWVB0QayIR7s4g0rsUX9FuY+HasyH2g8=; b=CN711SpW2DpgcMBfIseZF8fQB4bR9hfrDss2bCgR9qg/n6mhhETrfN1IaPzE2Ql0WTErFo JT53TTgbXqeNKLFQnxNvCkaR8hBekYhxj0vygHNvRxLU70etQXjW2qElhsw5rXudtzKSKh EglswKn8fapo0tq+XgDrbAOpga+PBCY= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 9700ACE19AC; Thu, 1 Aug 2024 13:00:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2541C4AF14; Thu, 1 Aug 2024 13:00:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722517229; bh=oHs0edHK2ZH//P9wlXUiorha791DOO+hA3lq1vKIHRU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tnrq9/qlz5GnEEEFFRetjGPSOWedcxCUE1yGkiFYjdws0U4itg41NBfsVY86Lvk6s X+IpjSv62kIwlCfYN7eFvhz2sW+UwETmWdFlmMGMFBidDKWrg0ZHqgdbRt2HYW3gQn MG0H6C/C54Id6g9ZGXA/pI+OHLR78Pd+3YU2MnbvW5YX/lYP8SuwmT0Nc9rNUHMH8J QQOUeJTOom0yMSM3cBtJB4pqkkaZuDFclam5qISOmDOEzSnDQHeIdlYsrj37iRvIV/ 3S0HHqq5YrZzkG0PsWgDt1Bg9UNBEFSgAE3wRUe8TprSjqCD4zoYzazrxW12lBGKYr x3cLNAUNqLeaw== From: Mark Brown Date: Thu, 01 Aug 2024 13:06:54 +0100 Subject: [PATCH v10 27/40] kselftest/arm64: Verify the GCS hwcap MIME-Version: 1.0 Message-Id: <20240801-arm64-gcs-v10-27-699e2bd2190b@kernel.org> References: <20240801-arm64-gcs-v10-0-699e2bd2190b@kernel.org> In-Reply-To: <20240801-arm64-gcs-v10-0-699e2bd2190b@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 , Shuah Khan , "Rick P. Edgecombe" , Deepak Gupta , Ard Biesheuvel , Szabolcs Nagy , Kees Cook Cc: "H.J. Lu" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Florian Weimer , Christian Brauner , Thiago Jung Bauermann , Ross Burton , 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.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=1288; i=broonie@kernel.org; h=from:subject:message-id; bh=oHs0edHK2ZH//P9wlXUiorha791DOO+hA3lq1vKIHRU=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBmq4YaR7eUIgxap135hy7ONIfzK5DCkSb7UQJMKMtp D592qJmJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZquGGgAKCRAk1otyXVSH0ElPB/ 9ZXbE8s9vC+GQ95xVWW0x7DnbqqIxaDtNFUU54+Bf2g/sdyJFD0Kv9WAVrRQ0V5fpTxUrG23xXlFEF J1/nVz4ngvN+k2sXHHFlopJP23BUioBPLP2iyFvBtipYkXYxoDtbDG/SdYZipAfT+j+XnW+A9umF4l HNyylEPIp+P/zoxBJ1R1j0+MPSQH1BAW3YC4I6It2Qij0MQL36gOOXr9/HmD/+89eFIdD45LPvQv1V ms1MF+qnajf1TQk3xpz5BTikAATCVwNJTZ9+Y1zsa54sW3wPp3OAnksvOzBDEsuUtusvS52+wgxyen dp/nWQzMiCu0D823CItebJZbVulSjq X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 446E6120031 X-Stat-Signature: z8w8fxirkgcd86oh3r9rirwj7px5nmpg X-Rspam-User: X-HE-Tag: 1722517232-250936 X-HE-Meta: U2FsdGVkX19/rX/JWbt0FYz2TXk9G/dOYbhUxnELf1IQX6unUQNj3bWZFT2321dUm3SR045dGVGL37V+QEso3B+/mZDH2PvBaUG30kcdNAUniKOOqZJFKIdcgiCwYKPluecOvEmoDWKS8ri4agRTNiOIwFd070DA4797HXo1Tb4Z4SXCvAG3DnlWZ58iBNtlF8gmHqa3yydEMh1QWAOFOLws9oWIXhEOk68nXxXe29PYNaFd0O3ArNcArDSNIykvcNsaAJKT+z82+9AGFe9oG2NjsFg39paWfssQkdDPPKC/RmuNNqjjMs54+FQ27y990Mc4ruQ+UN7vk3fdjI4kE9RkoZxrkCrMchhQLlLntdrHHtQkaNV4zhmVeDgXbRbdkw4WMJZ0gGVW+vl6c9thvuj6px2+lVDyR878ZIXv6g/w1cG3Gn6WdBqhDN856bcr9K9z0MmstNLg4ev7dxUW9VuV337w8Mu4uWCjqBzczB2KMUo6ay/1HtINVZ5OiuIWUI8aVEy/9O5gKLYsL3liHwLbkPErAXeqgq5Nr1UBlzGVGz0HGX2kyIko+jfE3p4DW2C7MCDgwQ3xiFSN0M8JVfYgAa4MRCBu5wG0dlhAwwtXC5XxM7hh/+VFyAyX0ISxZsgrKNx3+k8+OaZuPiZH31+1+KZ+iDyqbwIXuooUyr5wAAnlSOHMKxuyELl/1q1BPd3ROEVY4djkOKkvAFqbbrdy2k0r+euqnLUDBu1E6llpBsX0hYNIgsvkyaDrI9DDGDfyaBVjYdEs5UXldGNyBVj4aIi6hAn91/0Ck4T4xw8W/3UbkS4lpkJFt0mcHNAN3e6hBu13t4/vArtkdPWYGvk5AsYyV7y5Xo/YlQ1q/EsLXCnB65LQlCiYtK30Ar7gC8sUaAEmeGSnvdxhJR+hnX4+259JTTSRJIr2vyqarBMBYxOp3HPsD0CRp9i+KcA+DM4YZ+LpWIvFYg87L88 qPzqGvmK ka1Tto3Z2owo+D/OB43qXY9vRXvZjJnuJgynF+qjkVvp1tq9b0iu+5RvzSEF/eYmIe0ZdfpBE5VOwG7plRdyOGFxrXLt7y2xNtL6eo/jBm1/sZLdOMM+cv+8x3ZOQ1pvW6OwYgBXEQtHvc4ZyTEcHyEtV6D4iWgzF+Rxu5sLO08vtMcGJm5eMPj37CujPCvDOXByu4vFk7NEVMuY3wYIOiZIRu9LDaUdBMKc8snWaQkDqfyc+aaqIxb0b5FR/MGh8/u6QmMhMRfhnDgrg7oCFiIVzNPm5ucp7rMSmBodp0+dQFlwGrYULgD67r3omDEWagGxBtq2slh+NvtXNV1rC0jVi9MieZ+f5umaA/uOua/1MnpZPLLhsjP3xHA== 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: List-Subscribe: List-Unsubscribe: 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. Reviewed-by: Thiago Jung Bauermann 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 d8909b2b535a..dc54ae894fe5 100644 --- a/tools/testing/selftests/arm64/abi/hwcap.c +++ b/tools/testing/selftests/arm64/abi/hwcap.c @@ -98,6 +98,17 @@ static void fpmr_sigill(void) asm volatile("mrs x0, S3_3_C4_C4_2" : : : "x0"); } +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] */ @@ -528,6 +539,14 @@ static const struct hwcap_data { .sigill_fn = fpmr_sigill, .sigill_reliable = true, }, + { + .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,