Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1434240rwl; Thu, 5 Jan 2023 13:36:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXt2ijJ13pqrCfO2AUSFY1/J66nGqfj+uzOhll21HnG5Dr+rnknOp2N64n5MjKAYBVSnXcqU X-Received: by 2002:a17:90a:b288:b0:225:c2b4:5742 with SMTP id c8-20020a17090ab28800b00225c2b45742mr47462725pjr.34.1672954599924; Thu, 05 Jan 2023 13:36:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672954599; cv=none; d=google.com; s=arc-20160816; b=cQ1TBlNyeaV2E2P8A3xGQjGCExBhFyM7fd2eSkFJcWKSDiSocYzq1xTCGeFK8lDaUI Zu85Bt9gjmnwjzYrIYe86SiFIL5zhw5W9SmkMl5BdlUBaAQbeovaQsHvymappfRacQag W6otAcMYZsztBxNt9ALlAIb5c1To3fhvnZ+nYSZtVXTkImfA9oStFfh5f9QLE2qYyir1 rj8oMTzRnSZcHftwc5gOVXi3Vmf76ICOC40jf56anykZWUGb5oBCOtQnauZen89AoS7u 5tDzc5FIzlBrguaiD6Q40OSujXCRkMSInziPWfk+9135gpLHFN6ijspMruUuUaXuFfAn MEng== 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=aYVWC4sBVgWrlftRY/Wjwf7HrIxSM4JPLvpreSFfkAc=; b=IFAfStzQnPLXy0s4Y+1dQfLWa4yGOmLXNbNxVBvH2OdQ/ZPc9gXb68yMmYSxO/unft 4P7+vrOOplePGVbSpjiEnMWm5/+BiA7QjtinAuWUwkvEok9+yvHtaB2p8qv7zZxGYOqe wN/ZAatYH0yihoG+oUFQvFrphhy9sX1pi4uUSQsorkTsbf4EgSgiZAxFzhpmIqTmvfCC CpUiUe52MSGUGslWnU9LzDruX/fjVoOEOf+ry3UmFCvxIoQXJU5kd6HbL0FpqF0BryJn O6IEm5JB26zTr6hd72qkqorjkb2nZEPp2yyO6LD3ADK7UeaETDydroZ3yqiZjgJQYH6j 23CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=LgjU7AxU; 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 i4-20020a63b304000000b004a394246e6asi11250217pgf.309.2023.01.05.13.36.32; Thu, 05 Jan 2023 13:36:39 -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=LgjU7AxU; 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 S235537AbjAEUse (ORCPT + 56 others); Thu, 5 Jan 2023 15:48:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235478AbjAEUsc (ORCPT ); Thu, 5 Jan 2023 15:48:32 -0500 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A8804C71F for ; Thu, 5 Jan 2023 12:48:31 -0800 (PST) Date: Thu, 5 Jan 2023 20:48:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1672951709; 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=aYVWC4sBVgWrlftRY/Wjwf7HrIxSM4JPLvpreSFfkAc=; b=LgjU7AxU13CeHxxXWLLpwOOH5ZSC/3yZk+Yl//JoD5VDml1Sy6Yh3KLVvULVDKlvJXIKb/ tmKISIzCGNty273PY3SF6qOSJCq9HRNTKXvytFIAPNgHG5U4XiQXojMUv9cwj5/CyyOoN2 bGdRhh/FGQo/Uo6dCrNYdHW1xt1nOSQ= 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 v4 6/7] KVM: arm64: Mask FEAT_CCIDX Message-ID: References: <20221221204016.658874-1-akihiko.odaki@daynix.com> <20221221204016.658874-7-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221221204016.658874-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_PASS,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 Hi Akihiko, On Thu, Dec 22, 2022 at 05:40:15AM +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 > --- > 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