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 25387C4828F for ; Wed, 7 Feb 2024 11:09:32 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hHXLDsfee3fcenj4oNU8ooevEGhG3yQGbhLn89lGNY8=; b=RCvYdLH4/NxEXu kyKtCcgBFbIs7xSTDbxtin8tKsy7CWI1Q1jOWbHcwijtMwEPj+zp3BKc6TdZFwOJ7Sp29KZfPJVds dfOLXne2YmAlPE2ChN4n1Ny6fVyua0oRH/sUBRqxMZ48vej4211l0KoGtaW02eF+pT7MP1zc61oKF F89faJh4eteteVRMhMGRmlgLKtVvypjrziI6cgLCGkvTRZaGFY+FJH3Ca33Nyq9lVQylJ3VuaW2pi Ugo51udTOWAgOgWh230DV2bqo9bdE1ebSOwXuntNlgcnV8c79VIx7pi5XgHgKn9Vyuk/w/FtMskHC hpU5R5aA/Kz1v360JRIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXfns-0000000ARLd-3Q0e; Wed, 07 Feb 2024 11:09:20 +0000 Received: from out-179.mta1.migadu.com ([2001:41d0:203:375::b3]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXfnp-0000000ARJ7-2Win for linux-arm-kernel@lists.infradead.org; Wed, 07 Feb 2024 11:09:19 +0000 Date: Wed, 7 Feb 2024 11:09:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707304151; 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=9PKbDme2EtSnW8TSyhiEojEXsG/9UfsSaPW9I6BBZa0=; b=QOuUVFYv7IsVjrFFS/dAvc67P6nAORyhWM617B06BniVBCpH9g/ssPUIBe8lhRUAVsElnF cCzZhFwfp7zFL8nm07k1Td+yogqJiAGGrVcsVVW6XWF28Pu8gdqMiiu0O4V8gNWjY0mvfc jwmf+14Hz+FoFlu2yIHT0Q+HFVsxOmQ= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Joey Gouly , Mark Brown Subject: Re: [PATCH v3 05/26] KVM: arm64: nv: Add sanitising to VNCR-backed FGT sysregs Message-ID: References: <20240205103431.1104133-1-maz@kernel.org> <20240205103431.1104133-6-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240207_030917_905568_DD284DB1 X-CRM114-Status: GOOD ( 19.70 ) 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, Feb 07, 2024 at 10:57:49AM +0000, Oliver Upton wrote: > On Mon, Feb 05, 2024 at 10:34:10AM +0000, Marc Zyngier wrote: > > Fine Grained Traps are controlled by a whole bunch of features. > > Each one of them must be checked and the corresponding masks > > computed so that we don't let the guest apply traps it shouldn't > > be using. > > > > This takes care of HFG[IRW]TR_EL2, HDFG[RW]TR_EL2, and HAFGRTR_EL2. > > > > Signed-off-by: Marc Zyngier > > Reviewed-by: Joey Gouly > > --- > > arch/arm64/kvm/nested.c | 128 ++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 128 insertions(+) > > > > diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c > > index a8fe0f970e04..31c4ce0439d6 100644 > > --- a/arch/arm64/kvm/nested.c > > +++ b/arch/arm64/kvm/nested.c > > @@ -265,6 +265,134 @@ int kvm_init_nv_sysregs(struct kvm *kvm) > > res1 |= HCR_E2H; > > set_sysreg_masks(kvm, HCR_EL2, res0, res1); > > > > + /* HFG[RW]TR_EL2 */ > > + res0 = res1 = 0; > > + if (!(__vcpu_has_feature(&kvm->arch, KVM_ARM_VCPU_PTRAUTH_ADDRESS) && > > + __vcpu_has_feature(&kvm->arch, KVM_ARM_VCPU_PTRAUTH_ADDRESS))) > > Same thing here w/ the different flags. > > > + /* HDFG[RW]TR_EL2 */ > > + res0 = res1 = 0; > > + if (!kvm_has_feat(kvm, ID_AA64DFR0_EL1, DoubleLock, IMP)) > > + res0 |= HDFGRTR_EL2_OSDLR_EL1; > > + if (!kvm_has_feat(kvm, ID_AA64DFR0_EL1, PMUVer, IMP)) > > + res0 |= (HDFGRTR_EL2_PMEVCNTRn_EL0 | HDFGRTR_EL2_PMEVTYPERn_EL0 | > > + HDFGRTR_EL2_PMCCFILTR_EL0 | HDFGRTR_EL2_PMCCNTR_EL0 | > > + HDFGRTR_EL2_PMCNTEN | HDFGRTR_EL2_PMINTEN | > > + HDFGRTR_EL2_PMOVS | HDFGRTR_EL2_PMSELR_EL0 | > > + HDFGRTR_EL2_PMMIR_EL1 | HDFGRTR_EL2_PMUSERENR_EL0 | > > + HDFGRTR_EL2_PMCEIDn_EL0); > > I think you're missing HDFGWTR_EL2_PMSWINC_EL0 and HDFGWTR_EL2_PMCR_EL0 > here. Silly write-only and read-only registers... I can't read. Looks like you're doing this a few lines down. -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel