From patchwork Sun Apr 23 17:08:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9695087 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 2ED7660245 for ; Sun, 23 Apr 2017 17:16:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 133A226530 for ; Sun, 23 Apr 2017 17:16:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08183267EC; Sun, 23 Apr 2017 17:16:25 +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 8794726530 for ; Sun, 23 Apr 2017 17:16:24 +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=4V4veSALhuTmZOVFBvSInFptx9jxoyDg5wmRuwgRhcE=; b=hlKl0B4Jh0FDzKYH7Rpkcag5ui D/jW7RDlRt5ePEKAoL2Igoo3njSufC6b9egybyixHBbqizjdFhIp3SPFnPzOYD7tWuYpxYkC/wxKr qR98FUfH3eVydU0yw97dxijtNOGCUepkT+3op7E2W5C5bIxtOdlP/YpTSMPqX2nLMN9D2+TdFEmE4 0xXWMwkEAOo6iCzTl9LjOvYeIMAuLdsWE9x2BnNqY3kxqPWmyXE2tiBwJJnHkfu3CTzw6bY8ix4a1 ea7fVJEUkPnPFJMGFIN3n0/J2bXqzrhN9oaqneZ25strXinjrVbrbMuwPMvMTIxAwJMgQ1ChxD0lp 4oQimfNw==; 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 1d2L7X-000532-Sa; Sun, 23 Apr 2017 17:16:23 +0000 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d2L1u-00067x-1r for linux-arm-kernel@lists.infradead.org; Sun, 23 Apr 2017 17:10:36 +0000 Received: by mail-wm0-x22d.google.com with SMTP id w64so46376951wma.0 for ; Sun, 23 Apr 2017 10:10:16 -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=gTAbXJvbJxaEmKiG6wNQ8nRLnl3KceymtbjuxgVadZk=; b=gp9Xkgw4xfdi6OdkZqep9rU3WnT04emZaRcs0dV6oAnKYZk5YeADmq/sQzMa7web/0 UBlPe/fr0DI//FSz6wmMyU+VFEQN667Elcegtg338vCP1oqY+dpbphDk6FfwEtacK8nC HLu03pp4OYzUuc2tjcE/aQSX0F7nAYCRYeXAE= 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=gTAbXJvbJxaEmKiG6wNQ8nRLnl3KceymtbjuxgVadZk=; b=GzQ7gr34wpE6EP43AvqyTMiwJV+eJEUoNY+I+678zpJe5ziPbcNXtlTgBr5u3uIlLF zPfLJ8NCiucqWpUvnr3b3zoySZ9IgTIgAOev/GjBqcweFdvIHSU2d1+OlroskIqxuhbv yoT7C73wBnUhqdWbSNe/kBKsZREgS5lH1321x/lFuRM4hGJev33sEVvXvU7nYxE4hlMh 7SxV0Yz6ojjSpfJhovX1btUZqXsuTAilfAjxS2EDmH09+7nqETfa2Jg/BUWUD+AxkVga RQzenMd9Zbpsu/HYwJ8vo2vTfDmhCqmD8o3A7A1ezLtDqQu38pL5S1BHzX6vLpcRhtFy XwIQ== X-Gm-Message-State: AN3rC/5qbhUxNoeyOTOSB25HwrZHPX8aKf51EEci+04ojry/egl/t0Ks mLgipFCK6dzLFEId X-Received: by 10.80.142.93 with SMTP id 29mr134219edx.150.1492967415576; Sun, 23 Apr 2017 10:10:15 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id 58sm2803521edz.2.2017.04.23.10.10.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Apr 2017 10:10:14 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 42/79] arm64: KVM: Implement HVC_RESET_VECTORS stub hypercall in the init code Date: Sun, 23 Apr 2017 19:08:52 +0200 Message-Id: <20170423170929.27334-43-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170423170929.27334-1-cdall@linaro.org> References: <20170423170929.27334-1-cdall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170423_101034_269366_E51BE1D8 X-CRM114-Status: GOOD ( 10.19 ) 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: Marc Zyngier , Christoffer Dall , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 From: Marc Zyngier 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. Acked-by: Catalin Marinas Reviewed-by: James Morse Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- arch/arm64/kvm/hyp-init.S | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S index 6b29d3d..5e39ad5 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,15 @@ ENTRY(__kvm_hyp_reset) /* Install stub vectors */ adr_l x0, __hyp_stub_vectors msr vbar_el2, x0 + b exit +1: /* Bad stub call */ + ldr x0, =HVC_STUB_ERR + +exit: eret ENDPROC(__kvm_hyp_reset) +ENDPROC(__kvm_handle_stub_hvc) .ltorg