From patchwork Tue Oct 1 22:59:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13818929 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 B8293CF318A for ; Tue, 1 Oct 2024 23:05:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4B84D680036; Tue, 1 Oct 2024 19:05:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 465D668002B; Tue, 1 Oct 2024 19:05:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DF27680036; Tue, 1 Oct 2024 19:05:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 0E11968002B for ; Tue, 1 Oct 2024 19:05:25 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id BA026A0667 for ; Tue, 1 Oct 2024 23:05:24 +0000 (UTC) X-FDA: 82626566568.15.344295D Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf18.hostedemail.com (Postfix) with ESMTP id D17871C0014 for ; Tue, 1 Oct 2024 23:05:22 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uJXPg19K; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf18.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=1727823819; a=rsa-sha256; cv=none; b=JxwrVuTFgkE8Ls4D9haJgcJBXBV04NBTxrDeRu7naLrcPEseak9PnHWuu0aDg7kC34Ml9r gvclN3r0/09P/gNnYsqYd/C/HzuJw9CJgHZizv4rj65ubkxrbYh+ddOpLxH/ixt06wS9Nm hqrL6WOOSK3SuIdXUoXMRpWy5c5PqRw= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uJXPg19K; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf18.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=1727823819; 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=RBVr/fog5unVx5vWdswcdMuMzdFFdJMVIP1drUnBO9c=; b=8Ccw4uA3KwOCNM6lV/PckVRfm3IxnWAHBx8sQYDtn5jwcOAQf6kAtLKh2sTrVjoGpJ7vhr MA46pm+tUZLJJ19OIbfYzJaFmxF950JT6yoUn36w2ViF50FjuAs2auUUjcZ1j3WOPu2K0Q 4A91FmFk4f/UprL3gjH6ZKdgTQDcuH0= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D97975C53D4; Tue, 1 Oct 2024 23:05:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DAA8C4CECD; Tue, 1 Oct 2024 23:05:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727823921; bh=GLmI6hHYoj5JZxZG0yzjYcX6pFmL0ulwYTdiG1C9KyE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=uJXPg19KQ4tuAtY+0FftA0aaVagRDKUP20/lvTlKZqQNQbewcQSTrzzRjoEKtm7nC n2gnfGJgNbPJyhuX549Sf61XlHumAKixbFpVzyS0gAlTSOu2rOnV1rMKQCIr0OtWJd I1AK5W+WInFWvg2NnDZUXd1vn4u/Dsgt+pJ/0MjdgWn+6w7MuOpry4WuIcg7X/n2yE YQdkhFe/WEsOi4KYSlH3gv7VkD5L4j+ugX1LlJl/z65lw6o99jyLOVA/XqHs+nYczF V7AZSwEA8Q+34VDDyEn/3lQnLrPQ6NzYFY6CrlnYSTnKIpVdC21YseK5tgwYCXHyWY yRYWEbR10J9qQ== From: Mark Brown Date: Tue, 01 Oct 2024 23:59:08 +0100 Subject: [PATCH v13 29/40] kselftest/arm64: Verify the GCS hwcap MIME-Version: 1.0 Message-Id: <20241001-arm64-gcs-v13-29-222b78d87eee@kernel.org> References: <20241001-arm64-gcs-v13-0-222b78d87eee@kernel.org> In-Reply-To: <20241001-arm64-gcs-v13-0-222b78d87eee@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 , David Spickett , Yury Khrustalev , Wilco Dijkstra , 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-99b12 X-Developer-Signature: v=1; a=openpgp-sha256; l=1350; i=broonie@kernel.org; h=from:subject:message-id; bh=GLmI6hHYoj5JZxZG0yzjYcX6pFmL0ulwYTdiG1C9KyE=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBm/H7aBg3m0n8js+N3r2y9s0x83zZGeJav6qRQG+DB SlM8+uyJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZvx+2gAKCRAk1otyXVSH0N8jB/ 9NrJV4u3pB6B+x7xy0q+Ych1nU+TZ7sIKyruiwgrncB9J5+7CklyjjjmcPn3gOVQEtoA+/W9aZ4lEZ NN4iZrw584yNtE+jBySXR0AMtH/u8xnbsfg7FJ9I0Cj5hS/wV7mYGSJhslLHzjeZZ5pOKEI3ZktG0f rH7Ob41i25UTAnvjwOautvPOk+SBOSZU6l7PcfCJteHFeR+WWAq4qJu+Hf9SLx6YXmk3DvKSlJbLp+ 2UcwdwWpPxRIlDKjTI0I4B5yTh6lvfjpP3yw9D6OkVVwcJPuOZdwL+tuHc9v9FubA3/dyFTCAqvs8a VimlYJHj8X/waleY1JeJKtP3jXoEnJ X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D17871C0014 X-Stat-Signature: 3zeuc5sxfg3cc1sb58sq8iymri7f8ztd X-Rspam-User: X-HE-Tag: 1727823922-563716 X-HE-Meta: U2FsdGVkX19o6co50+etxSh08Rfo9KFvPA89w4MGnWCs2J9/Ke1+rsdjueQzLPD+XikgyLwTuwX7U94F9GhvlFI8z4aLI3WHpcw8g7+Gg3yD1gWeoNnlnhDwDMCyWQB6SGNmdx7u9kZkETaEwNDt0bpSpPyYV12/uVOfr4NqnhHybr0xaEpq3l5YL99Az/IDmV4vK/EXQ/9t5RqreJjrppiC+oVgMLK2pVvQ4JIZ8LRZcpHu9j62QX3+aB3nK3mWUX5RDtvISHMYttR+LAB+mv0syHwA0zoxZ9n/diItGQs8pNaIqYP8T42HRhZbHDcW3/2l2WvJS4Z+E/Qqt4jSthXYTdF8XwhSRkzyq8YY1Ux5sk7GoxAAK79bXkJw/dTel8qpkw8/L4BjeaTKP2AfclcnNJOCCmDPtb+YDZiu5XelTygFPGIc7LhuWU/qg6EYiU1v2DtwL1WHhlwohlNNukdw5CMFUsqjb5ikpd2LriFUQNyxgP5kQKHrQMIvNr8HOWX9q0eTunbx1e96JSP4FJPwKLLdGU00E1XCP90bvzW25Ho8GpihWS3Ln3l/0B16CVNXzcKNu3ZNk9zp+1+p6mO9mG1+xTud1Sm4m5HR5izz5qCr7fw7TeDeU2AToRnAthTfs7ZOgmxnC/KmLlggqv8+5CzORNk8vPpZzEkhwkV2BoHQYYcERO42Oq73Z5dvdh5y8wp380NYjxmXSmc81Eit+ngrsb3J/gFVMXBEjYoGuRXLI0y3v6y0uCtibEtSpTta+RCmCF2I652Iu3PT0xdxNfpvhLOpwHyMXnozD0ftxkZ8ctxop24miKxbli84heisOge5pj0+kBbSVBZ8thLCpN+i5J6aG0PLbO+dAL8GwrB8VMV4ITOrjSDHW/FCKW8BNAGoHsgMGwuDSMxHP53/rfmK445ASBW7EEGNfDhRblHVnBKedG6kKVrqEe9TaH1wilg9Egxou+EdA/H gLym4gPd 1GzXVx/1rIs6L0YNjz3vrvEA8sCe2dx07VNR2dk7jKOGFFA/myY84FKvRM2OYdmGZ8YoAFicsdA9jbsJjq/P8UW+WBOERcHSo7F7Ab5RC6N3HPHU1g+oXuYmAwASe5vihk1YBaW+wy8CaRbZAdrCQJPt/oEONdGxmvb3koHXLcw97/yHCtp6elenvBtGDT7jR9u3qbsDW0ZRxsZxcXQ7w5yfRtTnK5qkXjO5b8E823Utqb0s15QxvZfmozlE/Ovp2GlGIY01olHdNgPiPVtIwABDVj4Za0Jp+Zu/GMoukf2/C9Vh217j5Ap7ghl3m70YQjSfuxdNErqRYHwRZO9vvFWeu37Je1Z1DybdWJS59BPJb7l2Taq5CXjbIIg== 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 Tested-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 f2d6007a2b98..1f07772ae578 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] */ @@ -534,6 +545,14 @@ static const struct hwcap_data { .sigill_fn = fpmr_sigill, .sigill_reliable = true, }, + { + .name = "GCS", + .at_hwcap = AT_HWCAP, + .hwcap_bit = HWCAP_GCS, + .cpuinfo = "gcs", + .sigill_fn = gcs_sigill, + .sigill_reliable = true, + }, { .name = "JSCVT", .at_hwcap = AT_HWCAP,