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: 196290 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp998307dyc; Sat, 3 Feb 2024 04:48:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpCb4s6Oij4JzE6HTSom9dIrA9I4pSn336Fnuv+kL8TuE4/AE70JO5u6NAtS9FW+JbAhXZ X-Received: by 2002:a05:6e02:1b05:b0:363:b2cc:8e67 with SMTP id i5-20020a056e021b0500b00363b2cc8e67mr5928540ilv.26.1706964508729; Sat, 03 Feb 2024 04:48:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706964508; cv=pass; d=google.com; s=arc-20160816; b=KQ/h50ftmURuoAcx0nGZP37nwHW3sL/S6EE7taukb5wI+ivbdW0pTB7/+F8EGbVQOy JOd0W8EjNO9AysXvizUkrjyuAXSl0jFVxoaVgaQSv4JZsHtAALN/EsZ2wkGKWh+phYrz HTG5/cEN1ic3LrvwKqFKoL1AVNyFwu7Ai30EqiKvPzZqRbp8fZYDuOnfRgkBHuyDw/nn IXM/vTtlWngfMLi5FP4IiEiPlwypo9Sx35cpwaMKy+8ke4tU65iBXBUKRfZWB3IZk+1o 6VT4t0UyRvgGcYsez6+o1gW/HAo3nCjvxU7D84QNFw7nR0Wu6b7uSfFEpMA3g2krYn6v EfOA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=npDy0Wmy9sZ4pKZgJh/SDPTi250q9KNBnEHGR8MQcNY=; fh=MwcgAFbZWAhY+MV9pcA7s/rqs+xB7S6LMUxbzssvgz8=; b=v/fH1B6JV2Jh0PDKhkxQy91pO2ktKdyW/4OfbUuEvGsWmHxuTa71vGMC46JIt4n3AR zOTOZ1H9BfPPpoaCj9a7hU3RGxsmooSgsxr/5RLfTMQ+3vDDW6Mr4pXOil2QxIhRjmXE YKuJDy4CvQr3Viuel2uvbNc3oFVdDmcc8SN48WKOoZWZNTW7cKB40KOkLuaIJqQvZDI7 VO5WECXaJsrWetWuADc+1awt+8eXhI2x03n3waYTsTvRezplHGghUMKgXOKvZlbzP+Rb VZoZY9CwTasX5Zhl77Jbd19aZDqS4xupaVLrasdupP6tkX5beEm7n/CrqlpmqJL2av0p 2Awg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rq54rGZn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51069-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51069-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCUQtyROgpHH9ZZg1B+rpgdIoCq/e/tT5Jucjjtt3a/F+I2cVCJySEUdUaQdlOAe7W59jJa0+eScdZhCsYcoDoOBwtEh6Q== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j19-20020a634a53000000b005dbe215856dsi3179146pgl.765.2024.02.03.04.48.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 04:48:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51069-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rq54rGZn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51069-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51069-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 291B2B24562 for ; Sat, 3 Feb 2024 12:40:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E7C878695; Sat, 3 Feb 2024 12:32:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rq54rGZn" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 952F777F0E; Sat, 3 Feb 2024 12:32:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706963563; cv=none; b=O0fv9IUaeUY/9aRbbyslkxf7RKh5fk3wc0TzLPY8/Wyjo12BBq1TQrKPIWhXZZg2RQ8KPZGOE2E+hmGdRr3ZcByBLWyyB7t8mW1REsnMM5sWQf0vG5Cd8WKS9x1fOF/cC01xbj19FAz6MNcCNhvex2wesC3T0EwJ3KrIHU8oeBY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706963563; c=relaxed/simple; bh=12GEB0Pk7RCg7IDCHng3d3qOxpvs8kdDfOLg/QCQKjw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gdXmT9jQZAc9NC/V+35wPS/dkrsrLCrvcqcyhGnwcmP1ZuV71jWqtf0FR0W6+rGqAvSnxuq8JPxLwkVBWxP5yDisH8B2AcYufgFExUBrbo7upEa+++gTy2V89ODrrmYIC8u4OPshbTzOLipDprJVRX0rPy4Ks8mQg68MGr6vwGI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rq54rGZn; arc=none smtp.client-ip=10.30.226.201 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789882016894513241 X-GMAIL-MSGID: 1789882016894513241 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,