From patchwork Fri Feb 16 14:14:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Murzin X-Patchwork-Id: 10224793 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 65AC2603EE for ; Fri, 16 Feb 2018 14:16:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5744E2946A for ; Fri, 16 Feb 2018 14:16:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B9D829489; Fri, 16 Feb 2018 14:16:22 +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 [198.137.202.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 873E72946A for ; Fri, 16 Feb 2018 14:16:21 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=B2BeeXrNs8CFB7kjiNe73sYgWDdqLNkp0+k9bhxpR/o=; b=TJvy4ZA3Svg8xU fOOxvE+rNvbLl40OhRSjTWP5rtfwN48ID+XBjstxA4UKUagRickRJ3NGocllkjXNPq+GNEkg99h2r OZ5lp/EU/WGgz+eUQeEGrXcV848T0lMSRgh4YrSvmCPv7q2LCewbifRurB+2nr3GEmcpZ+ZQLhe1k sYHc12qM0/kIcZSqiuZ78haujBE3ZvYlXKdrtHf9ypnzDjQwUqPTgw73j3kAOvhpfOzVJStWjzAN6 fuG74UJtmVS2JukWufnSXcfg/BVH5MuiAXFtXOT+bEFXilrZ7P8uWU+NsJ9BCT1ohs+w4VisUP3rs I96778iHn283qtWLBM7A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1emgo4-0003nS-TI; Fri, 16 Feb 2018 14:16:08 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1emgnG-0002BD-Hp for linux-arm-kernel@lists.infradead.org; Fri, 16 Feb 2018 14:15:20 +0000 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 4F1D415AB; Fri, 16 Feb 2018 06:15:06 -0800 (PST) Received: from bc-d5-1-4.euhpc.arm.com. (bc-d5-1-4.euhpc.arm.com [10.6.15.212]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1D8A33F41F; Fri, 16 Feb 2018 06:15:04 -0800 (PST) From: Vladimir Murzin To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/4] ARM: NOMMU: Reorganise __setup_mpu Date: Fri, 16 Feb 2018 14:14:43 +0000 Message-Id: <1518790485-2321-3-git-send-email-vladimir.murzin@arm.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1518790485-2321-1-git-send-email-vladimir.murzin@arm.com> References: <1518790485-2321-1-git-send-email-vladimir.murzin@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180216_061518_891010_B5FE73E7 X-CRM114-Status: UNSURE ( 9.01 ) X-CRM114-Notice: Please train this message. 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: kbuild-all@01.org, alexandre.torgue@st.com, linux@armlinux.org.uk, arnd@arndb.de, sza@esh.hu 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 Currently, we have mixed code placement between .head.text and .text depends on configuration we are building: _text M R(UP) R(SMP) ====================================================== __setup_mpu __HEAD __HEAD text __after_proc_init __HEAD __HEAD text __mmap_switched text text text We are going to support another variant of MPU which is different to PMSAv7 in sense overlapping MPU regions are not allowed, so this patch makes boundaries between these sections precise and consistent: _text M R(UP) R(SMP) ====================================================== __setup_mpu __HEAD __HEAD __HEAD __after_proc_init text text text __mmap_switched text text text Additionally, it paves a path to postpone MPU activation till __after_proc_init where we do set SCTLR anyway and can return directly to __mmap_switched. Tested-by: Szemző András Signed-off-by: Vladimir Murzin --- arch/arm/kernel/head-nommu.S | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S index 0d17187..aaa25a6 100644 --- a/arch/arm/kernel/head-nommu.S +++ b/arch/arm/kernel/head-nommu.S @@ -75,8 +75,8 @@ ENTRY(stext) ldr r12, [r10, #PROCINFO_INITFUNC] add r12, r12, r10 ret r12 -1: bl __after_proc_init - b __mmap_switched +1: ldr lr, =__mmap_switched + b __after_proc_init ENDPROC(stext) #ifdef CONFIG_SMP @@ -123,6 +123,7 @@ __secondary_data: /* * Set the Control Register and Read the process ID. */ + .text __after_proc_init: #ifdef CONFIG_CPU_CP15 /* @@ -202,6 +203,7 @@ ENDPROC(__after_proc_init) * * r6: Value to be written to DRSR (and IRSR if required) for PMSAv7_RAM_REGION */ + __HEAD ENTRY(__setup_mpu) @@ -301,6 +303,7 @@ ENDPROC(__setup_pmsa_v7) * r6: pointer at mpu_rgn_info */ + .text ENTRY(__secondary_setup_mpu) /* Use MPU region info supplied by __cpu_up */ ldr r6, [r7] @ get secondary_data.mpu_rgn_info