From patchwork Tue Jul 18 16:58:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jintack Lim X-Patchwork-Id: 9849061 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CDCD9600CC for ; Tue, 18 Jul 2017 17:07:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B392723B34 for ; Tue, 18 Jul 2017 17:07:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A83D2285C2; Tue, 18 Jul 2017 17:07:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CAA923B34 for ; Tue, 18 Jul 2017 17:07:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752380AbdGRRHP (ORCPT ); Tue, 18 Jul 2017 13:07:15 -0400 Received: from mail-it0-f42.google.com ([209.85.214.42]:35893 "EHLO mail-it0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752295AbdGRRAP (ORCPT ); Tue, 18 Jul 2017 13:00:15 -0400 Received: by mail-it0-f42.google.com with SMTP id a62so23798314itd.1 for ; Tue, 18 Jul 2017 10:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZRWx2Swikq8DPW+kJomamLkrE5+EYLN8kUpHckOCxwI=; b=S8KJDMp+iiFyPkWxVXRYUaiRmv7JSoYexcpWhR02CpeaV8zjAQ1TPVL+5cPomXa9El RcspmzgKfvXz2rr4+67bdaEEmEXFPKOyUI2GZtLruJTp7o0YZGFdfez2N/yK0paZa7Uo 1gtjz7yDxTXCnO/Nbn40ZTTPUAsAmOYrypngA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZRWx2Swikq8DPW+kJomamLkrE5+EYLN8kUpHckOCxwI=; b=VGJ6sUH6c3+eG8uE2dc7cj92QRRTDKZUzflYllRAiaEEJw1blviywcSf8gyi4wlZ8D PUXfisdygIGPyKlrH1czmxaKtER+nnbXx1BrjnNGjRiPkMcuDAlk24EEZQ16y5RjP3WB 8xG1kj99A5lB+GYBDczpivhHRTKt0+gja/k6PAnqbJ/uikPZ/z+Vv14UxmjKm8lq3Sj2 DnEe3XoKO+MsssFmp+5mi+xwULLH9fl7nodmcXdhtN8kQ4upwuQHO1yA7e2lEhQw2zZJ /svo9anXb6j4xy6Nk7636CG5rH1NbvahDN64MQFzuzb0NTbvglMJC74Bo4uN2OEBaU8U 1uCg== X-Gm-Message-State: AIVw1115f2UobrnqZtWDUCpAYZQ8gR9PtgeHaz8u9877woYM5voHdmYx hinZUOKWoM49hqHe X-Received: by 10.36.71.79 with SMTP id t76mr3144313itb.118.1500397214377; Tue, 18 Jul 2017 10:00:14 -0700 (PDT) Received: from node.jintackl-qv26972.kvmarm-pg0.wisc.cloudlab.us (c220g1-030822.wisc.cloudlab.us. [128.104.222.82]) by smtp.gmail.com with ESMTPSA id j96sm1413075ioo.49.2017.07.18.10.00.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Jul 2017 10:00:13 -0700 (PDT) From: Jintack Lim To: kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, marc.zyngier@arm.com Cc: corbet@lwn.net, pbonzini@redhat.com, rkrcmar@redhat.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, akpm@linux-foundation.org, mchehab@kernel.org, cov@codeaurora.org, daniel.lezcano@linaro.org, david.daney@cavium.com, mark.rutland@arm.com, suzuki.poulose@arm.com, stefan@hello-penguin.com, andy.gross@linaro.org, wcohen@redhat.com, ard.biesheuvel@linaro.org, shankerd@codeaurora.org, vladimir.murzin@arm.com, james.morse@arm.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jintack Lim Subject: [RFC PATCH v2 23/38] KVM: arm64: Inject HVC exceptions to the virtual EL2 Date: Tue, 18 Jul 2017 11:58:49 -0500 Message-Id: <1500397144-16232-24-git-send-email-jintack.lim@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1500397144-16232-1-git-send-email-jintack.lim@linaro.org> References: <1500397144-16232-1-git-send-email-jintack.lim@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that the psci call is done by the smc instruction 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. Signed-off-by: Jintack Lim --- arch/arm64/kvm/handle_exit.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c index 6cf6b93..8b398b2 100644 --- a/arch/arm64/kvm/handle_exit.c +++ b/arch/arm64/kvm/handle_exit.c @@ -42,6 +42,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; + } + ret = kvm_psci_call(vcpu); if (ret < 0) { kvm_inject_undefined(vcpu);