Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1513057rwl; Thu, 5 Jan 2023 14:58:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXsBPPpfunQl/YqsYLVz9bR8t6ZBSi3lTzhwpc49x38+mbAn0TJxTxWI7Lndhj2kE1PqMGmd X-Received: by 2002:a17:902:ea02:b0:191:271f:477c with SMTP id s2-20020a170902ea0200b00191271f477cmr58015680plg.32.1672959507903; Thu, 05 Jan 2023 14:58:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672959507; cv=none; d=google.com; s=arc-20160816; b=HS5AkVtVfbaVNcbHNmUTxWO0a6Ftu4S1sJOrmlcI8mxUKWydXDe2KHgKyYFEhidBBe uhn5X/0i/MQxrlnGqSuIh83rbp1Prw2PUSOwGZ58RX9VdoIhCEYj8MH+ZKL4Mv2S7Eoy lzj0ZtW1fufXboo0FbQTSzfxA5E3MLR6fV7hlT1bve8J5kGKotUSKTk8gbkni+XEw/4f yfKS7SK2JH9wWkE7ha4lOSJZdUmECvahnY7Yi1fjU65WMSqFnOlLI0iHsbftvd9cOiAi W+YBhuKlF/hlVsu1aiUfOgWNT5T6yIFquS8vmKf8o+InX/CBuPCMk8oqs7X4lTefcT4j Vsng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=jUI9TSiA75B4vjGbap/Y0EjPHoVUu/AzEKZE5jFgpHg=; b=PAwOPUnJberN/LvFXFVm2pdfWpQovkRceBdkI1U6+AM8YskoC3rZy3H6nZYNMx2jHZ SVzLGl6zaOcy4KhYqoSHWPuKOPO9r7zV/A3yBiGapwDrAjUVb0A+Pok0frmj60blg3cU EwuXv56YjnOjGXBerapzOsfHhYkMXR2JIs0b1RTIyT+spgse9+LRzoCMbINrTP2xhnrJ YOF4uy4U2pD32+kw7e62fWYGCDocYoA+27ctMzp319ZMMHMn1ujlyYVpsvx55hqZqvqB BoAUGTXIER669FnaPciYAux6pCB7NMz4g//owj8M5zJ2/ny/MOoV09m6sfpRLXhS0NiA x0MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=QW44AXC4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a170903230800b00176e58d4a4esi41481951plh.100.2023.01.05.14.58.20; Thu, 05 Jan 2023 14:58:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=QW44AXC4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235903AbjAEWWQ (ORCPT + 55 others); Thu, 5 Jan 2023 17:22:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235812AbjAEWWN (ORCPT ); Thu, 5 Jan 2023 17:22:13 -0500 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [IPv6:2001:41d0:1004:224b::bc]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED0F06B198 for ; Thu, 5 Jan 2023 14:22:10 -0800 (PST) Date: Thu, 5 Jan 2023 22:22:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1672957328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jUI9TSiA75B4vjGbap/Y0EjPHoVUu/AzEKZE5jFgpHg=; b=QW44AXC4DbOOKrF4eAPSNoVRO42xVcoshBgAnnxFHEhd3hKj0mII5TWxIkNdocZG9Kz7bs JVJXFN1rQ2WxSJ46GXjpk2quWO3M4EWu/UXD2yRhm0nM/WKX4CTJQFwJtxc5+H900NnXpR PN/h8KcFXMfMKaZcQRnR4HyPcLCEpGM= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Akihiko Odaki Cc: Mark Brown , Marc Zyngier , linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Mathieu Poirier , Suzuki K Poulose , Alexandru Elisei , James Morse , Will Deacon , Catalin Marinas , asahi@lists.linux.dev, Alyssa Rosenzweig , Sven Peter , Hector Martin Subject: Re: [PATCH v5 6/7] KVM: arm64: Mask FEAT_CCIDX Message-ID: References: <20221230095452.181764-1-akihiko.odaki@daynix.com> <20221230095452.181764-7-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221230095452.181764-7-akihiko.odaki@daynix.com> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 30, 2022 at 06:54:51PM +0900, Akihiko Odaki wrote: > The CCSIDR access handler masks the associativity bits according to the > bit layout for processors without FEAT_CCIDX. KVM also assumes CCSIDR is > 32-bit where it will be 64-bit if FEAT_CCIDX is enabled. Mask FEAT_CCIDX > so that these assumptions hold. > > Suggested-by: Marc Zyngier > Signed-off-by: Akihiko Odaki FYI, I'm an idiot and replied to v4 of this patch... Forwarding comments below: > --- > arch/arm64/kvm/sys_regs.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c > index f4a7c5abcbca..aeabf1f3370b 100644 > --- a/arch/arm64/kvm/sys_regs.c > +++ b/arch/arm64/kvm/sys_regs.c > @@ -1124,6 +1124,12 @@ static u64 read_id_reg(const struct kvm_vcpu *vcpu, struct sys_reg_desc const *r > ID_DFR0_PERFMON_SHIFT, > kvm_vcpu_has_pmu(vcpu) ? ID_DFR0_PERFMON_8_4 : 0); > break; > + case SYS_ID_AA64MMFR2_EL1: > + val &= ~ID_AA64MMFR2_EL1_CCIDX_MASK; > + break; > + case SYS_ID_MMFR4_EL1: > + val &= ~ARM64_FEATURE_MASK(ID_MMFR4_CCIDX); > + break; Not that it is necessarily worth addressing, but I wanted to point something out. This change breaks migration from older kernels on implementations w/ FEAT_CCIDX. There is most likely exactly 0 of those in the wild, but we need to be careful changing user-visible stuff like this. -- Thanks, Oliver