From patchwork Wed Jul 12 22:33:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 107538 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1411873qge; Wed, 12 Jul 2017 15:34:34 -0700 (PDT) X-Received: by 10.84.142.1 with SMTP id 1mr6610882plw.130.1499898873942; Wed, 12 Jul 2017 15:34:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499898873; cv=none; d=google.com; s=arc-20160816; b=TchFE3w/Krj46+sNZqp2Y8Z6RsVpmrkv/O0AOxOoKwOqCIV1oI1gwcPnCH5Z5BmmCF M34bQXQ8ngdW42wEoWccY3EiWsp1AzDJHQRV+haS3gwCM6jjmmb1RH0DqelHXUgDqab9 qX1c5bjwIRJS2G27YnBA9zL3W7zkeRpOfwb/afw5Ecyu4cG+WtoPNqlL7IHvEEAWWNtC 8ipKuNWOH+zlqKOMsZYNycUohVNJ0MluQdQphMAx7IRSOxo/c9iRmCKbIMN/YUHsVyzd H+w36C5QRkWAa0ppSLL35YcAxKC+/Aw2dD1m15Pd7FRAOjIfOyzEIY6FNbCEMYwBGkmZ S4tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=0LLX/2NZsBgA08R0fM2IUHR90cWSG+tGsX5dhM9Xabo=; b=mTSclbXjvcCvYkDdyTA2lyEjkqPG87Q5en6fURKms38ETjiRriyvmZWoYKzGB/6IUu g/hOhXaUl0rCG05t8iF4SyWmxhCyH53sbQw/Z42DTB6Ua9VowSa+zYsW8K9H1i1GMnDt 10PMZm87vtmmqpyErk0jdXWYJf7WDaTKyPKAQL7LhQ58rqonWUXcVmHSF0u/Bsnzns6f 5z9yE/tNr0Y3e2MW4HNjFQFwQjhhr92VXoitWl70fxkGynMRefnz/cmOTdt5UGk33gzn ETtnGUyvWmW2tW5pWvx5bOHqvmQM4qRGQ5Y2aYYsFOLsYLpBCFPqDSuitTQSyDP57rq4 MqHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si2959805plp.163.2017.07.12.15.34.33; Wed, 12 Jul 2017 15:34:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752776AbdGLWeU (ORCPT + 25 others); Wed, 12 Jul 2017 18:34:20 -0400 Received: from foss.arm.com ([217.140.101.70]:59114 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752523AbdGLWeT (ORCPT ); Wed, 12 Jul 2017 18:34:19 -0400 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 853C01610; Wed, 12 Jul 2017 15:34:13 -0700 (PDT) Received: from leverpostej.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AC2553F3E1; Wed, 12 Jul 2017 15:34:11 -0700 (PDT) From: Mark Rutland To: ard.biesheuvel@linaro.org, kernel-hardening@lists.openwall.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: akashi.takahiro@linaro.org, catalin.marinas@arm.com, dave.martin@arm.com, james.morse@arm.com, labbott@fedoraproject.org, will.deacon@arm.com, keescook@chromium.org, Mark Rutland Subject: [RFC PATCH 4/6] arm64: pass stack base to secondary_start_kernel Date: Wed, 12 Jul 2017 23:33:01 +0100 Message-Id: <1499898783-25732-5-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1499898783-25732-1-git-send-email-mark.rutland@arm.com> References: <1499898783-25732-1-git-send-email-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In subsequent patches, we'll want the base of the secondary stack in secondary_start_kernel. Pass the stack base down, as we do in the primary path, and add the offset in secondary_start_kernel. Unfortunately, we can't encode STACK_START_SP in an add immediate, so use a mov immedaite, which has greater range. This is far from a hot path, so the overhead shouldn't matter. Signed-off-by: Mark Rutland --- arch/arm64/kernel/head.S | 3 ++- arch/arm64/kernel/smp.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) -- 1.9.1 diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index a58ecda..db77cac 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -613,7 +613,8 @@ __secondary_switched: adr_l x0, secondary_data ldr x1, [x0, #CPU_BOOT_STACK] // get secondary_data.stack - mov sp, x1 + mov x3, #THREAD_START_SP + add sp, x1, x3 ldr x2, [x0, #CPU_BOOT_TASK] msr tpidr_el1, x2 mov x29, #0 diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 6e0e16a..269c957 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -154,7 +154,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) * page tables. */ secondary_data.task = idle; - secondary_data.stack = task_stack_page(idle) + THREAD_START_SP; + secondary_data.stack = task_stack_page(idle); update_cpu_boot_status(CPU_MMU_OFF); __flush_dcache_area(&secondary_data, sizeof(secondary_data));