From patchwork Mon Aug 7 22:00:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13345148 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 D513CC001B0 for ; Mon, 7 Aug 2023 22:04:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 796798D0006; Mon, 7 Aug 2023 18:04:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 746288D0001; Mon, 7 Aug 2023 18:04:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E7F98D0006; Mon, 7 Aug 2023 18:04:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 4DDFA8D0001 for ; Mon, 7 Aug 2023 18:04:18 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E7EB740C14 for ; Mon, 7 Aug 2023 22:04:17 +0000 (UTC) X-FDA: 81098687754.27.245A6DB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id 03A59C000D for ; Mon, 7 Aug 2023 22:04:15 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=aNAspYX8; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.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=1691445856; 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=6f2sHhBx1jepR/YNA5SyNc7wOpOk2HW/TCkILD2DXmg=; b=Laetcr4slSZi8mLP/7Iv1LXfCtiVk+yw0Nf4dkiQ/dAz9rLjT+cTXs2FVFFHUJE7OALVuJ 69GdOeGqj9+shQLcn1AQoIR16pk4zWnVSZnL4YD1G7ZxwYB1ICrtt61+mywiybUR2sK+Ts w1wJH7dyoUaa9N1KYLqwA4D0882wy7Y= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=aNAspYX8; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.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=1691445856; a=rsa-sha256; cv=none; b=SS+YUiEfdOlAe1R1IFgfSPE7XuxBO5Rxa+0RQPRPjQ0SLhSe78mSN7nJ+MC0UtaDXvyUZT tfPykZTd1S6bVV6xyKJ6tr+zTVfBkcOPKKDD11dINcQwJxU72laksibQ51sdwxPKjqFOmM 0QQ6b6ZrcNxibqoZMHBLoDVP+BQQp04= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3BBD86229B; Mon, 7 Aug 2023 22:04:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8415C433CA; Mon, 7 Aug 2023 22:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691445854; bh=6C9vpUKzxaC1YPufnnUpE8qHeuHqYjFB9iVUxK25t6w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aNAspYX8YMDa4S1UOfbvx8zWfswbqBEz2wJe7nfM0pWFTYZgpasCip1sxspsbK1qs /ctFJQYBpm7aljWAEoddRMJF5WmAQCiy0iBDZYT5uSPQXATQIPS9q50niTcPxSoYYk U7X+2GqIufk6btPdrinnoTk4hj8wM7DiUAFP7dlkMqbK/aAWLB1jFFgmzAvPnQhJUU oXDcFIObaNQGJy0w483/tdaMENDzBL3QS97hz+z2fp/xbLo6OxHbD5nUXVeaLIwxqG NryQH3iy3EX4Hs9w39NpKQdf6CVUtGS5BHj7u+SZrrV/4S85G4qoG9XZQYOA2P/wW+ CAywrJ9cKhinw== From: Mark Brown Date: Mon, 07 Aug 2023 23:00:31 +0100 Subject: [PATCH v4 26/36] kselftest/arm64: Verify the GCS hwcap MIME-Version: 1.0 Message-Id: <20230807-arm64-gcs-v4-26-68cfa37f9069@kernel.org> References: <20230807-arm64-gcs-v4-0-68cfa37f9069@kernel.org> In-Reply-To: <20230807-arm64-gcs-v4-0-68cfa37f9069@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 , 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-034f2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1205; i=broonie@kernel.org; h=from:subject:message-id; bh=6C9vpUKzxaC1YPufnnUpE8qHeuHqYjFB9iVUxK25t6w=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBk0WmsQXm1Nq46jBWok7xLjTNPIAVH3O++MCR+eGVU IlIReyiJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZNFprAAKCRAk1otyXVSH0HEYB/ 0WPQNCRQxW5vYJJYV581n2TRG7EYT3pL7OPOKjvTDLv3U3bWOAdKBA69F+CMA2Cf9vB5QMcZPf8HbY F9VwARZ4J1JwbrXW8xotnruPFWMpZzyIdAgg8/YIU5lOzFtpFhSGm0hhnEjxK16rlpCflpZSVjVpnW OEQq6+W2PsvmhAgpMBYG5P2z/J1gUpUOqhoiDMNyFDYHNjd7tmG4yj+BHiaCXNRfWATS33Y1kRDx42 XRZ3wQ8i8jAjo3JO7pX95L7caAT8EAOfI+ZGgvR+1aHYzcbx2sehURn+5lDFBzXVM+CE8PTpXIUXLc VfOqijnQtnB8bltlyq6L9mWoafWwPE X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 03A59C000D X-Stat-Signature: r15fnsjk6oqe33938raraw18iss71hs6 X-Rspam-User: X-HE-Tag: 1691445855-324370 X-HE-Meta: U2FsdGVkX18uYHY22jWCIxvqXhPj1VrawDa52x8meJRTt5QcAyU+NGZM4pwYZJzpBoTw9+uY0V+End67Xe1fOAHvKolyYJv3z+YT6tZpwIb8Bpu9UaKUokV49/s73idRkRyfoNAniqAmptJpDyl46Ns2JXoiGicoJfuHsJk5Gjhl73kOe2TOhTRJZ3sFrrk+7O02D+um5j2xzE9Bt7TuJx75z4nIo1vyv/5Dsg+mhasp3shAf5Io7TUtbwXULcurJAL+oASaipVbV2KKflt9zkmoCKYJ3O/qRYvPZAA1qnFJpwDPu+uERglTi5f7i4bnClBCyWDAaKUTpRrVUeL4rxLHkOL5rvFHEc/DAW/blnyUomHN+FWecnx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qq9/aGYhr9OKJmME+v/0D2cOoGeYUD2gUmzkNFf2BP9B2xzD7VYNS6WL6ZNEqAU/N+VybaBqptdR4y62k9nWR3PPW2kfo3MFHVU0= 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: 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 d4ad813fed10..38844e4c5aae 100644 --- a/tools/testing/selftests/arm64/abi/hwcap.c +++ b/tools/testing/selftests/arm64/abi/hwcap.c @@ -39,6 +39,17 @@ static void cssc_sigill(void) asm volatile(".inst 0xdac01c00" : : : "x0"); } +static void gcs_sigill(void) +{ + unsigned long *gcspr; + + asm volatile( + "mrs %0, S3_3_C2_C5_1" + : "=r" (gcspr) + : + : "cc"); +} + static void mops_sigill(void) { char dst[1], src[1]; @@ -223,6 +234,14 @@ static const struct hwcap_data { .cpuinfo = "cssc", .sigill_fn = cssc_sigill, }, + { + .name = "GCS", + .at_hwcap = AT_HWCAP2, + .hwcap_bit = HWCAP2_GCS, + .cpuinfo = "gcs", + .sigill_fn = gcs_sigill, + .sigill_reliable = true, + }, { .name = "MOPS", .at_hwcap = AT_HWCAP2,