From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3149FC3DA7F for ; Fri, 2 Aug 2024 21:59:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0kjdlJ68vZbHp51P7FXzk3CnTJ5oQ1TrpBBA8cBVeaY=; b=Bt5eqPibUofMYPT98c3r2lp+pM NUS3SJx/Hzf7g9akGQxFhn2rh6pleodE38BoiXpNwI4Ls25ulWaGFSUHtbx1gDujQ5Ytk1mPerD5H vdVjyT4H7jhW1DNq+/XBQxvVXeqJhQSMKfZr8D0d6X4jXhh0Ssf1QAqE8QTbBUMwD1WXlH1gME7RU aE3M+o+AX3CYHuTzCyyK1RPhz6FAJS1CV1KuDRyyjE3PcQg0a9skAYJQq2sL1gynUeFB1lvt1eBr3 qt35j3rc8PMrlfji/2IUfBdYMXyyY/8hHDlKrZxUJ2Kv25yv4d0t0nSZGF+YlSjuDnWXrnEwkuIMi PTHhQDGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sa0Ir-0000000ADFE-2TAO; Fri, 02 Aug 2024 21:59:13 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sa0Hx-0000000ACyE-2WSq for linux-arm-kernel@lists.infradead.org; Fri, 02 Aug 2024 21:58:19 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id CA093CE1BCF; Fri, 2 Aug 2024 21:58:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84A20C32782; Fri, 2 Aug 2024 21:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722635895; bh=AVgebCWfsB1J9sg1AYiFbvjfukzP5s4owE8FOzxGRiQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=U1ckbatWSCsnlWdTBT6duFL2GwbVkNTMMMlW3jN8qYXZJMYxcdDhkwgwAauCE9UZv IIcpub+Hc5gJ6uAX5uRIJRYNLLgHziNIBI3zhs3V+EzBUZ14+pC3o/5YNkOnpBMxn8 z79XJ+QRZ1q1Le8pq/8lIdFg+DqlCyaZelYArK2VLMS0nK/P1k4CSd+u459C6NONgI ZrRXY+SbuhvS3zrKllh4+uJi3vN0fijrElpH07LJ5rKdHZ4VBl1RwZYE2E4sDyHqaY 2pQNCZS+bXAA2fZn5npRA6Ffjz8SVB2NfqHhBon2LCyTbhOnHatH8GPTXp3VMxx/SM NppLyPlewRI2w== From: Mark Brown Date: Fri, 02 Aug 2024 22:57:53 +0100 Subject: [PATCH 1/2] KVM: selftests: arm64: Simplify specification of filtered registers MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240802-kvm-arm64-get-reg-list-v1-1-3a5bf8f80765@kernel.org> References: <20240802-kvm-arm64-get-reg-list-v1-0-3a5bf8f80765@kernel.org> In-Reply-To: <20240802-kvm-arm64-get-reg-list-v1-0-3a5bf8f80765@kernel.org> To: Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Paolo Bonzini , Shuah Khan , Catalin Marinas , Joey Gouly Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=2233; i=broonie@kernel.org; h=from:subject:message-id; bh=AVgebCWfsB1J9sg1AYiFbvjfukzP5s4owE8FOzxGRiQ=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBmrVZv5ePVRlzFtHE1IV89P3y2WNY0J8BDdG0donou w+Y8nt2JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZq1WbwAKCRAk1otyXVSH0IUjB/ 90hc+2imIEoJUMsqqL3gypXToxHXVOW77FsqHEba9EAptauCBWjlEjtuIxQFtcqdAAABjvYGYoEcq/ HyhReFSZXiXcD3UfyNiAT/YUrRLaI1SuJmeEQn6xCkqXa4n8sX03759m93FtDi9iMASaftMTUCTOcn I7ZOGGi8MJlEd1bdKPssYwks7dcqhpaeo2NRG1WkUPjzKefJWvE9Lu53Cl4kGa5Ub5kUEqpgBLNpHw MY485H8r1JDpoGhxo2zR8rW3I7NUgFLCnTzcS7irBLYqae9ji/W4BEyxrnn7nIHSX7klz8Ywg3zCvt wC1xFC8Om6moU0SWUGBarzczECmkYp X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240802_145818_022009_C9CF762C X-CRM114-Status: GOOD ( 12.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since we already import the generated sysreg definitions from the main kernel and reference them in processor.h for use in other KVM tests we can also make use of them for get-reg-list as well instead of having hard coded magic numbers in the program. Do this for the table defining which registers should be gated on ID register values, using a macro which allows us to specify the register and ID register field in a much more compact and direct fashion. In the process we fix the ID register checked for S1PIE specific registers which was using an incorrect shift of 4, checking SCTLRX support instead. No other change is seen in the generated data. Fixes: 5f0419a0083b ("KVM: selftests: get-reg-list: add Permission Indirection registers") Signed-off-by: Mark Brown --- tools/testing/selftests/kvm/aarch64/get-reg-list.c | 29 ++++++++-------------- 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c index 709d7d721760..a00322970578 100644 --- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c +++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c @@ -22,25 +22,18 @@ struct feature_id_reg { __u64 feat_min; }; -static struct feature_id_reg feat_id_regs[] = { - { - ARM64_SYS_REG(3, 0, 2, 0, 3), /* TCR2_EL1 */ - ARM64_SYS_REG(3, 0, 0, 7, 3), /* ID_AA64MMFR3_EL1 */ - 0, - 1 - }, - { - ARM64_SYS_REG(3, 0, 10, 2, 2), /* PIRE0_EL1 */ - ARM64_SYS_REG(3, 0, 0, 7, 3), /* ID_AA64MMFR3_EL1 */ - 4, - 1 - }, - { - ARM64_SYS_REG(3, 0, 10, 2, 3), /* PIR_EL1 */ - ARM64_SYS_REG(3, 0, 0, 7, 3), /* ID_AA64MMFR3_EL1 */ - 4, - 1 +#define FEAT_ID_CHECK(reg, id_reg, id_field, id_val) \ + { \ + KVM_ARM64_SYS_REG(SYS_##reg), \ + KVM_ARM64_SYS_REG(SYS_##id_reg), \ + id_reg##_##id_field##_SHIFT, \ + id_reg##_##id_field##_##id_val, \ } + +static struct feature_id_reg feat_id_regs[] = { + FEAT_ID_CHECK(TCR2_EL1, ID_AA64MMFR3_EL1, TCRX, IMP), + FEAT_ID_CHECK(PIRE0_EL1, ID_AA64MMFR3_EL1, S1PIE, IMP), + FEAT_ID_CHECK(PIR_EL1, ID_AA64MMFR3_EL1, S1PIE, IMP), }; bool filter_reg(__u64 reg) -- 2.39.2