All of lore.kernel.org
 help / color / mirror / Atom feed
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6sub1 07/11] arm64: decouple early fixmap init from linear mapping
Date: Tue, 16 Feb 2016 13:52:38 +0100	[thread overview]
Message-ID: <1455627162-31600-8-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1455627162-31600-1-git-send-email-ard.biesheuvel@linaro.org>

Since the early fixmap page tables are populated using pages that are
part of the static footprint of the kernel, they are covered by the
initial kernel mapping, and we can refer to them without using __va/__pa
translations, which are tied to the linear mapping.

Since the fixmap page tables are disjoint from the kernel mapping up
to the top level pgd entry, we can refer to bm_pte[] directly, and there
is no need to walk the page tables and perform __pa()/__va() translations
at each step.

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/arm64/mm/mmu.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 73383019f212..b84915723ea0 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -583,7 +583,7 @@ static inline pud_t * fixmap_pud(unsigned long addr)
 
 	BUG_ON(pgd_none(*pgd) || pgd_bad(*pgd));
 
-	return pud_offset(pgd, addr);
+	return pud_offset_kimg(pgd, addr);
 }
 
 static inline pmd_t * fixmap_pmd(unsigned long addr)
@@ -592,16 +592,12 @@ static inline pmd_t * fixmap_pmd(unsigned long addr)
 
 	BUG_ON(pud_none(*pud) || pud_bad(*pud));
 
-	return pmd_offset(pud, addr);
+	return pmd_offset_kimg(pud, addr);
 }
 
 static inline pte_t * fixmap_pte(unsigned long addr)
 {
-	pmd_t *pmd = fixmap_pmd(addr);
-
-	BUG_ON(pmd_none(*pmd) || pmd_bad(*pmd));
-
-	return pte_offset_kernel(pmd, addr);
+	return &bm_pte[pte_index(addr)];
 }
 
 void __init early_fixmap_init(void)
@@ -613,14 +609,14 @@ void __init early_fixmap_init(void)
 
 	pgd = pgd_offset_k(addr);
 	pgd_populate(&init_mm, pgd, bm_pud);
-	pud = pud_offset(pgd, addr);
+	pud = fixmap_pud(addr);
 	pud_populate(&init_mm, pud, bm_pmd);
-	pmd = pmd_offset(pud, addr);
+	pmd = fixmap_pmd(addr);
 	pmd_populate_kernel(&init_mm, pmd, bm_pte);
 
 	/*
 	 * The boot-ioremap range spans multiple pmds, for which
-	 * we are not preparted:
+	 * we are not prepared:
 	 */
 	BUILD_BUG_ON((__fix_to_virt(FIX_BTMAP_BEGIN) >> PMD_SHIFT)
 		     != (__fix_to_virt(FIX_BTMAP_END) >> PMD_SHIFT));
-- 
2.5.0

  parent reply	other threads:[~2016-02-16 12:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16 12:52 [PATCH v6sub1 00/11] arm64: split linear and kernel mappings Ard Biesheuvel
2016-02-16 12:52 ` [PATCH v6sub1 01/11] of/fdt: make memblock minimum physical address arch configurable Ard Biesheuvel
2016-02-16 12:52 ` [PATCH v6sub1 02/11] of/fdt: factor out assignment of initrd_start/initrd_end Ard Biesheuvel
2016-02-16 17:28   ` Rob Herring
2016-02-16 12:52 ` [PATCH v6sub1 03/11] arm64: prevent potential circular header dependencies in asm/bug.h Ard Biesheuvel
2016-02-16 12:52 ` [PATCH v6sub1 04/11] arm64: add support for ioremap() block mappings Ard Biesheuvel
2016-02-16 12:52 ` [PATCH v6sub1 05/11] arm64: introduce KIMAGE_VADDR as the virtual base of the kernel region Ard Biesheuvel
2016-02-16 12:52 ` [PATCH v6sub1 06/11] arm64: pgtable: implement static [pte|pmd|pud]_offset variants Ard Biesheuvel
2016-02-16 12:52 ` Ard Biesheuvel [this message]
2016-02-16 12:52 ` [PATCH v6sub1 08/11] arm64: kvm: deal with kernel symbols outside of linear mapping Ard Biesheuvel
2016-02-16 12:52 ` [PATCH v6sub1 09/11] arm64: move kernel image to base of vmalloc area Ard Biesheuvel
2016-02-16 12:52 ` [PATCH v6sub1 10/11] arm64: defer __va translation of initrd_start and initrd_end Ard Biesheuvel
2016-02-16 12:52 ` [PATCH v6sub1 11/11] arm64: allow kernel Image to be loaded anywhere in physical memory Ard Biesheuvel
2016-02-18 18:25 ` [PATCH v6sub1 00/11] arm64: split linear and kernel mappings Catalin Marinas
2016-02-18 18:27   ` Ard Biesheuvel
2016-02-18 19:38     ` Ard Biesheuvel
2016-02-19  8:05       ` Ard Biesheuvel
2016-02-19 14:25         ` Catalin Marinas
2016-02-19 14:27           ` Ard Biesheuvel
2016-02-19 14:29             ` Ard Biesheuvel
2016-02-19 14:37               ` Catalin Marinas
2016-02-19 14:40                 ` Ard Biesheuvel
2016-02-19 14:57                   ` Catalin Marinas
2016-02-19 17:34                   ` Catalin Marinas
2016-02-19 17:38                     ` Ard Biesheuvel
2016-02-19 17:43                       ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455627162-31600-8-git-send-email-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.