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: 9695205 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 BB266602A7 for ; Sun, 23 Apr 2017 17:42:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB67A25EF7 for ; Sun, 23 Apr 2017 17:42:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADE2526530; Sun, 23 Apr 2017 17:42:41 +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 45E6D25EF7 for ; Sun, 23 Apr 2017 17:42:41 +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=MDki4SL2NzaafkHHDe1ibi7ZQECFa2xv7bmQYzgv8WU=; b=S6/eYIaNH7av219OgU+ahSZSJZ HlluqEf5L2u4L0h4Yifn8mJPtGPDMos6dJ/ybOIqX4HhU03jVP2LxmR3N1Sn59YMT2SpbFUJa+XXk GEkZLNH/h6h0oj7MIPwVy3mnzvXp3HCdENpqRLhqhSWPLcYlBqxoLo/sEZF3N+UOk+21R+JIL8rOA dONE2fsxE6+4/0qZ3PasKHjtgj0YGUUrGOMEE8DO8QbhxXiyrkJ6mF/ZDRZfWox/R0U/XYkYwMDk7 EUA27MO6kMxKnuosxP8Mx0XBTIfUYqE2dyUjY5CKgRrxmGVTj6dgzf2zo5Ct1QB34rmYACWivzYUM +YnXaXVQ==; 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 1d2LWr-00067u-I4; Sun, 23 Apr 2017 17:42:33 +0000 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d2LWi-000652-R4 for linux-arm-kernel@lists.infradead.org; Sun, 23 Apr 2017 17:42:30 +0000 Received: by mail-wm0-x234.google.com with SMTP id r190so50770562wme.1 for ; Sun, 23 Apr 2017 10:42:04 -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=lGmuchohgS0VB7/6OYrNSXJQxn9TdIqZKzCvCW7xRZcBe0Hrg0o3lxM6Ikh0066Awu 3t6KtOMRQfvohorfxaGOMOLvz2XYrSGRyPL3LzCxcTUfEbVKZo6Et1W9eRj0fo/E2Bol q5Agv9X8ROH/1+bITFZpqVLe89qQJ4T+kE0q7Y9w+fF3DEi+WiAUC3BZZa/TYCkzku2Z L62WAURG1OBh/CApJ7TXM3CzDVeJ/5XeJyjCAxKfMHomVsCTspa5mI2CC/pRIm1pMYxk gZTTpnO7qVBvWhtFYo6dudp62NXmIgfeMlbih/LKHyVnyuZsCUMZ8YY8ic8zYTgROTg/ dYHQ== X-Gm-Message-State: AN3rC/7qRW+F31rMp2RkfFhUAu9X2Kzm7O6l7oZkIYp4nb1BMPHI0I4k NFLHnZaUU4hEd9xgBGaqlw== 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?= 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170423_104225_064776_BC2A026D X-CRM114-Status: GOOD ( 11.15 ) 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: Christoffer Dall , kvm@vger.kernel.org, Marc Zyngier , Russell King , kvmarm@lists.cs.columbia.edu, 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: 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)