From patchwork Mon Feb 22 20:54:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 62636 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1472887lbl; Mon, 22 Feb 2016 13:01:30 -0800 (PST) X-Received: by 10.66.222.101 with SMTP id ql5mr41270804pac.144.1456174890319; Mon, 22 Feb 2016 13:01:30 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id b14si41879394pat.152.2016.02.22.13.01.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Feb 2016 13:01:30 -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; dkim=neutral (body hash did not verify) header.i=@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 1aXxar-0000kx-Qx; Mon, 22 Feb 2016 21:00:33 +0000 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aXxW7-0004Dn-Jj for linux-arm-kernel@lists.infradead.org; Mon, 22 Feb 2016 20:55:42 +0000 Received: by mail-wm0-x22c.google.com with SMTP id c200so191071786wme.0 for ; Mon, 22 Feb 2016 12:55:19 -0800 (PST) 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=bGy/+cJp6fjkBuCGk+EgaESbNdwamAo0gno5KmnKLDw=; b=J69E5yWPVqyjml76pjs8jyV6XWQOKhWm2j8lqoQQVZ7TdQd/0NaDJ99un3hWvvuYLK DHSSbl6/gqBRMOgNFdoO/1moASrbi49rQUXOIctZ4atOOyFYSWsSG9+fs2qbsGrxRJGM l7BAp6sI6NP5TmLZW4j5EFFCb9gz5xPsxeAD4= 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=bGy/+cJp6fjkBuCGk+EgaESbNdwamAo0gno5KmnKLDw=; b=cB8+mmBYeQl18zJm2Mun53eZMmdk4FEMpJcKm7TAGUFmPUTYZEZe67xWmdE/OmKDXX ZbMJ1WU0SX03GlBTCXzSGggoz2U6eZGUhEBfr6ufudTX8pfGc/wjuSmMTVhIoMsT8+eK Frnrc2ULVWGOvdjQgW//8BT+oD+mNj2aVrxI29r4HhF8wnXs+02SkNwNWSczlIoVn8lT vTpTMr1r9xCTWWvMpl29N/YXFSM7vXlXb4neCSXveiQli/Am2hMDMxdikrhFv51B8/EI CzTUyafA7Y9vPBRQ3/ChU3qdj9i09ENin+Cr7iuqIHR4l4+bP27R5ic9yl8KtA9iBMzw D+Fw== X-Gm-Message-State: AG10YOSifg5bDJhW+PodtBD4c8e5RnjMlSpraBJqlLJIq4y0k2SJ2FAKxunJk73fRDl/bSmV X-Received: by 10.28.54.22 with SMTP id d22mr13882667wma.72.1456174517953; Mon, 22 Feb 2016 12:55:17 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id k8sm15012530wjr.38.2016.02.22.12.55.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Feb 2016 12:55:17 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, will.deacon@arm.com, catalin.marinas@arm.com, mark.rutland@arm.com Subject: [RFC PATCH 06/10] arm64: mm: use __pa_symbol() not __pa() for section boundary symbols Date: Mon, 22 Feb 2016 21:54:28 +0100 Message-Id: <1456174472-30028-7-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456174472-30028-1-git-send-email-ard.biesheuvel@linaro.org> References: <1456174472-30028-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160222_125540_040846_B2FD1C89 X-CRM114-Status: GOOD ( 15.48 ) 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 [2a00:1450:400c:c09:0:0:0:22c 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_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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 Boundaries exported by asm/sections.h are relative to the kernel text and not covered by the linear mapping. So use __pa_symbol() instead of __pa() (or use __kimg_to_phys() if the virtual address is taken first) Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/setup.c | 8 ++++---- arch/arm64/mm/init.c | 9 +++++---- arch/arm64/mm/mmu.c | 10 +++++----- 3 files changed, 14 insertions(+), 13 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/setup.c b/arch/arm64/kernel/setup.c index 42371f69def3..bb41ebabe017 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -201,10 +201,10 @@ static void __init request_standard_resources(void) struct memblock_region *region; struct resource *res; - kernel_code.start = virt_to_phys(_text); - kernel_code.end = virt_to_phys(_etext - 1); - kernel_data.start = virt_to_phys(_sdata); - kernel_data.end = virt_to_phys(_end - 1); + kernel_code.start = __pa_symbol(_text); + kernel_code.end = __pa_symbol(_etext - 1); + kernel_data.start = __pa_symbol(_sdata); + kernel_data.end = __pa_symbol(_end - 1); for_each_memblock(memory, region) { res = alloc_bootmem_low(sizeof(*res)); diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 017201982da3..af98bf85ec8e 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -181,7 +181,7 @@ void __init arm64_memblock_init(void) * linear mapping. Take care not to clip the kernel which may be * high in memory. */ - memblock_remove(max(memstart_addr + linear_region_size, __pa(_end)), + memblock_remove(max(memstart_addr + linear_region_size, __pa_symbol(_end)), ULLONG_MAX); if (memblock_end_of_DRAM() > linear_region_size) memblock_remove(0, memblock_end_of_DRAM() - linear_region_size); @@ -193,7 +193,7 @@ void __init arm64_memblock_init(void) */ if (memory_limit != (phys_addr_t)ULLONG_MAX) { memblock_enforce_memory_limit(memory_limit); - memblock_add(__pa(_text), (u64)(_end - _text)); + memblock_add(__pa_symbol(_text), (u64)(_end - _text)); } if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) { @@ -217,7 +217,7 @@ void __init arm64_memblock_init(void) * Register the kernel text, kernel data, initrd, and initial * pagetables with memblock. */ - memblock_reserve(__pa(_text), _end - _text); + memblock_reserve(__pa_symbol(_text), _end - _text); #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start) { memblock_reserve(initrd_start, initrd_end - initrd_start); @@ -418,7 +418,8 @@ void __init mem_init(void) void free_initmem(void) { - free_initmem_default(0); + free_reserved_area(__va(__pa_symbol(__init_begin)), + __va(__pa_symbol(__init_end)), 0, "unused kernel"); fixup_init(); } diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index e7340defa085..13517699bea6 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -387,8 +387,8 @@ static void create_mapping_late(phys_addr_t phys, unsigned long virt, static void __init __map_memblock(pgd_t *pgd, phys_addr_t start, phys_addr_t end) { - unsigned long kernel_start = __pa(_stext); - unsigned long kernel_end = __pa(_etext); + unsigned long kernel_start = __pa_symbol(_stext); + unsigned long kernel_end = __pa_symbol(_etext); /* * Take care not to create a writable alias for the @@ -452,7 +452,7 @@ void mark_rodata_ro(void) if (!IS_ENABLED(CONFIG_DEBUG_RODATA)) return; - create_mapping_late(__pa(_stext), (unsigned long)_stext, + create_mapping_late(__pa_symbol(_stext), (unsigned long)_stext, (unsigned long)_etext - (unsigned long)_stext, PAGE_KERNEL_ROX); } @@ -470,7 +470,7 @@ void fixup_init(void) static void __init map_kernel_chunk(pgd_t *pgd, void *va_start, void *va_end, pgprot_t prot, struct vm_struct *vma) { - phys_addr_t pa_start = __pa(va_start); + phys_addr_t pa_start = __kimg_to_phys(va_start); unsigned long size = va_end - va_start; BUG_ON(!PAGE_ALIGNED(pa_start)); @@ -517,7 +517,7 @@ static void __init map_kernel(pgd_t *pgd) */ BUG_ON(!IS_ENABLED(CONFIG_ARM64_16K_PAGES)); set_pud(pud_set_fixmap_offset(pgd, FIXADDR_START), - __pud(__pa(bm_pmd) | PUD_TYPE_TABLE)); + __pud(__pa_symbol(bm_pmd) | PUD_TYPE_TABLE)); pud_clear_fixmap(); } else { BUG();