From patchwork Tue Mar 21 19:20:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 9637425 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 32051601E9 for ; Tue, 21 Mar 2017 19:24:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20AA727D29 for ; Tue, 21 Mar 2017 19:24:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 154F128417; Tue, 21 Mar 2017 19:24: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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 996A927D29 for ; Tue, 21 Mar 2017 19:24:16 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=L9u8cJXuGr6Xx3vwkNcM3eDWHDwLu2brp8NiXh+bfN0=; b=piWDBF/yYKNhnHxZsEG+iMR+KM NzBGseN3omXMEariws4pkt/hWlPAuZVVc8RIaNhzwTMfcLXOaP5KloRKjRJe05fZ7U1zJpgqJ/epO O/eSjjXFYineU0d/xWCeXdngDqaOzqBs4cNKP6tQdLQa8SC3+dn5HIkWqzNSw6MX4aJEGc5hoxfLg rqqaxtDA8h/G6f2P521d73spqZi/Fa9Wz0HIcbNjC/BakAFKco11dYTKTSGv3IfDYNe/nvuMcJlQu 1gbHVZ2W3S0rUIv2Cc1tGAq756p7/DSRDrgkFsKO7/VR0iilzI5fdv1NQrHustjys0UPCVKJoM8mQ Hycrow/A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqPO7-0004lw-7Z; Tue, 21 Mar 2017 19:24:11 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqPMS-00031r-7G for linux-arm-kernel@lists.infradead.org; Tue, 21 Mar 2017 19:22:38 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8087F1596; Tue, 21 Mar 2017 12:21:56 -0700 (PDT) Received: from approximate.cambridge.arm.com (approximate.cambridge.arm.com [10.1.207.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E99673F2E5; Tue, 21 Mar 2017 12:21:54 -0700 (PDT) From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH v4 05/28] arm64: KVM: Implement HVC_RESET_VECTORS stub hypercall in the init code Date: Tue, 21 Mar 2017 19:20:35 +0000 Message-Id: <20170321192058.9300-6-marc.zyngier@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170321192058.9300-1-marc.zyngier@arm.com> References: <20170321192058.9300-1-marc.zyngier@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170321_122228_683038_2C96EB3D X-CRM114-Status: UNSURE ( 8.33 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Russell King , Ard Biesheuvel , Catalin Marinas , James Morse , Keerthy , Christoffer Dall MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Reviewed-by: James Morse 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..6cf98ccd10f2 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 x0, #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