From patchwork Mon Apr 4 14:52:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 65002 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp1232216lbc; Mon, 4 Apr 2016 07:54:10 -0700 (PDT) X-Received: by 10.66.235.129 with SMTP id um1mr53646890pac.17.1459781649350; Mon, 04 Apr 2016 07:54:09 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id x72si115145pfi.196.2016.04.04.07.54.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Apr 2016 07:54:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1an5sG-0005AT-St; Mon, 04 Apr 2016 14:53:04 +0000 Received: from mail-qg0-x233.google.com ([2607:f8b0:400d:c04::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1an5s5-00056e-Pw for linux-arm-kernel@lists.infradead.org; Mon, 04 Apr 2016 14:52:54 +0000 Received: by mail-qg0-x233.google.com with SMTP id y89so153217128qge.2 for ; Mon, 04 Apr 2016 07:52:33 -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=yP4gJ/6sDXTIAv9Ij4X/Kizdnvq4r2LuVvqLBs0OR7o=; b=RwIQN8G5urRe7ZmJcwD8lcdvTXKYu3qiAWA2ewPIy88Wm10FcoSo5Koc7/j6g4wNnX 9TJ10U8EioB6QjNOHuOJNytjCBcp6dRGXTehvVXK+eOPLv28uf43yZ/7XmEWoDfNZvjM ajaG9sWxoZMdlchbsETLnw/DdfoqKO67SbZg4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yP4gJ/6sDXTIAv9Ij4X/Kizdnvq4r2LuVvqLBs0OR7o=; b=W9+sOpmdnThUGeRsWSmrPAfiZUxTyasQFTVwIv9fCN5v+RiJxBrTFJC10SO8Ic9TCx 8C1Yv6pZPrHewZgaV0kMoyxxvM59HPGuNYL7nY9mp9F0fTgKj+MLJaSwodySzPUsaZ5t BuMnya6iRSEf1/wUg+Th3fVn0Ui+RaWIL7POR7CJ7ysSciIUeEoMnCq9fYgugw4JfYoE SjVwHNSjDNsIdZi/gvsdfYnhs5EpOToAOTSMh4Rw9WkKun/jRakmAoOSJwq5KMTkorqs M1FOdQOUfKOTnBOKXa2KtIoP8WXUNU2YgS0OX5hpZZkEo8uI00Nfoms6sW+HceEyuJWq KjpQ== X-Gm-Message-State: AD7BkJIsT/W9E0lwHJwye/oIuXJvTFPSnsmUcYFdT/yXX2wulC6zYlJf29775aZsVRFxS5Mt X-Received: by 10.194.93.42 with SMTP id cr10mr13278418wjb.33.1459781552503; Mon, 04 Apr 2016 07:52:32 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id cf6sm7922528wjc.12.2016.04.04.07.52.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Apr 2016 07:52:31 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, will.deacon@arm.com, catalin.marinas@arm.com, mark.rutland@arm.com Subject: [PATCH 1/8] arm64/kernel: use literal for relocated address of __secondary_switched Date: Mon, 4 Apr 2016 16:52:17 +0200 Message-Id: <1459781544-14310-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459781544-14310-1-git-send-email-ard.biesheuvel@linaro.org> References: <1459781544-14310-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160404_075253_931213_087E93A4 X-CRM114-Status: GOOD ( 14.75 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400d:c04:0:0:0:233 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org We can simply use a relocated 64-bit literal to store the address of __secondary_switched(), and the relocation code will ensure that it holds the correct value at secondary entry time, as long as we make sure that the literal value is visible to the secondaries before they enable their MMUs. So place the literal next to kimage_vaddr, and set the alignment so that it is covered by the same cacheline that we already have to clean for a similar purpose. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/head.S | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 4203d5f257bc..69b33535911e 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -471,7 +471,8 @@ __mmap_switched: b 0b 2: adr_l x8, kimage_vaddr // make relocated kimage_vaddr - dc cvac, x8 // value visible to secondaries + // and __secondary_switched + dc cvac, x8 // values visible to secondaries dsb sy // with MMU off #endif @@ -506,10 +507,12 @@ ENDPROC(__mmap_switched) * end early head section, begin head code that is also used for * hotplug and needs to have the same protections as the text region */ - .section ".text","ax" - + .section ".text","ax" + .align 4 ENTRY(kimage_vaddr) .quad _text - TEXT_OFFSET +.L__secondary_switched: + .quad __secondary_switched /* * If we're fortunate enough to boot at EL2, ensure that the world is @@ -701,12 +704,9 @@ ENTRY(secondary_startup) adrp x26, swapper_pg_dir bl __cpu_setup // initialise processor - ldr x8, kimage_vaddr - ldr w9, 0f - sub x27, x8, w9, sxtw // address to jump to after enabling the MMU + ldr x27, .L__secondary_switched b __enable_mmu ENDPROC(secondary_startup) -0: .long (_text - TEXT_OFFSET) - __secondary_switched ENTRY(__secondary_switched) adr_l x5, vectors