From patchwork Mon Mar 6 14:24:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 9606863 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 C5F6F60414 for ; Mon, 6 Mar 2017 14:44:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9BD525D9E for ; Mon, 6 Mar 2017 14:44:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE92226907; Mon, 6 Mar 2017 14:44:54 +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=-6.9 required=2.0 tests=BAYES_00,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 26F8625D9E for ; Mon, 6 Mar 2017 14:44:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932161AbdCFOov (ORCPT ); Mon, 6 Mar 2017 09:44:51 -0500 Received: from foss.arm.com ([217.140.101.70]:36194 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754627AbdCFOem (ORCPT ); Mon, 6 Mar 2017 09:34:42 -0500 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 70C6C1650; Mon, 6 Mar 2017 06:26:17 -0800 (PST) Received: from on-the-bus.cambridge.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3B0123F220; Mon, 6 Mar 2017 06:26:15 -0800 (PST) From: Marc Zyngier To: Russell King , Ard Biesheuvel , Catalin Marinas , cdall@linaro.org, james.morse@arm.com Cc: linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, Russell King Subject: [PATCH v3 07/25] ARM: hyp-stub: improve ABI Date: Mon, 6 Mar 2017 14:24:40 +0000 Message-Id: <20170306142458.8875-8-marc.zyngier@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170306142458.8875-1-marc.zyngier@arm.com> References: <20170306142458.8875-1-marc.zyngier@arm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Russell King Improve the hyp-stub ABI to allow it to do more than just get/set the vectors. We follow the example in ARM64, where r0 is used as an opcode with the other registers as an argument. Signed-off-by: Russell King Signed-off-by: Marc Zyngier --- arch/arm/kernel/hyp-stub.S | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S index 15d073ae5da2..f3e9ba5fb642 100644 --- a/arch/arm/kernel/hyp-stub.S +++ b/arch/arm/kernel/hyp-stub.S @@ -22,6 +22,9 @@ #include #include +#define HVC_GET_VECTORS 0 +#define HVC_SET_VECTORS 1 + #ifndef ZIMAGE /* * For the kernel proper, we need to find out the CPU boot mode long after @@ -202,9 +205,19 @@ ARM_BE8(orr r7, r7, #(1 << 25)) @ HSCTLR.EE ENDPROC(__hyp_stub_install_secondary) __hyp_stub_do_trap: - cmp r0, #-1 - mrceq p15, 4, r0, c12, c0, 0 @ get HVBAR - mcrne p15, 4, r0, c12, c0, 0 @ set HVBAR + teq r0, #HVC_GET_VECTORS + bne 1f + mrc p15, 4, r0, c12, c0, 0 @ get HVBAR + b __hyp_stub_exit + +1: teq r0, #HVC_SET_VECTORS + bne 1f + mcr p15, 4, r1, c12, c0, 0 @ set HVBAR + b __hyp_stub_exit + +1: mov r0, #-1 + +__hyp_stub_exit: __ERET ENDPROC(__hyp_stub_do_trap) @@ -231,10 +244,14 @@ ENDPROC(__hyp_stub_do_trap) * initialisation entry point. */ ENTRY(__hyp_get_vectors) - mov r0, #-1 + mov r0, #HVC_GET_VECTORS + __HVC(0) + ret lr ENDPROC(__hyp_get_vectors) - @ fall through + ENTRY(__hyp_set_vectors) + mov r1, r0 + mov r0, #HVC_SET_VECTORS __HVC(0) ret lr ENDPROC(__hyp_set_vectors)