From patchwork Thu Feb 11 13:35:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 61761 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp195114lbl; Thu, 11 Feb 2016 05:36:37 -0800 (PST) X-Received: by 10.66.164.196 with SMTP id ys4mr66183855pab.119.1455197796895; Thu, 11 Feb 2016 05:36:36 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id y11si8169110pfi.175.2016.02.11.05.36.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Feb 2016 05:36:36 -0800 (PST) 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; 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 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 1aTrPH-0005oV-Dv; Thu, 11 Feb 2016 13:35:39 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aTrPD-0005N4-FS for linux-arm-kernel@lists.infradead.org; Thu, 11 Feb 2016 13:35:36 +0000 Received: from edgewater-inn.cambridge.arm.com (edgewater-inn.cambridge.arm.com [10.1.203.121]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id u1BDZAWr000390; Thu, 11 Feb 2016 13:35:10 GMT Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 445101AE326C; Thu, 11 Feb 2016 13:35:17 +0000 (GMT) From: Will Deacon To: catalin.marinas@arm.com Subject: [PATCH] arm64: mm: keep gcc and sparse happy when !CONFIG_DEBUG_RODATA Date: Thu, 11 Feb 2016 13:35:16 +0000 Message-Id: <1455197716-28665-1-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160211_053535_887292_A35272BB X-CRM114-Status: GOOD ( 11.81 ) X-Spam-Score: -7.1 (-------) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-7.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.96.50 listed in list.dnswl.org] -0.2 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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: Will Deacon , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org init/main.c defines an empty static inline mark_rodata_ro #ifndef CONFIG_DEBUG_RODATA, which clashes with the unconditional definition in the arm64 backend, which has an IS_ENABLED check in the code. Whilst this doesn't cause any problems in practice (the static inline version is used in preference and the out-of-line version has no prototype), GCC moans with: warning: no previous prototype for ‘mark_rodata_ro’ [-Wmissing-prototypes] and sparse with: warning: symbol 'mark_rodata_ro' was not declared. Should it be static? [sparse] so keep them happy by replacing the IS_ENABLED check with an #ifdef around the function instead. Signed-off-by: Will Deacon --- arch/arm64/mm/mmu.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index c3e5df62671e..4a330018ce8f 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -372,19 +372,6 @@ void __init create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys, late_pgtable_alloc); } -static void create_mapping_late(phys_addr_t phys, unsigned long virt, - phys_addr_t size, pgprot_t prot) -{ - if (virt < VMALLOC_START) { - pr_warn("BUG: not creating mapping for %pa at 0x%016lx - outside kernel range\n", - &phys, virt); - return; - } - - __create_pgd_mapping(init_mm.pgd, phys, virt, size, prot, - late_pgtable_alloc); -} - static void __init __map_memblock(pgd_t *pgd, phys_addr_t start, phys_addr_t end) { @@ -438,15 +425,27 @@ static void __init map_mem(pgd_t *pgd) } } -void mark_rodata_ro(void) +#ifdef CONFIG_DEBUG_RODATA +static void create_mapping_late(phys_addr_t phys, unsigned long virt, + phys_addr_t size, pgprot_t prot) { - if (!IS_ENABLED(CONFIG_DEBUG_RODATA)) + if (virt < VMALLOC_START) { + pr_warn("BUG: not creating mapping for %pa at 0x%016lx - outside kernel range\n", + &phys, virt); return; + } + __create_pgd_mapping(init_mm.pgd, phys, virt, size, prot, + late_pgtable_alloc); +} + +void mark_rodata_ro(void) +{ create_mapping_late(__pa(_stext), (unsigned long)_stext, (unsigned long)_etext - (unsigned long)_stext, PAGE_KERNEL_ROX); } +#endif void fixup_init(void) {