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 0815EC433EF for ; Tue, 18 Jan 2022 16:36:37 +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=0rw0DgqJOhhJC4B7uHRWZjpXrD7cneyseYuv0wKe5zM=; b=pqeu8JUztCK6/6 IBl30VKnxnHW45AnQZL69lPEm3chzXxgPjCEhvfayySj16Bj26fklJx7EmhlhiiCg8LiHSiEnO/Cw +oMN2vBP8cMbL+8vncLZX/Aw/SvsHduC20Wz2aA38ChzbrMfNIVbGOuqMNeycLGTTk0MjX7KkhBfg cYYZ6gfz7pLQWrq0DqZ2c3bt7y78vZKCVCSGeM/X9GIjfHfuP6GBqh26ChP7tzvdJeSDHxS6QFZCk l86vkMZkXKSNXkEsS3fjdrzEEokaE9TDuYTpWtHwWj0SNHSdHXQs4z8LKDKRq41K+t+cIR0UGRwCm ecA1kzzzlTKD/XUVFQPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9rS9-002FQs-DH; Tue, 18 Jan 2022 16:35:25 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9rS5-002FPu-LB for linux-arm-kernel@lists.infradead.org; Tue, 18 Jan 2022 16:35:23 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2D7011FB; Tue, 18 Jan 2022 08:35:20 -0800 (PST) Received: from monolith.localdoman (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 066513F774; Tue, 18 Jan 2022 08:35:17 -0800 (PST) Date: Tue, 18 Jan 2022 16:35:26 +0000 From: Alexandru Elisei To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Andre Przywara , Christoffer Dall , Jintack Lim , Haibo Xu , Ganapatrao Kulkarni , James Morse , Suzuki K Poulose , kernel-team@android.com Subject: Re: [PATCH v5 15/69] KVM: arm64: nv: Inject HVC exceptions to the virtual EL2 Message-ID: References: <20211129200150.351436-1-maz@kernel.org> <20211129200150.351436-16-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211129200150.351436-16-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220118_083521_762077_34DC74C6 X-CRM114-Status: GOOD ( 19.19 ) 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 Hi Marc, On Mon, Nov 29, 2021 at 08:00:56PM +0000, Marc Zyngier wrote: > From: Jintack Lim > > As we expect all PSCI calls from the L1 hypervisor to be performed > using SMC when nested virtualization is enabled, it is clear that > all HVC instruction from the VM (including from the virtual EL2) > are supposed to handled in the virtual EL2. > > Forward these to EL2 as required. > > Signed-off-by: Jintack Lim > [maz: add handling of HCR_EL2.HCD] > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/handle_exit.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c > index 275a27368a04..1fd1c6dfd6a0 100644 > --- a/arch/arm64/kvm/handle_exit.c > +++ b/arch/arm64/kvm/handle_exit.c > @@ -16,6 +16,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -40,6 +41,16 @@ static int handle_hvc(struct kvm_vcpu *vcpu) > kvm_vcpu_hvc_get_imm(vcpu)); > vcpu->stat.hvc_exit_stat++; > > + /* Forward hvc instructions to the virtual EL2 if the guest has EL2. */ > + if (nested_virt_in_use(vcpu)) { > + if (vcpu_read_sys_reg(vcpu, HCR_EL2) & HCR_HCD) > + kvm_inject_undefined(vcpu); > + else > + kvm_inject_nested_sync(vcpu, kvm_vcpu_get_esr(vcpu)); > + > + return 1; > + } Looks good to me: Reviewed-by: Alexandru Elisei Thanks, Alex > + > ret = kvm_hvc_call_handler(vcpu); > if (ret < 0) { > vcpu_set_reg(vcpu, 0, ~0UL); > -- > 2.30.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel