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 212D0C6FA99 for ; Sun, 12 Mar 2023 10:30:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PE638Lez3y/VbE40CRjOJwgSf8W9tRvSQq8Ei1sJLfc=; b=1O2JgRWDpbQGoV PEj/NIbLmEgiN0pgveM9Jhj6xLCMbuGMGMTI+X1to1G8lCv6ESEPgaDzFx8HdLN//3A9PhtDbGRf+ MI+f66rprRrIPpaJBvEJr7otvwIAz4+YJnyrP7cDcyYIsTo5oZU+OBZVsuXZ1V4D1usX53pNwfgRE 97XYBRVnLwGJy2z6QmEIsnIZ3eO8r8tWfGK8opMAO2KeRBo+5zATegLOnZCSWwRCY6fvlp/t0deL5 aJwnUf6i1lLrd8SZG1RyRbohMPEvmRYBFFu5dXN1eV5EyjXWokkrFQZwVfI+2EZB7dIfoyNLl0c2G EkTX3SWxguTRfe9ODF3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbIx9-0026B5-C6; Sun, 12 Mar 2023 10:29:23 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbIx4-0026Ae-RI for linux-arm-kernel@lists.infradead.org; Sun, 12 Mar 2023 10:29:20 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8391A60EE6; Sun, 12 Mar 2023 10:29:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D83A3C433D2; Sun, 12 Mar 2023 10:29:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678616956; bh=aSQAHnGftmgjvVgaTHrVDh6VUtyePFdAf7NI0ZkUpFE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=A1hM2L72FEiLsJdNdKRTCnVOURRRH/9zZF9irtqvQpEkX01wEH+6If3trtpJu7+Hl Pe4gW2xNJk2bLCWr05319WycfTg5fY7SphFt3vgqXsFm+ozWSipiw46UBxfix4JAev YVMkryuxVlI2A3K+g8L8wqzEQMVYiBIEPRw+jVJctfQc/4Ek5kslu/o3A4M0o7pqR0 pGcq2Kg3VqE2GYAcZswKhXP/NTX3wv/A787HUJ9VMR126zJRAkX4VOiptOV3odEhO5 VeY2ANQesQ8N7ZQYdp0t+uBg3A2hDeFEk/13/NkFd/HqoIf07IVXWhc6jpNDCr1o15 NUjUpolPf4FrA== Received: from sofa.misterjones.org ([185.219.108.64] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pbIwy-00GyR2-D6; Sun, 12 Mar 2023 10:29:14 +0000 Date: Sun, 12 Mar 2023 10:29:11 +0000 Message-ID: <87edpu5klk.wl-maz@kernel.org> From: Marc Zyngier To: Mark Brown Cc: Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Paolo Bonzini , Shuah Khan , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: selftests: Add coverage of MTE system registers In-Reply-To: <20230308-kvm-arm64-test-mte-regs-v1-1-f92a377e486f@kernel.org> References: <20230308-kvm-arm64-test-mte-regs-v1-1-f92a377e486f@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: broonie@kernel.org, oliver.upton@linux.dev, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, pbonzini@redhat.com, shuah@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230312_032919_110561_9F98BC5F X-CRM114-Status: GOOD ( 28.98 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 08 Mar 2023 17:12:26 +0000, Mark Brown wrote: > > Verify that a guest with MTE has access to the MTE registers. Since MTE is > enabled as a VM wide capability we need to add support for doing that in > the process. > > Signed-off-by: Mark Brown > --- > tools/testing/selftests/kvm/aarch64/get-reg-list.c | 33 ++++++++++++++++++++++ > 1 file changed, 33 insertions(+) > > diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c > index d287dd2cac0a..63d6a9046702 100644 > --- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c > +++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c > @@ -42,6 +42,7 @@ struct reg_sublist { > long capability; > int feature; > bool finalize; > + bool enable_capability; > __u64 *regs; > __u64 regs_n; > __u64 *rejects_set; > @@ -404,6 +405,18 @@ static void check_supported(struct vcpu_config *c) > } > } > > +static void enable_capabilities(struct kvm_vm *vm, struct vcpu_config *c) > +{ > + struct reg_sublist *s; > + > + for_each_sublist(c, s) { > + if (!s->enable_capability) > + continue; > + > + vm_enable_cap(vm, s->capability, 1); > + } > +} > + > static bool print_list; > static bool print_filtered; > static bool fixup_core_regs; > @@ -420,6 +433,7 @@ static void run_test(struct vcpu_config *c) > check_supported(c); > > vm = vm_create_barebones(); > + enable_capabilities(vm, c); > prepare_vcpu_init(c, &init); > vcpu = __vm_vcpu_add(vm, 0); > aarch64_vcpu_setup(vcpu, &init); > @@ -1049,6 +1063,13 @@ static __u64 pauth_generic_regs[] = { > ARM64_SYS_REG(3, 0, 2, 3, 1), /* APGAKEYHI_EL1 */ > }; > > +static __u64 mte_regs[] = { > + ARM64_SYS_REG(3, 0, 1, 0, 5), /* RGSR_EL1 */ > + ARM64_SYS_REG(3, 0, 1, 0, 6), /* GCR_EL1 */ > + ARM64_SYS_REG(3, 0, 5, 6, 0), /* TFSR_EL1 */ > + ARM64_SYS_REG(3, 0, 5, 6, 1), /* TFSRE0_EL1 */ > +}; > + > #define BASE_SUBLIST \ > { "base", .regs = base_regs, .regs_n = ARRAY_SIZE(base_regs), } > #define VREGS_SUBLIST \ > @@ -1075,6 +1096,9 @@ static __u64 pauth_generic_regs[] = { > .regs = pauth_generic_regs, \ > .regs_n = ARRAY_SIZE(pauth_generic_regs), \ > } > +#define MTE_SUBLIST \ > + { "mte", .capability = KVM_CAP_ARM_MTE, .enable_capability = true, \ > + .regs = mte_regs, .regs_n = ARRAY_SIZE(mte_regs), } > > static struct vcpu_config vregs_config = { > .sublists = { > @@ -1123,6 +1147,14 @@ static struct vcpu_config pauth_pmu_config = { > {0}, > }, > }; > +static struct vcpu_config mte_config = { > + .sublists = { > + BASE_SUBLIST, > + VREGS_SUBLIST, > + MTE_SUBLIST, > + {0}, > + }, > +}; > > static struct vcpu_config *vcpu_configs[] = { > &vregs_config, > @@ -1131,5 +1163,6 @@ static struct vcpu_config *vcpu_configs[] = { > &sve_pmu_config, > &pauth_config, > &pauth_pmu_config, > + &mte_config, > }; > static int vcpu_configs_n = ARRAY_SIZE(vcpu_configs); > Is there any reason why we sidestep the combinations of MTE with PAuth and PMU? I know this leads to an exponential set growth, but this is the very purpose of this test, and we found bugs related to this in the past. A good first step would be to be able to build these combinations dynamically, and only then add new sublists to the mix. Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel