From patchwork Sat Feb 3 12:25:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13544153 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 38EF8C4828F for ; Sat, 3 Feb 2024 12:32:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C01DD6B0071; Sat, 3 Feb 2024 07:32:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BB2D86B00B7; Sat, 3 Feb 2024 07:32:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A2D0A6B00B9; Sat, 3 Feb 2024 07:32:50 -0500 (EST) 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 8ABD76B0071 for ; Sat, 3 Feb 2024 07:32:50 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 651CEA0776 for ; Sat, 3 Feb 2024 12:32:50 +0000 (UTC) X-FDA: 81750431700.08.36DE101 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf12.hostedemail.com (Postfix) with ESMTP id 02F9E40007 for ; Sat, 3 Feb 2024 12:32:47 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rq54rGZn; spf=pass (imf12.hostedemail.com: domain of broonie@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706963568; a=rsa-sha256; cv=none; b=FfBFdz7CIgMAIMbCfhQCWawsstV5wwerRjnmOXHvj1VqdJIt8xfHw7uOLiEEilLt9gcX12 fifyUlDMXy+y//Z22jprnQyFCarFkbAx0OfkCPOVr8fMK+TvehIWGw4gfj9G6EOSzD7HmM xLcCCLi08qVIipVKsI3gFWx28yYrHUA= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rq54rGZn; spf=pass (imf12.hostedemail.com: domain of broonie@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=broonie@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706963568; 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=npDy0Wmy9sZ4pKZgJh/SDPTi250q9KNBnEHGR8MQcNY=; b=Q0yJTEuNCPzfiBZ/xGQ9pUm0WwtoBRX6hfQ3dePFUI0vKe/qr0lK/HWH2PR52Pj5EqGtQ5 U+dCdix0NKEptYpecV4LrkmnczDr8W7g17+EwBECC3OPMqkj04cev8ysp0xiD/GJE/0X7O KNEKCxMNOupYtPi8CjXdFI/u+HtYt4c= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 04A02CE1F0F; Sat, 3 Feb 2024 12:32:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32B8AC43394; Sat, 3 Feb 2024 12:32:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706963563; bh=12GEB0Pk7RCg7IDCHng3d3qOxpvs8kdDfOLg/QCQKjw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rq54rGZnx24MR+LUh3nV3e8oP26hH94Ibu9LOex/80fqVy+e02EBu6dqOsyofq/dn 9S3U4uPifeLeILbteJBG/QpWUnZBy2WOLOp+KlMEeRcHL0qaYHcKVtv9q0S3QhIcwI 9E7PODu5zTqrPfUy5t4C+wZy0qNXoit/OCYzm0NAdwWQydU1XQwNFUeDX0MRP167T0 Y7Iu3LtDUIXNO0qtNGG0Y7WCih15IbGNQYHJdK+QTL7cGBX7U9Fzf95CLwlV6+DWis KDpX4Lz0jfsNLClK5EnD1j4F6fJ0rXsFQXAp3XGWDvODVXmAyfNf+vI79g1HZOXsYV THWaW5vGRn1IA== From: Mark Brown Date: Sat, 03 Feb 2024 12:25:53 +0000 Subject: [PATCH v8 27/38] kselftest/arm64: Verify the GCS hwcap MIME-Version: 1.0 Message-Id: <20240203-arm64-gcs-v8-27-c9fec77673ef@kernel.org> References: <20240203-arm64-gcs-v8-0-c9fec77673ef@kernel.org> In-Reply-To: <20240203-arm64-gcs-v8-0-c9fec77673ef@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-a684c X-Developer-Signature: v=1; a=openpgp-sha256; l=1190; i=broonie@kernel.org; h=from:subject:message-id; bh=12GEB0Pk7RCg7IDCHng3d3qOxpvs8kdDfOLg/QCQKjw=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlvjDmTw5/9VutAafQEgaHl/AQF1z3bFN2KzUpHqGY L4zrDKaJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZb4w5gAKCRAk1otyXVSH0H76B/ 0ZxrYYCMIsi8MRn7I+3H6jNZKAVNmw8SJNvqoTY/zYbJNmq4MKh3rt6x1O2gevx9hobz/cn88DE1f9 pdIhoGTFgFsgL5+npQ6sINjikcDLWkpQZ9IKvFtQ8i0A7p1Ts6+F8ouQ/YWF5fiwDCcaglMB5SDDS0 UKDKMWST/vMh8R/NHIjFIZ/yqpAFZrbPxntxjgSGwoIONgk0N959zfmcfkPghY9+a5troDlRxfBQyg M1y/zi2IbuTvIkrM9tWMmAh0rM4cC3npQ8FUa7WcMl9u2iNHczDLo6UvLO8idOYZStNtaGst5U6Izi tbHk2hUyigCouolu0//aNQ/XwlU1i1 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 02F9E40007 X-Stat-Signature: ofzz4manihdikhnz9zw1iwnww75kaf4h X-Rspam-User: X-HE-Tag: 1706963567-806412 X-HE-Meta: U2FsdGVkX197pY40Ll1uG2hWC60UzwvIO2wED+0Eta1elrmmi3jj5IXVc1NxoUhc7NhM6/RJwJyS6kg6l3zP11tP+JFjp0hEBUaIARQlAq1KubFUnKjRnjmkJK8YTbUOoK7y9u6lyVSpYRdrHm1M+VMBs7BvtS2VFz1K+I9j7yRNp0GQrKI0rmS9glyfDifqJtVhEjiQ7ndXbAzqbwEH+XcJ1zL6myYUOKrKWl9AjIwxYpRT2FgdTHlsCFrlPZbbyeHUw5y46K/uug94/sp+BaaCmwxe05XkzOCQwhuX9FMwgdh2nvnahKeA0YCdrO6F0Hk5IaRraJzVsmxGF9//+vJYdOaDsIMCGRygGeHCp4n8Sqr0lcu9SQjfgmT9x+SSxI6gs9y0dh4bEe/zl2N3xENCROzd37HKQg2aII4Pz1KvhKlhJXXS9vuLzBeYWsiI0HCw0uJSNVNZfulY+JUdmHZbBYY4TvALPwOjaNM+Cx4LIavTRGEl8d/8OX+Z2RFuJSqGYfa6JFKVxB4mNjj7M+2noefPf+ymupBeRmyyGgtcieFhGmMbDxCHWdVx/DkSxEtaY/JhUm6d9jSU3fqIhokSpYjj4gsOw6FiDAXJC/zso24+ooXN7F/BrCVS+kIoHDUiKRztJkJa0d9j3SHSOMQTdtQcg0LzsZIxQE+COUPvF9J/eeQnbNJyOGXq2pXEUMBfxdwLh6StH9qSTw1c23fAZEAE4epJLA74Va7XAS6k1J0UqzU9laHCkSiPco9r52AQICffyO6TZuuPQ7BWSl6jINkFDixIp8CCQPWvh/eb83il9tDkd8itv2g/KOj4veuZ675i0JUeXeqPohQd64N1YeX8rScyzK+LLF+ycmuiCg16wQI/SfJLbiHKYWwkugJVmWVAT768iIgCLv0Sr8TcIqOzJj8FlrZecZlPVFwjC49pSoacP1syeM0JuCZDI6cmmbIe6vI7CPRxoCP t1oYMo5m 5c8bn/gXVXvK+Wf5KSD7iyZTXVcf5PyPD8xL45h9rUlqhdHt0cUmNretRF8IxuXeJ3k3lSL9TX3wrfXJDFvDYmedJb7556nVplkDMsXMsHoqO1Kzbo6gXhDuZAsbICaFbE4E/VwXFJm+aHB9MscXX/7Vurph3jB8gaTxlEnbrj6wBOCm1bJ181jMKPjg19P6rvZlfwWK+zk1jzh1p5jrabrvnYTWZWuFLVVltcW2LFwGDT7muEnmf9piklSvYaXzzqetwNfuYvXjRRa6DjaJWQyPA2GuBGp8VWm3O5LYsgVtGfZdwVlYHOySCIeqEaSVkSHce 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,