From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 239E31862B0; Mon, 17 Jun 2024 07:41:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718610070; cv=none; b=OC+GejGietqShjNzCa1VgJX5SRPj0WMr2W8eu1q8FbnB4LKi8YQMkPQ426hiw4FdGL4gEfLMTl+x7WP2ByhcALzbWz0X6ndoIjJHv11rT1J52VRLr1pyFaGuApN80nFCMYcRbvxIfOMfaSxbi4JtO/3jjifI96AC5e8xOCVoon8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718610070; c=relaxed/simple; bh=6fjH5+2JhBPufwYdBrMxQDSsZf/nxe3KJGcBk5Ezhkc=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=aJYvIihCDIMu+x0ds61MRgKTWPRBxu899GFB09geug3cZt8sFT7C+mFSLha9ibsNZP7GQtRJjya6/kSn5byY0f7+2/JnglBUCAyaS1dJ4nwdnWSsUHew5X6UR8dMmaoy0jtDhsvcBMkY/eUc8qQFxBGF0jMRXCvcrZfV1AFsK4E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nsv0LF/G; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nsv0LF/G" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6A7EC2BD10; Mon, 17 Jun 2024 07:41:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718610069; bh=6fjH5+2JhBPufwYdBrMxQDSsZf/nxe3KJGcBk5Ezhkc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nsv0LF/GFpgY/pRBcbkxLmyR1g1fwMIdIGJaLsL2g8c+CfHSj69vnY4zknfKNxe3l U14QXZsflSOVucEVMbM4yftigMouJHfSxgqjPplx9g2E28FvTn79fU3AEPRwmvExm+ ArEzC08FlVwZcNkgEdO6YVkOzdLT1jbZE/Z/mW1lGL6CdjPnd/G4V0cqFpaXMAt+gt xCSGbV0Q0iwaaLuEjv/nxT4f2Wj6/az/JFG4vdbuj2+IvOCHRyO5Z8rIvKDcjsDMXr kK1CpArdycQRz1yDT8H47XiWhT0fPbhTzCopNinn1VBwfkaqMH8G0KBw5uW/XHG1ky NYQLWsVFROEhQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.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 1sJ6zD-004VaC-4P; Mon, 17 Jun 2024 08:41:07 +0100 Date: Mon, 17 Jun 2024 08:41:06 +0100 Message-ID: <86jzioj9t9.wl-maz@kernel.org> From: Marc Zyngier To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, Mark Brown , James Clark , Rob Herring , Suzuki Poulose , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , linux-perf-users@vger.kernel.org, Oliver Upton , James Morse , kvmarm@lists.linux.dev Subject: Re: [PATCH V18 2/9] KVM: arm64: Explicitly handle BRBE traps as UNDEFINED In-Reply-To: References: <20240613061731.3109448-1-anshuman.khandual@arm.com> <20240613061731.3109448-3-anshuman.khandual@arm.com> <86sexfk8ke.wl-maz@kernel.org> <86r0czk6wd.wl-maz@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/29.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: anshuman.khandual@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, broonie@kernel.org, james.clark@arm.com, robh@kernel.org, suzuki.poulose@arm.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, linux-perf-users@vger.kernel.org, oliver.upton@linux.dev, james.morse@arm.com, kvmarm@lists.linux.dev X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Mon, 17 Jun 2024 07:27:13 +0100, Anshuman Khandual wrote: > On 6/14/24 18:39, Marc Zyngier wrote: > > On Fri, 14 Jun 2024 13:33:37 +0100, > > > > Actually, to disable the *instructions*, a similar hack must be > > applied to HFGITR_EL2. The resulting patch should be something like: > > > > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c > > index ee33f5467ce5..49d86dae8d80 100644 > > --- a/arch/arm64/kvm/sys_regs.c > > +++ b/arch/arm64/kvm/sys_regs.c > > @@ -4964,6 +4964,15 @@ void kvm_init_sysreg(struct kvm_vcpu *vcpu) > > kvm->arch.fgu[HAFGRTR_GROUP] |= ~(HAFGRTR_EL2_RES0 | > > HAFGRTR_EL2_RES1); > > > > + if (!kvm_has_feat(kvm, ID_AA64DFR0_EL1, BRBE, IMP)) { > > + kvm->arch.fgu[HDFGRTR_GROUP] |= (HDFGRTR_nBRBDATA | > > + HDFGRTR_nBRBCTL | > > + HDFGRTR_nBRBIDR); Obviously, this needs to be spelled HDFGRTR_EL2_nBRB* so that it actually compiles. > > + kvm->arch.fgu[HFGITR_GROUP] |= (HFGITR_EL2_nBRBINJ | > > + HFGITR_EL2_nBRBIALL); > > + } > > + > > + > > set_bit(KVM_ARCH_FLAG_FGU_INITIALIZED, &kvm->arch.flags); > > out: > > mutex_unlock(&kvm->arch.config_lock); > > This makes sense, will remove all the changes to sys_reg table and > instead fold the above suggestion into the patch. > > > > > The implicit dependency here is that FGT is always present on a system > > that implements BRBE. The architecture supports this assertion: > > > > - BRBE is not available before ARMv9.1 > > - FGT is mandatory from ARMv8.6 > > > > Given that v9.1 is congruent to v8.6, we have the required overlap. > > So this overlap need not be asserted in software again ? I don't think there's a need for that. We went through the same thing with SME (which has the exact same dependency), and concluded that there was no need to paper over broken implementations at the moment (only QEMU was affected, and that was quickly fixed). If we find an implementation in the wild that didn't get the memo, we can add a workaround at that time. M. -- Without deviation from the norm, progress is not possible.