From patchwork Sun Apr 23 17:09:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9695009 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 4B13760245 for ; Sun, 23 Apr 2017 17:12:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34ED020564 for ; Sun, 23 Apr 2017 17:12:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29C04212BE; Sun, 23 Apr 2017 17:12:29 +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 B9B8920564 for ; Sun, 23 Apr 2017 17:12:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163322AbdDWRM0 (ORCPT ); Sun, 23 Apr 2017 13:12:26 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:36749 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162785AbdDWRKa (ORCPT ); Sun, 23 Apr 2017 13:10:30 -0400 Received: by mail-wm0-f47.google.com with SMTP id u65so7506944wmu.1 for ; Sun, 23 Apr 2017 10:10:29 -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=SgWmLiSMOa5KYNgiX9OqTXAADwkmMCMmtlV/Oo4IF2c=; b=a4yZtn/dcA4yaJeCvS1/I0C3hYH1OUqgY6qNkm0fgMQbvK605czUDTqgELBk+o5PjY GRBjE5zecv8UIFO84c+sVVxwbILA2YTJgsxJu4oRSRLIwvIntn2qblHyrOSjsABAyZx5 nkTQ/HB3+Zf6TVk3yV+tBKGOIMW1n9xFg0WrQ= 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=SgWmLiSMOa5KYNgiX9OqTXAADwkmMCMmtlV/Oo4IF2c=; b=gRz0RaO4YUQ6tphk14VU9iNKlSAb+r7YozSB2VfohoVx/7vIrFlPL8P8Gsz6u8BwoB vCcdI2r9nwaOXtM4fEKcA80VMMlzX/7USWQJ8LI2sn+e3azrbcL6IY1D/gPUamz05tbN XEx4a75C9Iw2U9e4E5dZzl2nGushcbHYGBFpeO2+i/kzagHBjU66nGYuFcBqkr+jXVP0 c+e3WQm+BqUajnGuxxnJTP6sUNZWw4uTpZ6eAc6UUs9m3qy4EkuVAzQAb7w0+ypOJORc c5RotLn4WtRnOVB3Z7GAMbgvouwiPiC4i4C5iz8hMWRCMMxP04Q/DG6dayiV+c3F675j gXig== X-Gm-Message-State: AN3rC/58jHId9g9L9GrniyMseBInz7v1VQ5OXAZJzhpHJz2wqeumNcPJ DVmC4m1Lbb5iJ7t4 X-Received: by 10.28.146.207 with SMTP id u198mr6571440wmd.103.1492967428927; Sun, 23 Apr 2017 10:10:28 -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.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Apr 2017 10:10:28 -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 54/79] ARM: hyp-stub: Implement HVC_RESET_VECTORS stub hypercall Date: Sun, 23 Apr 2017 19:09:04 +0200 Message-Id: <20170423170929.27334-55-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 Let's define a new stub hypercall that resets the HYP configuration to its default: hyp-stub vectors, and MMU disabled. Of course, for the hyp-stub itself, this is a trivial no-op. Hypervisors will have a bit more work to do. Tested-by: Keerthy Acked-by: Russell King Acked-by: Catalin Marinas Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- arch/arm/include/asm/virt.h | 3 +++ arch/arm/kernel/hyp-stub.S | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/virt.h b/arch/arm/include/asm/virt.h index c16f70d..c5a2757 100644 --- a/arch/arm/include/asm/virt.h +++ b/arch/arm/include/asm/virt.h @@ -101,6 +101,9 @@ extern char __hyp_text_end[]; #define HVC_GET_VECTORS 0 #define HVC_SET_VECTORS 1 #define HVC_SOFT_RESTART 2 +#define HVC_RESET_VECTORS 3 + +#define HVC_STUB_HCALL_NR 4 #endif /* __ASSEMBLY__ */ diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S index b20ca88..e637854 100644 --- a/arch/arm/kernel/hyp-stub.S +++ b/arch/arm/kernel/hyp-stub.S @@ -216,7 +216,10 @@ __hyp_stub_do_trap: bne 1f bx r1 -1: ldr r0, =HVC_STUB_ERR +1: teq r0, #HVC_RESET_VECTORS + beq __hyp_stub_exit + + ldr r0, =HVC_STUB_ERR __hyp_stub_exit: __ERET @@ -264,6 +267,12 @@ ENTRY(__hyp_soft_restart) ret lr ENDPROC(__hyp_soft_restart) +ENTRY(__hyp_reset_vectors) + mov r0, #HVC_RESET_VECTORS + __HVC(0) + ret lr +ENDPROC(__hyp_reset_vectors) + #ifndef ZIMAGE .align 2 .L__boot_cpu_mode_offset: