From patchwork Sun Apr 23 17:08:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9694993 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 66D1960245 for ; Sun, 23 Apr 2017 17:12:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 500BE20564 for ; Sun, 23 Apr 2017 17:12:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4380E26530; Sun, 23 Apr 2017 17:12:09 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 A21BF20564 for ; Sun, 23 Apr 2017 17:12:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163284AbdDWRMH (ORCPT ); Sun, 23 Apr 2017 13:12:07 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:37887 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162743AbdDWRKX (ORCPT ); Sun, 23 Apr 2017 13:10:23 -0400 Received: by mail-wm0-f51.google.com with SMTP id m123so50340217wma.0 for ; Sun, 23 Apr 2017 10:10:21 -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=ahW6nGPJoFX9HFJK/039UsLxf/PVpvIE+VN5GtLm7Tk=; b=KhXttKsspuvAGmhTk7H/0GQ6Yb3XZrotGzTeBS0xaYIgi/KLHL4xuuHJFJHmHDAGX/ NjWxKOUoD1CwB/iTtXBdBBIpxJ7p9o8VO7CL6TvGqzL4jitPHP+J1KJrhdOrF+eJfP/B mLgxfBY+p+/kAB0kB6xbXnrGts9mm3JVUw/Ek= 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=ahW6nGPJoFX9HFJK/039UsLxf/PVpvIE+VN5GtLm7Tk=; b=VuNvFjxZ9PF6eeuAn12+sgClO276Nh0ja4R87j1a0WD4LVc0si5dJiGFvYW/XC/JX8 ZnJ3334BDibBQx8WCvgL+vmIk07CdR0ZGFOaHtyODzAhgZiMShuoLyuy5sGB6JMUp33K FSCUV0bjJN+jjU00jTgPclfM9kAk91lmrZikTUZOJd3tiCJo/FXwZzUlFBYvxowCiGRG /vMIpqNm+HPVareHX/ZAFRvhvgXXTYfOywC1D7xV1ikt7YwHfdncF9QIEWyzQ0tBSsXn LlUvqzn3326uXfNUeNPVdxV1MokmE2lgvzV0TD5ZLtq4+W/N+Vtx4T1ljTleBADC/SGF pGXQ== X-Gm-Message-State: AN3rC/7IHY/LOt8P+C7a5Z302olacfpbtiuX8JvdbpOXm0AgkSgOGIW6 3GQWH9Oe3eN3RfHL X-Received: by 10.28.129.201 with SMTP id c192mr6644509wmd.22.1492967421010; Sun, 23 Apr 2017 10:10:21 -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.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Apr 2017 10:10:20 -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, Russell King , Christoffer Dall Subject: [PULL 47/79] ARM: hyp-stub: improve ABI Date: Sun, 23 Apr 2017 19:08:57 +0200 Message-Id: <20170423170929.27334-48-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: 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. Tested-by: Keerthy Acked-by: Catalin Marinas Signed-off-by: Russell King Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- 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 15d073a..f3e9ba5 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)