From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc Zyngier Subject: [PATCH 02/20] arm64: KVM: Implement HVC_RESET_VECTORS stub hypercall Date: Fri, 17 Feb 2017 15:44:11 +0000 Message-ID: <20170217154429.5000-3-marc.zyngier@arm.com> References: <20170217154429.5000-1-marc.zyngier@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id AB3FD40D5E for ; Fri, 17 Feb 2017 10:44:24 -0500 (EST) 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 7uhjEQMrrytK for ; Fri, 17 Feb 2017 10:44:24 -0500 (EST) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 057A240C9A for ; Fri, 17 Feb 2017 10:44:24 -0500 (EST) In-Reply-To: <20170217154429.5000-1-marc.zyngier@arm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu To: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu Cc: Catalin Marinas , Russell King List-Id: kvmarm@lists.cs.columbia.edu In order to restore HYP mode to its original condition, KVM currently implements __kvm_hyp_reset(). As we're moving towards a hyp-stub defined API, it becomes necessary to implement HVC_RESET_VECTORS. This patch adds the HVC_RESET_VECTORS hypercall to the KVM init code, which so far lacked any form of hypercall support. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp-init.S | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S index 6b29d3d9e1f2..948f331c7f32 100644 --- a/arch/arm64/kvm/hyp-init.S +++ b/arch/arm64/kvm/hyp-init.S @@ -22,6 +22,7 @@ #include #include #include +#include .text .pushsection .hyp.idmap.text, "ax" @@ -58,6 +59,9 @@ __invalid: * x2: HYP vectors */ __do_hyp_init: + /* Check for a stub HVC call */ + cmp x2, #HVC_STUB_HCALL_NR + b.lo __kvm_handle_stub_hvc msr ttbr0_el2, x0 @@ -119,6 +123,9 @@ __do_hyp_init: eret ENDPROC(__kvm_hyp_init) +ENTRY(__kvm_handle_stub_hvc) + cmp x0, #HVC_RESET_VECTORS + b.ne 1f /* * Reset kvm back to the hyp stub. */ @@ -133,9 +140,14 @@ ENTRY(__kvm_hyp_reset) /* Install stub vectors */ adr_l x0, __hyp_stub_vectors msr vbar_el2, x0 + b exit +1: mov x0, #-1 + +exit: eret ENDPROC(__kvm_hyp_reset) +ENDPROC(__kvm_handle_stub_hvc) .ltorg -- 2.11.0