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 X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0AE7C433E1 for ; Mon, 13 Jul 2020 17:45:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5360720738 for ; Mon, 13 Jul 2020 17:45:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5360720738 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AB1E48D0003; Mon, 13 Jul 2020 13:45:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A60F08D0001; Mon, 13 Jul 2020 13:45:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 976D98D0003; Mon, 13 Jul 2020 13:45:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0040.hostedemail.com [216.40.44.40]) by kanga.kvack.org (Postfix) with ESMTP id 7E7818D0001 for ; Mon, 13 Jul 2020 13:45:42 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id EAE40824556B for ; Mon, 13 Jul 2020 17:45:41 +0000 (UTC) X-FDA: 77033780082.29.need05_2516c5f26eea Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id CA7EC18086E37 for ; Mon, 13 Jul 2020 17:45:40 +0000 (UTC) X-HE-Tag: need05_2516c5f26eea X-Filterd-Recvd-Size: 3817 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Mon, 13 Jul 2020 17:45:38 +0000 (UTC) Received: from gaia (unknown [95.146.230.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4CCB220738; Mon, 13 Jul 2020 17:45:35 +0000 (UTC) Date: Mon, 13 Jul 2020 18:45:32 +0100 From: Catalin Marinas To: Steven Price Cc: linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, Suzuki K Poulose , Szabolcs Nagy , Andrey Konovalov , Kevin Brodsky , Peter Collingbourne , linux-mm@kvack.org, Andrew Morton , Vincenzo Frascino , Will Deacon , Dave P Martin Subject: Re: [PATCH v6 02/26] arm64: mte: CPU feature detection and initial sysreg configuration Message-ID: <20200713174531.GF15829@gaia> References: <20200703153718.16973-1-catalin.marinas@arm.com> <20200703153718.16973-3-catalin.marinas@arm.com> <2fb4b560-fb2f-7689-05f7-d908b55cd1eb@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2fb4b560-fb2f-7689-05f7-d908b55cd1eb@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: CA7EC18086E37 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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: On Mon, Jul 13, 2020 at 11:08:15AM +0100, Steven Price wrote: > On 03/07/2020 16:36, Catalin Marinas wrote: > > From: Vincenzo Frascino > > > > Add the cpufeature and hwcap entries to detect the presence of MTE on > > the boot CPUs (primary and secondary). Any late secondary CPU not > > supporting the feature, if detected during boot, will be parked. > > > > In addition, add the minimum SCTLR_EL1 and HCR_EL2 bits for enabling > > MTE. Without subsequent setting of MAIR, these bits do not have an > > effect on tag checking. > > > > Signed-off-by: Vincenzo Frascino > > Co-developed-by: Catalin Marinas > > Signed-off-by: Catalin Marinas > > Cc: Will Deacon > > Cc: Suzuki K Poulose > > This commit causes the feature bit to be exposed to a guest, but we > don't at this point have any way of handling a guest which attempts to > use MTE. > > This is 'fixed' by the first patch of my KVM MTE series[1], but perhaps > the chunk modifying arch/arm64/kvm/sys_regs.c (see below) should be included here > instead? That way we hide the feature until we're ready for a guest with > MTE support. > > Steve > [1] https://lore.kernel.org/r/20200713100102.53664-2-steven.price@arm.com > > ----8<---- > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c > index baf5ce9225ce..5ca974c93bd4 100644 > --- a/arch/arm64/kvm/sys_regs.c > +++ b/arch/arm64/kvm/sys_regs.c > @@ -1104,6 +1104,8 @@ static u64 read_id_reg(const struct kvm_vcpu *vcpu, > if (!vcpu_has_sve(vcpu)) > val &= ~(0xfUL << ID_AA64PFR0_SVE_SHIFT); > val &= ~(0xfUL << ID_AA64PFR0_AMU_SHIFT); > + } else if (id == SYS_ID_AA64PFR1_EL1) { > + val &= ~(0xfUL << ID_AA64PFR1_MTE_SHIFT); > } else if (id == SYS_ID_AA64ISAR1_EL1 && !vcpu_has_ptrauth(vcpu)) { > val &= ~((0xfUL << ID_AA64ISAR1_APA_SHIFT) | > (0xfUL << ID_AA64ISAR1_API_SHIFT) | Thanks Steven. I thought this worked on explicitly enabling the CPUID for guests but I think I only checked with an old host kernel which was masking the ID field anyway. I tried it again now and it indeed fails. I'll fold this in. -- Catalin