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 X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B217C433FF for ; Tue, 30 Jul 2019 14:08:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E3E520651 for ; Tue, 30 Jul 2019 14:08:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729991AbfG3OIg (ORCPT ); Tue, 30 Jul 2019 10:08:36 -0400 Received: from foss.arm.com ([217.140.110.172]:33296 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729975AbfG3OIg (ORCPT ); Tue, 30 Jul 2019 10:08:36 -0400 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 E47AE28; Tue, 30 Jul 2019 07:08:35 -0700 (PDT) Received: from [10.1.196.217] (e121566-lin.cambridge.arm.com [10.1.196.217]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1FD2A3F694; Tue, 30 Jul 2019 07:08:35 -0700 (PDT) Subject: Re: [PATCH 11/59] KVM: arm64: nv: Inject HVC exceptions to the virtual EL2 From: Alexandru Elisei To: Marc Zyngier , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Cc: Andre Przywara , Dave Martin References: <20190621093843.220980-1-marc.zyngier@arm.com> <20190621093843.220980-12-marc.zyngier@arm.com> Message-ID: Date: Tue, 30 Jul 2019 15:08:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On 6/25/19 2:13 PM, Alexandru Elisei wrote: > On 6/21/19 10:37 AM, Marc Zyngier wrote: >> From: Jintack Lim >> >> Now that the psci call is done by the smc instruction when nested > This suggests that we have support for PSCI calls using SMC as the conduit, but > that is not the case, as the handle_smc function is not changed by this commit, > and support for PSCI via SMC is added later in patch 22/59 "KVM: arm64: nv: > Handle PSCI call via smc from the guest". Perhaps the commit message should be > reworded to reflect that? >> 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. >> >> Signed-off-by: Jintack Lim >> Signed-off-by: Marc Zyngier >> --- >> arch/arm64/kvm/handle_exit.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c >> index 516aead3c2a9..6c0ac52b34cc 100644 >> --- a/arch/arm64/kvm/handle_exit.c >> +++ b/arch/arm64/kvm/handle_exit.c >> @@ -30,6 +30,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> >> @@ -52,6 +53,12 @@ static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run) >> 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)) { >> + kvm_inject_nested_sync(vcpu, kvm_vcpu_get_hsr(vcpu)); >> + return 1; >> + } According to ARM DDI 0487E.a, when HCR_EL2.HCD = 1, HVC instructions are undefined at EL2 and EL1. Thanks, Alex >> + >> ret = kvm_hvc_call_handler(vcpu); >> if (ret < 0) { >> vcpu_set_reg(vcpu, 0, ~0UL); 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 X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1B99C0650F for ; Tue, 30 Jul 2019 14:08:41 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 7F1DC20651 for ; Tue, 30 Jul 2019 14:08:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F1DC20651 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id CA27E4A52B; Tue, 30 Jul 2019 10:08:40 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hHT8jF7yQzN9; Tue, 30 Jul 2019 10:08:39 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 84AF04A533; Tue, 30 Jul 2019 10:08:39 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id B83DA4A52B for ; Tue, 30 Jul 2019 10:08:37 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KqEIP6-oMz8L for ; Tue, 30 Jul 2019 10:08:36 -0400 (EDT) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 7DB334A51C for ; Tue, 30 Jul 2019 10:08:36 -0400 (EDT) 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 E47AE28; Tue, 30 Jul 2019 07:08:35 -0700 (PDT) Received: from [10.1.196.217] (e121566-lin.cambridge.arm.com [10.1.196.217]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1FD2A3F694; Tue, 30 Jul 2019 07:08:35 -0700 (PDT) Subject: Re: [PATCH 11/59] KVM: arm64: nv: Inject HVC exceptions to the virtual EL2 From: Alexandru Elisei To: Marc Zyngier , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org References: <20190621093843.220980-1-marc.zyngier@arm.com> <20190621093843.220980-12-marc.zyngier@arm.com> Message-ID: Date: Tue, 30 Jul 2019 15:08:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Cc: Andre Przywara , Dave Martin X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On 6/25/19 2:13 PM, Alexandru Elisei wrote: > On 6/21/19 10:37 AM, Marc Zyngier wrote: >> From: Jintack Lim >> >> Now that the psci call is done by the smc instruction when nested > This suggests that we have support for PSCI calls using SMC as the conduit, but > that is not the case, as the handle_smc function is not changed by this commit, > and support for PSCI via SMC is added later in patch 22/59 "KVM: arm64: nv: > Handle PSCI call via smc from the guest". Perhaps the commit message should be > reworded to reflect that? >> 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. >> >> Signed-off-by: Jintack Lim >> Signed-off-by: Marc Zyngier >> --- >> arch/arm64/kvm/handle_exit.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c >> index 516aead3c2a9..6c0ac52b34cc 100644 >> --- a/arch/arm64/kvm/handle_exit.c >> +++ b/arch/arm64/kvm/handle_exit.c >> @@ -30,6 +30,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> >> @@ -52,6 +53,12 @@ static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run) >> 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)) { >> + kvm_inject_nested_sync(vcpu, kvm_vcpu_get_hsr(vcpu)); >> + return 1; >> + } According to ARM DDI 0487E.a, when HCR_EL2.HCD = 1, HVC instructions are undefined at EL2 and EL1. Thanks, Alex >> + >> ret = kvm_hvc_call_handler(vcpu); >> if (ret < 0) { >> vcpu_set_reg(vcpu, 0, ~0UL); _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DD0EC433FF for ; Tue, 30 Jul 2019 14:08:44 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 51F2620651 for ; Tue, 30 Jul 2019 14:08:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="l+5JFuTv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51F2620651 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:References:To:From:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=g6b4IlObL/1ij6JmleGDRPm6tsBbD2cUyt0WlwXHWAk=; b=l+5JFuTvZ8LySm Y7xrh7oypCl0A/uLT3M4Te0rkbCWJIVy4Y7dO04ifd+puuxpg+qZezTDZ8q4Fn2itNg7wZTwv8pDt YnUoLYBO4HdnrWJkgnK05tg3Q/ugR+3DgNQhHFQchMAhM08coUxRq9Nba23Pjze6ftifwr1cQSUKM VEiBgSUkZIJZP7NY3E0i8VzRYedLFl24BOvaV4zhqnD7iEX7POkfIUrh1RFDXecubLDVCz+Qj5xKi B6NgL5KoLtu58aCSszvajw+K5POQAH3b3yiVMrL5EiHTl/P5bKrz6AS3ujdW74l7SR43CxMB3cZJK 7nDVNiScGk543QFZbCJQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hsSnx-0005Ar-Sw; Tue, 30 Jul 2019 14:08:41 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hsSnu-0005A6-NT for linux-arm-kernel@lists.infradead.org; Tue, 30 Jul 2019 14:08:40 +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 E47AE28; Tue, 30 Jul 2019 07:08:35 -0700 (PDT) Received: from [10.1.196.217] (e121566-lin.cambridge.arm.com [10.1.196.217]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1FD2A3F694; Tue, 30 Jul 2019 07:08:35 -0700 (PDT) Subject: Re: [PATCH 11/59] KVM: arm64: nv: Inject HVC exceptions to the virtual EL2 From: Alexandru Elisei To: Marc Zyngier , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org References: <20190621093843.220980-1-marc.zyngier@arm.com> <20190621093843.220980-12-marc.zyngier@arm.com> Message-ID: Date: Tue, 30 Jul 2019 15:08:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190730_070838_804136_78BBDE1E X-CRM114-Status: GOOD ( 16.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andre Przywara , Dave Martin Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 6/25/19 2:13 PM, Alexandru Elisei wrote: > On 6/21/19 10:37 AM, Marc Zyngier wrote: >> From: Jintack Lim >> >> Now that the psci call is done by the smc instruction when nested > This suggests that we have support for PSCI calls using SMC as the conduit, but > that is not the case, as the handle_smc function is not changed by this commit, > and support for PSCI via SMC is added later in patch 22/59 "KVM: arm64: nv: > Handle PSCI call via smc from the guest". Perhaps the commit message should be > reworded to reflect that? >> 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. >> >> Signed-off-by: Jintack Lim >> Signed-off-by: Marc Zyngier >> --- >> arch/arm64/kvm/handle_exit.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c >> index 516aead3c2a9..6c0ac52b34cc 100644 >> --- a/arch/arm64/kvm/handle_exit.c >> +++ b/arch/arm64/kvm/handle_exit.c >> @@ -30,6 +30,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> >> @@ -52,6 +53,12 @@ static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run) >> 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)) { >> + kvm_inject_nested_sync(vcpu, kvm_vcpu_get_hsr(vcpu)); >> + return 1; >> + } According to ARM DDI 0487E.a, when HCR_EL2.HCD = 1, HVC instructions are undefined at EL2 and EL1. Thanks, Alex >> + >> ret = kvm_hvc_call_handler(vcpu); >> if (ret < 0) { >> vcpu_set_reg(vcpu, 0, ~0UL); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel