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: 9694977 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 92C2360245 for ; Sun, 23 Apr 2017 17:11:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7BB9826530 for ; Sun, 23 Apr 2017 17:11:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70998265B9; Sun, 23 Apr 2017 17:11:49 +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=ham 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 1145C26530 for ; Sun, 23 Apr 2017 17:11:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163237AbdDWRLs (ORCPT ); Sun, 23 Apr 2017 13:11:48 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:36714 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162695AbdDWRKR (ORCPT ); Sun, 23 Apr 2017 13:10:17 -0400 Received: by mail-wm0-f48.google.com with SMTP id u65so7505177wmu.1 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=GW3I1xW3WMXbLxPitf5LbLEJNBJhEic6y3VnhuNWqMRC/qIPzgq3Ml2FV5fFPMjPZR 6CkGJkT8bt8LgpHll0weXUJq6dm0ilSb5e2ZA/AMN9Srhnd66jWOeQVmiZ7twvPpTiGW PK4XF7rJeX7HXF7/WbY8S3DTSOmRngCkMJL19eibP2SASg8dikT04uxBEbukDe3RUttS 0EWsNs5Sg+ER0e24/jXhsZu0z91oPqHLf06uzXaeVWAuJ8I5JCJTK9z4Dd6phNlQCXFp r1VWqTO8u31htyxqzVAcg09wkEx3MWp2GDNEAqcyyRIAXJbzfM0A4PgnJFzGAL/1+AEi pQ2w== X-Gm-Message-State: AN3rC/4hJ5MtfiJsrDe4UMxCS/GKtZFsHfppbBuiLzSDMvnp+/3e9asG VghMKEOYei4EDi2d 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?= Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Christoffer Dall 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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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