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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F55DC433F5 for ; Mon, 20 Dec 2021 09:39:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229887AbhLTJjM (ORCPT ); Mon, 20 Dec 2021 04:39:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229842AbhLTJjL (ORCPT ); Mon, 20 Dec 2021 04:39:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18EA2C061574 for ; Mon, 20 Dec 2021 01:39:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CDE91B80C8D for ; Mon, 20 Dec 2021 09:39:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A6BBC36AE8; Mon, 20 Dec 2021 09:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639993148; bh=8uqK3NceI45AFjqWjabQhkzy6OyB8l6tZbp7LghvIPU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RX8e5eMEk4RDyeQGulOkOgxMG4kHuZ26vU8V2tfRww7hqIdmjC3pEcL9wLxlw66qI 0/ld8agKowe1G0Dkk+4uCU6FQukTYi3brHqjQQGQGwyyOrRdBkUZ0I5ovUNFztuYJ6 xCLepJgI63eTJlODabNrOtGv6qwrw5ohKFbDEIjuLjJdSkY2qIHT2+hm40AzCYb6Xs HWeHaswpxhg94mxJART9fKnUrknTcW/hAcF/7/ugF30nVFlgKAJBgHpH7/Yt39GaUi 9LiGntmonRo3XZkrOjPpijKIuEFhxwd6UqBnDypTTiKvWThJRwrw1HBXT/KttDgfa4 ohzUY5iek5AVw== Received: from cfbb000407.r.cam.camfibre.uk ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mzF8M-00DFb8-LE; Mon, 20 Dec 2021 09:39:06 +0000 Date: Mon, 20 Dec 2021 09:39:06 +0000 Message-ID: <87ilvjwr7p.wl-maz@kernel.org> From: Marc Zyngier To: Ganapatrao Kulkarni Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Andre Przywara , Christoffer Dall , Jintack Lim , Haibo Xu , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: Re: [PATCH v5 31/69] KVM: arm64: nv: Respect the virtual HCR_EL2.NV1 bit setting In-Reply-To: References: <20211129200150.351436-1-maz@kernel.org> <20211129200150.351436-32-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/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) 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: gankulkarni@os.amperecomputing.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, andre.przywara@arm.com, christoffer.dall@arm.com, jintack@cs.columbia.edu, haibo.xu@linaro.org, james.morse@arm.com, suzuki.poulose@arm.com, alexandru.elisei@arm.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, 20 Dec 2021 07:18:51 +0000, Ganapatrao Kulkarni wrote: > > > > On 30-11-2021 01:31 am, Marc Zyngier wrote: > > From: Jintack Lim > > > > Forward ELR_EL1, SPSR_EL1 and VBAR_EL1 traps to the virtual EL2 if the > > virtual HCR_EL2.NV bit is set. > > > > This is for recursive nested virtualization. > > > > Signed-off-by: Jintack Lim > > Signed-off-by: Marc Zyngier > > --- > > arch/arm64/include/asm/kvm_arm.h | 1 + > > arch/arm64/kvm/sys_regs.c | 28 +++++++++++++++++++++++++++- > > 2 files changed, 28 insertions(+), 1 deletion(-) > > > > diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h > > index 9759bc893a51..68af5509e4b0 100644 > > --- a/arch/arm64/include/asm/kvm_arm.h > > +++ b/arch/arm64/include/asm/kvm_arm.h > > @@ -20,6 +20,7 @@ > > #define HCR_AMVOFFEN (UL(1) << 51) > > #define HCR_FIEN (UL(1) << 47) > > #define HCR_FWB (UL(1) << 46) > > +#define HCR_NV1 (UL(1) << 43) > > #define HCR_NV (UL(1) << 42) > > #define HCR_API (UL(1) << 41) > > #define HCR_APK (UL(1) << 40) > > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c > > index e96877fc3b2a..511e06b6f603 100644 > > --- a/arch/arm64/kvm/sys_regs.c > > +++ b/arch/arm64/kvm/sys_regs.c > > @@ -288,6 +288,22 @@ static bool access_rw(struct kvm_vcpu *vcpu, > > return true; > > } > > +/* This function is to support the recursive nested > > virtualization */ > > +static bool forward_nv1_traps(struct kvm_vcpu *vcpu, struct sys_reg_params *p) > > +{ > > + return forward_traps(vcpu, HCR_NV1); > > +} > > + > > Shall we move this helper to emulate-nested.c? Sure, that shouldn't be a problem. M. -- Without deviation from the norm, progress is not possible.