From patchwork Sun Apr 23 17:09:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9695143 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 CEE26601E9 for ; Sun, 23 Apr 2017 17:25:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C630A203B9 for ; Sun, 23 Apr 2017 17:25:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB0AA262F2; Sun, 23 Apr 2017 17:25: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 47A2A203B9 for ; Sun, 23 Apr 2017 17:25: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=hEcf24SeyOkeGoH38wEHF3wievY/6bPYt8FtVyrJP54=; b=ArirQxqHQnN/XYa3KR1YYJQIER ZvR4WIZ/CNIvrJ+N1Iz45RMuiSCw3iGwu3TDpTGLapR8X4FXWr7nS3ItEpw9oFWmABEXFD53pyzEz Bwx67PmVTNxksOZvnvdfE7GEhExmA4HD06v2WgGTorufoY568WILtenw6daAqv2++NDyIo7Yn8Zlm eEqGGUWINfu3AATZMUxXVkb6TPObfXtJzAH76n0hKYjdhOWDSkdxwE0JEDAk9ETKx1VFEnzD8FI+B 0byEWFwC7zL3koddAquvYPv3Xni0zXWOa+hx5uj7Zg/wUMIudGGshKfHofmWwWXS9674LKqIvdREl 8L3j5saA==; 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 1d2LGW-0000TE-SL; Sun, 23 Apr 2017 17:25:40 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d2L9T-0007Cc-8j for linux-arm-kernel@lists.infradead.org; Sun, 23 Apr 2017 17:19:21 +0000 Received: by mail-wm0-x230.google.com with SMTP id i137so1955084wmf.0 for ; Sun, 23 Apr 2017 10:18:03 -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=oekz3yE/65nftmrMGt7n4KzkD2yYugvKTdyj21fN+7Y=; b=AIqBbxOuGyFYFXdLRvq0yA5oY7UaeW4LhLSI4Shyz5yrjWzAfXnIgmakupNXkmcw1c bQpyluNo22jLH7B5zQxWaoSX21o2+H7+iEx1WQQkToUAznzcsJJ1iplL1Fgmroq+NMrs iPRviGO5Rf8ADGC65uHADftMiz71EXQisFyvI= 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=oekz3yE/65nftmrMGt7n4KzkD2yYugvKTdyj21fN+7Y=; b=QB0N4G68eGk6hHsN39RU8bVM1SBha4YkFMUAKRah9sgxkkkYQHxgIIGknb2wiv/lhu n+kxN29TCjXqwRAJm1tPjQd9jUY3whiQsaci4eooWRs8Jx5mV85fH6bkDx7V1lQc1bbr jL9wCKjs1+vLRRj8V2JXXUsnVlahdH5EIoPyQ29CCtslvWQDhnO1SG5KaTGzlQBkG37i wUPC/GGr5mLo/4XD4HMWmaiFbpN4EZ2zTnT7VecS4oj8GCAk5aVgyK3jnbtIpPbXSpgY gfegk9Ouc4tM2fXP8Lv0rtMAfkHx0QL67P44Xjz3xWRLA+L+M36+s/iw4cNchmaZYDJB CB/g== X-Gm-Message-State: AN3rC/7zF1elZQpCLz0vlwHQTdhnbHJ4Z7yS4aplSWVVtzXpdyCBSFXx n++A6bb3MlySPo/j X-Received: by 10.80.166.197 with SMTP id f5mr123077edc.144.1492967439681; Sun, 23 Apr 2017 10:10:39 -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.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Apr 2017 10:10:39 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 64/79] ARM: decompressor: Remove __hyp_get_vectors usage Date: Sun, 23 Apr 2017 19:09:14 +0200 Message-Id: <20170423170929.27334-65-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_101824_271441_315BBA04 X-CRM114-Status: GOOD ( 12.04 ) 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: Marc Zyngier , Christoffer Dall , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, 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: Marc Zyngier When the compressed image needs to be relocated to avoid being overwritten by the decompression process, we need to relocate the hyp vectors as well so that we can find them once the decompression has taken effect. For that, we perform the following calculation: u32 v = __hyp_get_vectors(); v += offset; __hyp_set_vectors(v); But we're guaranteed that the initial value of v as returned by __hyp_get_vectors is always __hyp_stub_vectors, because we have just set it by calling __hyp_stub_install. So let's remove the use of __hyp_get_vectors, and directly use __hyp_stub_vectors instead. Acked-by: Russell King Acked-by: Catalin Marinas Signed-off-by: Marc Zyngier Signed-off-by: Christoffer Dall --- arch/arm/boot/compressed/head.S | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 9150f97..7c711ba 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -422,7 +422,17 @@ dtb_check_done: cmp r0, #HYP_MODE bne 1f - bl __hyp_get_vectors + /* + * Compute the address of the hyp vectors after relocation. + * This requires some arithmetic since we cannot directly + * reference __hyp_stub_vectors in a PC-relative way. + * Call __hyp_set_vectors with the new address so that we + * can HVC again after the copy. + */ +0: adr r0, 0b + movw r1, #:lower16:__hyp_stub_vectors - 0b + movt r1, #:upper16:__hyp_stub_vectors - 0b + add r0, r0, r1 sub r0, r0, r5 add r0, r0, r10 bl __hyp_set_vectors