From patchwork Wed Nov 22 09:42:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13464422 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 BCB52C61D9C for ; Wed, 22 Nov 2023 09:46:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 24A146B05C2; Wed, 22 Nov 2023 04:46:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F69A6B05C3; Wed, 22 Nov 2023 04:46:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0982F6B05C4; Wed, 22 Nov 2023 04:46:38 -0500 (EST) 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 EAF3E6B05C2 for ; Wed, 22 Nov 2023 04:46:37 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C0AEF803F3 for ; Wed, 22 Nov 2023 09:46:37 +0000 (UTC) X-FDA: 81485110434.25.CF4DB12 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf04.hostedemail.com (Postfix) with ESMTP id 48A6E40004 for ; Wed, 22 Nov 2023 09:46:34 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=fUa44Bi6; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf04.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=1700646396; 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=ca9++bFNJIk1cLKn1TH2rm1ajrTk7LHzLeyWpvr3bRM=; b=taZbN9gLME6kfk2uHAfntfYD6JZCoI0VUe/8OHjMg32M58KIid6B4BDY3LMZLAhO3qbrKZ wjH8hoJvB/aELzvdS3u+MBlVvXa8gXpeDNJE+dM82wI0Bj+90svt5iXsK9XkLuBHhZm22/ H1UDDI3+gAry5NTv13TOOzU0Ee92MBo= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=fUa44Bi6; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf04.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=1700646396; a=rsa-sha256; cv=none; b=f5/9hSdEvt285nvmtYV9y4wEKir+GhQUBu0lUu4MFqAGPjkVcpKInCpZaw05TBwVQ+1Upb cKpiK4Sght1iVFab5I5pP2p/rNoTcstGMi6ZHYjaVxsUbYIsi1SMKo1ZH3t++LJ/OPz2ZA UuroQir0GQtdcPc8rPNfQCFkYTJfG30= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 80C5ECE1EA4; Wed, 22 Nov 2023 09:46:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A99AC43391; Wed, 22 Nov 2023 09:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700646391; bh=I+uVw8aipGa+8Ns9k+b3dq26kNHNXYgyRv4lZpoE8Nc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=fUa44Bi64x8jXoE/MvI8BIoiZzNypKXZeeiprmYPWGJR3lX5FGydI1vtuAYWadks7 UasgH5m/KtJQsDRJFu9SVTzRRZ09vZBslyb0Ho2ASTSMbx7DP6p+CS8+ianT5KLmas tJXDc07OIjutHkKJCdOQ9rbHFcS+M1Xk9x0/2ZDaXRW8l9gWOsMXGxNr64kYyyP2wN wkARHPE4CLrm5Ok5GqnIBpxAl47axEAxsh9fxCbSQqsYrNum0vfC6FHddFrleyQ0jj 1fispSHLot6aPOIBz5WXtqFTgm3jtICwL5ybtt6OQ3R735RlkVitJiiQ8Rd9rwhnj7 yf08/Sy6l7Hug== From: Mark Brown Date: Wed, 22 Nov 2023 09:42:38 +0000 Subject: [PATCH v7 28/39] kselftest/arm64: Verify the GCS hwcap MIME-Version: 1.0 Message-Id: <20231122-arm64-gcs-v7-28-201c483bd775@kernel.org> References: <20231122-arm64-gcs-v7-0-201c483bd775@kernel.org> In-Reply-To: <20231122-arm64-gcs-v7-0-201c483bd775@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 , Thiago Jung Bauermann , 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=I+uVw8aipGa+8Ns9k+b3dq26kNHNXYgyRv4lZpoE8Nc=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlXc0MyzVIJO4Kid9gCsCQr45ifThlTEHkARV/j UTsXVxwqbuJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZV3NDAAKCRAk1otyXVSH 0PTmCACERewHlO0lUDAx7VBob22qNqbBIi4nI0finRcfRAMHGdVUVIxWAqs+6UQtEQWTanwoxxh RHNYkE5AnkhBIVqgo9rPkkciwxmqsPMafm9s1H0t/nysi4FdiMxIMpg6pQt0D3ydQ1Psg/yCml7 nbLsDLWDnrT2PZBbwMSZdbxpf6TLjfDdFnf2PqTp7lJXdovzdfaZM83h4amYvIT+snl3MZDg+DE yO8Tc24qt+aAP5Fbjm4kLsSFx2poUdmSadKGczZTZxfOnsCSNiQjkj2FshEGptZPCYDyN1vmU0z I1pxYkitO980tsJqitFcBPPgoo+CvzMYooor7SZAL9CXXBHj X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspamd-Queue-Id: 48A6E40004 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: gk1mt3c5guhtspp56zuk51geth5t49st X-HE-Tag: 1700646394-149097 X-HE-Meta: U2FsdGVkX1/2xvMghFZuNkA0y+llJiA76LGDsWGqr2ACmwup2KdMJdXHbhcUlV/CMN1RlpdLEI0VY1x5Vu7Sd0Q/ASm8jO/kl0gwTphUjPlNU2iTNdpwJ8TW9TRqJCu+02EMQwAUtvuAyI+xunclNcyceVRkWlUDkiMsnrxDGU/hCZbdp50K+CoAkA7pC8VoO7Lr7TmvY/tRYwqlLVOp94P3udIq4YQWZ1Q6+o9t8JyYTwT2FxCzhUV1WAaS/WMU6izIOTFDXJOtsbpEH7XXLnwzpsH16bCP+btrb9eyRMl4DyFvvlMEvMregkWegho0zl3Brss/KrsgIIJse2ISPn2VpRdQ/L1Ff6S6aQhPwkrZl/pL4Yt651wG83EvqQswEtGbFHjgLoZsyDboAHEKwfNyCogMXeugj5TYGa5zQav3l9MLKQ7bwblxbEn5wOL6DxqBCB9y9YS/xCobbAaNu3rrMZ6y9vVtcyF+H9uL7ifA/DOO/M3M6EkHcXasbAjLCF0uUxdYSpT1xgA0dnyycfF8vLYASvRaUE0bVMiIAMR3XS8khGdlXlplm5cDtADbLxvklAotXrNWe3y6GBSrWkmnNPPp72/i6YtGejs0D6uQGrtyqxQAL50h78a9TD5yStt7AZckY8VBL47LligFu1AZKLp2s4RkUBord9CP8asUue4GrNNuvTV3e0CPYyu86RyyVCTWglXa3UAdRNag7HTTROYiHVI3saqQIhK5F3MIjD+UTtCmf6c8Pz1tTNL9Oo/fIepuhcApCOSYkykNQ5eCs8Ngedn/sullkqvRNEmJfCfAORtTC4ABvhrq9hLpvfqJT0rBIq2egR1OdW7ytu/NHaRv5TH0rBDWs0p7JiKztB2VDydwDEMrkZQFkl22IK2aa4Cn0Zl0SffdJCxgqRGtyXAu948RdBSAwb5RKcFkggYTqx9v2AB7SSht7Hqr7NtplqrxZfiOlOphe5S 4YV2CqWy t8AqyNugRHA0gy7G2L6xSfairWc0zKU4s1O/LUnp+emUFTeFDfNPapCX2RO6BYgQxVDxyETD/V305llJcF391nGom8387EwvHNIHcisY6JP0gkWuzQY4eR9KYLIrDpsS5VPWyPVZw2QIE5G8zVQ/VNCDvl/3jguSxGtNboZZ7iyGko2Y2SoNMF6T70qULC5JxjzIzJgC0ZJ7qIKELVezkdnxiwPi4d0luVDP9W8aGlhyzKllUPMK60GXecM5/5evWN9AUncgXDhI58YXyfbM4EsHkvZcAQYaVNaojVkl8iykzVR76XW+SI57mUH1sj8F3W2zj 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. 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 1189e77c8152..bc9e3250a9df 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] */ @@ -360,6 +371,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,