generic early_ioremap support
Subsystems (9)
v2 cover generic early_ioremap support
This patch series takes the common bits from the x86 early ioremap implementation and creates a generic implementation which may be used by other architectures. The early ioremap interfaces are intended for situations where boot code needs to make temporary virtual mappings before the normal ioremap interfaces are available. Typically, this means before paging_init() has run.
These patches are layered on top of generic fixmap patches which were discussed here (and are in the akpm tree):
http://lkml.org/lkml/2013/11/25/474
This is version 2 of the patch series. These patches (and underlying fixmap patches) may be found at:
git://github.com/mosalter/linux.git (early-ioremap-v2 branch)
Changes from version 1:
* Moved the generic code into linux/mm instead of linux/lib
* Have early_memremap() return normal pointer instead of __iomem This is in response to sparse warning cleanups being made in an unrelated patch series:
https://lkml.org/lkml/2013/12/22/69
* Added arm64 patch to call init_mem_pgprot() earlier so that the pgprot macros are valid in time for early_ioremap use
* Added validity checking for early_ioremap pgd, pud, and pmd in arm64
Mark Salter (5):
mm: create generic early_ioremap() support
x86: use generic early_ioremap
arm: add early_ioremap support
arm64: initialize pgprot info earlier in boot
arm64: add early_ioremap support
Documentation/arm64/memory.txt | 4 +- arch/arm/Kconfig | 11 ++ arch/arm/include/asm/Kbuild | 1 + arch/arm/include/asm/fixmap.h | 18 +++ arch/arm/include/asm/io.h | 1 + arch/arm/kernel/setup.c | 3 + arch/arm/mm/Makefile | 1 + arch/arm/mm/early_ioremap.c | 93 ++++++++++++++ arch/arm/mm/mmu.c | 2 + arch/arm64/Kconfig | 1 + arch/arm64/include/asm/Kbuild | 1 + arch/arm64/include/asm/fixmap.h | 68 ++++++++++ arch/arm64/include/asm/io.h | 1 + arch/arm64/include/asm/memory.h | 2 +- arch/arm64/include/asm/mmu.h | 1 + arch/arm64/kernel/early_printk.c | 8 +- arch/arm64/kernel/head.S | 9 +- arch/arm64/kernel/setup.c | 4 + arch/arm64/mm/ioremap.c | 85 ++++++++++++ arch/arm64/mm/mmu.c | 44 +------ arch/x86/Kconfig | 1 + arch/x86/include/asm/Kbuild | 1 + arch/x86/include/asm/fixmap.h | 6 + arch/x86/include/asm/io.h | 14 +- arch/x86/mm/ioremap.c | 224 +------------------------------- arch/x86/mm/pgtable_32.c | 2 +- include/asm-generic/early_ioremap.h | 41 ++++++ mm/Kconfig | 3 + mm/Makefile | 1 + mm/early_ioremap.c | 249 ++++++++++++++++++++++++++++++++++++ 30 files changed, 611 insertions(+), 289 deletions(-) create mode 100644 arch/arm/mm/early_ioremap.c create mode 100644 arch/arm64/include/asm/fixmap.h create mode 100644 include/asm-generic/early_ioremap.h create mode 100644 mm/early_ioremap.c
Signature · 7 lines
1.8.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 1/5 mm: create generic early_ioremap() support
This patch creates a generic implementation of early_ioremap() support based on the existing x86 implementation. early_ioremp() is useful for early boot code which needs to temporarily map I/O or memory regions before normal mapping functions such as ioremap() are available.
There is one difference from the existing x86 implementation which should be noted. The generic early_memremap() function does not return an __iomem pointer and a new early_memunmap() function has been added to act as a wrapper for early_iounmap() but with a non __iomem pointer passed in. This is in line with the first patch of this series:
https://lkml.org/lkml/2013/12/22/69
--- include/asm-generic/early_ioremap.h | 41 ++++++ mm/Kconfig | 3 + mm/Makefile | 1 + mm/early_ioremap.c | 249 ++++++++++++++++++++++++++++++++++++ 4 files changed, 294 insertions(+) create mode 100644 include/asm-generic/early_ioremap.h create mode 100644 mm/early_ioremap.c
include/asm-generic/early_ioremap.h new file +41 -0
@@ -0,0 +1,41 @@ +#ifndef _ASM_EARLY_IOREMAP_H_ +#define _ASM_EARLY_IOREMAP_H_ + +#include <linux/types.h> + +#ifdef CONFIG_GENERIC_EARLY_IOREMAP +/* +* early_ioremap() and early_iounmap() are for temporary early boot-time +* mappings, before the real ioremap() is functional. +*/ +extern void __iomem *early_ioremap (resource_size_t phys_addr, +unsigned long size); +extern void *early_memremap (resource_size_t phys_addr, +unsigned long size); +extern void early_iounmap (void __iomem *addr,unsigned long size); +extern void early_memunmap (void *addr,unsigned long size); + +/* Arch-specific initialization */ +extern void early_ioremap_init (void ); + +/* Generic initialization called by architecture code */ +extern void early_ioremap_setup (void ); + +/* +* Called as last step in paging_init() so library can act +* accordingly for subsequent map/unmap requests. +*/ +extern void early_ioremap_reset (void ); + +/* +* Weak function called by early_ioremap_reset(). It does nothing, but +* architectures may provide their own version to do any needed cleanups. +*/ +extern void early_ioremap_shutdown (void ); +#else +static inline void early_ioremap_init (void ) { } +static inline void early_ioremap_setup (void ) { } +static inline void early_ioremap_reset (void ) { } +#endif + +#endif /* _ASM_EARLY_IOREMAP_H_ */
mm/Kconfig +3 -0
@@ -552,3 +552,6 @@ config MEM_SOFT_DIRTY it can be cleared by hands. See Documentation/vm/soft-dirty.txt for more details. + +config GENERIC_EARLY_IOREMAP + bool
mm/Makefile +1 -0
@@ -60,3 +60,4 @@ obj-$(CONFIG_DEBUG_KMEMLEAK_TEST) += kmemleak-test.o obj-$(CONFIG_CLEANCACHE) += cleancache.o obj-$(CONFIG_MEMORY_ISOLATION) += page_isolation.o obj-$(CONFIG_ZBUD) += zbud.o +obj-$(CONFIG_GENERIC_EARLY_IOREMAP) += early_ioremap.o
mm/early_ioremap.c new file +249 -0
249 lines not on this page · raw message
Signature · 7 lines
1.8.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH v2 1/5] mm: create generic early_ioremap() support
Quoted 13 lines · Mark Salter
This patch creates a generic implementation of
early_ioremap()support based on the existing x86 implementation.early_ioremp()is useful for early boot code which needs to temporarily map I/O or memory regions before normal mapping functions such asioremap()are available.There is one difference from the existing x86 implementation which should be noted. The generic
early_memremap()function does not return an__iomempointer and a newearly_memunmap()function has been added to act as a wrapper forearly_iounmap()but with a non__iomempointer passed in. This is in line with the first patch of this series:
Quoted 11 lines
Signed-off-by Mark Salter <[email protected]>CC Andrew Morton <[email protected]>CC Arnd Bergmann <[email protected]>CC Ingo Molnar <[email protected]>CC Thomas Gleixner <[email protected]>CC "H. Peter Anvin" <[email protected]>CC Russell King <[email protected]>CC Catalin Marinas <[email protected]>CC Will Deacon <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
H. Peter Anvin
reviewerRe: [PATCH v2 1/5] mm: create generic early_ioremap() support
In reply to Mark SalterQuoted 7 lines · Mark Salter
There is one difference from the existing x86 implementation which should be noted. The generic
early_memremap()function does not return an__iomempointer and a newearly_memunmap()function has been added to act as a wrapper forearly_iounmap()but with a non__iomempointer passed in. This is in line with the first patch of this series:
This makes a lot of sense. However, I would suggest that we preface the patch series with a single patch changing the signature for the existing x86 function, that way this change becomes bisectable.
-hpa
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH v2 1/5] mm: create generic early_ioremap() support
Quoted 9 lines · H. Peter Anvin
Quoted 7 lines · Mark Salter
There is one difference from the existing x86 implementation which should be noted. The generic
early_memremap()function does not return an__iomempointer and a newearly_memunmap()function has been added to act as a wrapper forearly_iounmap()but with a non__iomempointer passed in. This is in line with the first patch of this series:
Quoted 3 lines
This makes a lot of sense. However, I would suggest that we preface the patch series with a single patch changing the signature for the existing x86 function, that way this change becomes bisectable.
Ok, that sounds like a good idea. I'm uncertain how best to coordinate with Dave Young's patch series to avoid conflicts. His first patch does the signature change (and adds the early_memunmap function but that isn't used anywhere):
https://lkml.org/lkml/2013/12/20/143
Any thoughts on how best to avoid potential merge conflicts here?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH v2 1/5] mm: create generic early_ioremap() support
Quoted 9 lines · Mark Salter
Ok, that sounds like a good idea. I'm uncertain how best to coordinate with Dave Young's patch series to avoid conflicts. His first patch does the signature change (and adds the
early_memunmapfunction but that isn't used anywhere):https://lkml.org/lkml/2013/12/20/143
Any thoughts on how best to avoid potential merge conflicts here?
Dave's patch hasn't been picked up by anyone so far, so you could incorporate it into your series.
Signature · 7 lines
Matt Fleming, Intel Open Source Technology Center -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 2/5 x86: use generic early_ioremap
In reply to Mark SalterMove x86 over to the generic early ioremap implementation. The generic implementation is functionally the same except that the early_memremap() function returns a normal pointer instead of an __iomem pointer. This is in line with sparse warning cleanups in this patch series:
https://lkml.org/lkml/2013/12/22/69
--- arch/x86/Kconfig | 1 + arch/x86/include/asm/Kbuild | 1 + arch/x86/include/asm/fixmap.h | 6 ++ arch/x86/include/asm/io.h | 14 +-- arch/x86/mm/ioremap.c | 224 +----------------------------------------- arch/x86/mm/pgtable_32.c | 2 +- 6 files changed, 13 insertions(+), 235 deletions(-)
arch/x86/Kconfig +1 -0
@@ -125,6 +125,7 @@ config X86 select RTC_LIB select HAVE_DEBUG_STACKOVERFLOW select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64 + select GENERIC_EARLY_IOREMAP config INSTRUCTION_DECODER def_bool y
arch/x86/include/asm/Kbuild +1 -0
@@ -5,3 +5,4 @@ genhdr-y += unistd_64.h genhdr-y += unistd_x32.h generic-y += clkdev.h +generic-y += early_ioremap.h
arch/x86/include/asm/fixmap.h +6 -0
@@ -177,5 +177,11 @@ static inline void __set_fixmap(enum fixed_addresses idx,#include <asm-generic/fixmap.h> +#define __late_set_fixmap (idx, phys, flags) __set_fixmap(idx, phys, flags) +#define __late_clear_fixmap (idx) __set_fixmap(idx, 0, __pgprot(0)) + +void __early_set_fixmap (enum fixed_addresses idx, +phys_addr_t phys,pgprot_t flags); +#endif /* !__ASSEMBLY__ */ #endif /* _ASM_X86_FIXMAP_H */
arch/x86/include/asm/io.h +1 -13
@@ -39,6 +39,7 @@#include <linux/string.h> #include <linux/compiler.h> #include <asm/page.h> +#include <asm/early_ioremap.h> #define build_mmio_read (name, size, type, reg, barrier) \ static inline type name(const volatile void __iomem *addr) \
@@ -316,19 +317,6 @@ extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, unsigned long prot_val);extern void __iomem *ioremap_wc (resource_size_t offset,unsigned long size); -/* -* early_ioremap() and early_iounmap() are for temporary early boot-time -* mappings, before the real ioremap() is functional. -* A boot-time mapping is currently limited to at most 16 pages. -*/ -extern void early_ioremap_init (void ); -extern void early_ioremap_reset (void ); -extern void __iomem *early_ioremap (resource_size_t phys_addr, -unsigned long size); -extern void __iomem *early_memremap (resource_size_t phys_addr, -unsigned long size); -extern void early_iounmap (void __iomem *addr,unsigned long size); -extern void fixup_early_ioremap (void );extern bool is_early_ioremap_ptep (pte_t *ptep);#ifdef CONFIG_XEN
arch/x86/mm/ioremap.c +3 -221
249 lines not on this page · raw message
arch/x86/mm/pgtable_32.c +1 -1
@@ -127,7 +127,7 @@ static int __init parse_reservetop(char *arg) address =memparse (arg, &arg);reserve_top_address (address); -fixup_early_ioremap (); +early_ioremap_init ();return 0 ; }early_param ("reservetop" , parse_reservetop);
Signature · 7 lines
1.8.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 3/5 arm: add early_ioremap support
In reply to Mark SalterThis patch uses the generic early_ioremap code to implement early_ioremap for ARM. The ARM-specific bits come mostly from an earlier patch from Leif Lindholm <[email protected]> here:
https://lkml.org/lkml/2013/10/3/279
--- arch/arm/Kconfig | 11 +++++ arch/arm/include/asm/Kbuild | 1 + arch/arm/include/asm/fixmap.h | 18 +++++++++ arch/arm/include/asm/io.h | 1 + arch/arm/kernel/setup.c | 3 ++ arch/arm/mm/Makefile | 1 + arch/arm/mm/early_ioremap.c | 93 +++++++++++++++++++++++++++++++++++++++++++ arch/arm/mm/mmu.c | 2 + 8 files changed, 130 insertions(+) create mode 100644 arch/arm/mm/early_ioremap.c
arch/arm/Kconfig +11 -0
@@ -1842,6 +1842,17 @@ config UACCESS_WITH_MEMCPY However, if the CPU data cache is using a write-allocate mode, this option is unlikely to provide any performance gain. +config EARLY_IOREMAP + depends on MMU + bool "Provide early_ioremap() support for kernel initialization." + select GENERIC_EARLY_IOREMAP + help + Provide a mechanism for kernel initialisation code to temporarily + map, in a highmem-agnostic way, memory pages in before ioremap() + and friends are available (before paging_init() has run). It uses + the same virtual memory range as kmap so all early mappings must + be unapped before paging_init() is called. + config SECCOMP bool prompt "Enable seccomp to safely compute untrusted bytecode"
arch/arm/include/asm/Kbuild +1 -0
@@ -4,6 +4,7 @@ generic-y += auxvec.h generic-y += bitsperlong.h generic-y += cputime.h generic-y += current.h +generic-y += early_ioremap.h generic-y += emergency-restart.h generic-y += errno.h generic-y += exec.h
arch/arm/include/asm/fixmap.h +18 -0
@@ -21,8 +21,26 @@ enum fixed_addresses {FIX_KMAP_BEGIN ,FIX_KMAP_END = (FIXADDR_TOP -FIXADDR_START ) >>PAGE_SHIFT , __end_of_fixed_addresses +/* +* 224 temporary boot-time mappings, used by early_ioremap(), +* before ioremap() is functional. +* +* (P)re-using the FIXADDR region, which is used for highmem +* later on, and statically aligned to 1MB. + */ +#define NR_FIX_BTMAPS 32 +#define FIX_BTMAPS_SLOTS 7 +#define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS) +#define FIX_BTMAP_END FIX_KMAP_BEGIN +#define FIX_BTMAP_BEGIN (FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1) }; +#define FIXMAP_PAGE_NORMAL (L_PTE_MT_WRITEBACK | L_PTE_YOUNG | L_PTE_PRESENT) +#define FIXMAP_PAGE_IO (L_PTE_MT_DEV_NONSHARED | L_PTE_YOUNG | L_PTE_PRESENT) + +extern void __early_set_fixmap (enum fixed_addresses idx, +phys_addr_t phys,pgprot_t flags); +#include <asm-generic/fixmap.h> #endif
arch/arm/include/asm/io.h +1 -0
@@ -28,6 +28,7 @@#include <asm/byteorder.h> #include <asm/memory.h> #include <asm-generic/pci_iomap.h> +#include <asm/early_ioremap.h> #include <xen/xen.h> /*
arch/arm/kernel/setup.c +3 -0
@@ -36,6 +36,7 @@#include <asm/cpu.h> #include <asm/cputype.h> #include <asm/elf.h> +#include <asm/io.h> #include <asm/procinfo.h> #include <asm/psci.h> #include <asm/sections.h>
@@ -887,6 +888,8 @@ void __init setup_arch(char **cmdline_p)parse_early_param (); +early_ioremap_init (); +sort (&meminfo.bank, meminfo.nr_banks,sizeof (meminfo.bank[0 ]), meminfo_cmp,NULL );early_paging_init (mdesc,lookup_processor_type (read_cpuid_id ()));
arch/arm/mm/Makefile +1 -0
@@ -15,6 +15,7 @@ endif obj-$(CONFIG_MODULES) += proc-syms.o obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o +obj-$(CONFIG_EARLY_IOREMAP) += early_ioremap.o obj-$(CONFIG_HIGHMEM) += highmem.o obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
arch/arm/mm/early_ioremap.c new file +93 -0
93 lines not on this page · raw message
arch/arm/mm/mmu.c +2 -0
@@ -34,6 +34,7 @@#include <asm/mach/arch.h> #include <asm/mach/map.h> #include <asm/mach/pci.h> +#include <asm/early_ioremap.h> #include "mm.h" #include "tcm.h"
@@ -1405,6 +1406,7 @@ void __init paging_init(const struct machine_desc *mdesc) {void *zero_page; +early_ioremap_reset ();build_mem_type_table ();prepare_page_table ();map_lowmem ();
Signature · 7 lines
1.8.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH v2 3/5] arm: add early_ioremap support
Quoted 7 lines · Mark Salter
This patch uses the generic
early_ioremapcode to implementearly_ioremapfor ARM. The ARM-specific bits come mostly from an earlier patch from Leif Lindholm <[email protected]> here:
Quoted 7 lines
Signed-off-by Mark Salter <[email protected]>Tested-by Leif Lindholm <[email protected]>CC linux-arm-kernel at lists.infradead.orgCC Russell King <[email protected]>CC Catalin Marinas <[email protected]>CC Will Deacon <[email protected]>CC Arnd Bergmann <[email protected]>
PATCH v2 4/5 arm64: initialize pgprot info earlier in boot
In reply to Mark SalterPresently, paging_init() calls init_mem_pgprot() to initialize pgprot values used by macros such as PAGE_KERNEL, PAGE_KERNEL_EXEC, etc. The new fixmap and early_ioremap support also needs to use these macros before paging_init() is called. This patch moves the init_mem_pgprot() call out of paging_init() and into setup_arch() so that pgprot_default gets initialized in time for fixmap and early_ioremap.
--- arch/arm64/include/asm/mmu.h | 1 + arch/arm64/kernel/setup.c | 2 ++ arch/arm64/mm/mmu.c | 3 +-- 3 files changed, 4 insertions(+), 2 deletions(-)
arch/arm64/include/asm/mmu.h +1 -0
@@ -27,5 +27,6 @@ typedef struct {extern void paging_init (void );extern void setup_mm_for_reboot (void );extern void __iomem *early_io_map (phys_addr_t phys,unsigned long virt); +extern void init_mem_pgprot (void );#endif
arch/arm64/kernel/setup.c +2 -0
@@ -221,6 +221,8 @@ void __init setup_arch(char **cmdline_p) *cmdline_p = boot_command_line; +init_mem_pgprot (); +parse_early_param ();arm64_memblock_init ();
arch/arm64/mm/mmu.c +1 -2
@@ -125,7 +125,7 @@ early_param("cachepolicy", early_cachepolicy);/* * Adjust the PMD section entries according to the CPU in use. */ -static void __init init_mem_pgprot (void ) +void __init init_mem_pgprot (void ) {pteval_t default_pgprot;int i;
@@ -349,7 +349,6 @@ void __init paging_init(void) {void *zero_page; -init_mem_pgprot ();map_mem ();/*
Signature · 7 lines
1.8.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 5/5 arm64: add early_ioremap support
In reply to Mark SalterAdd support for early IO or memory mappings which are needed before the normal ioremap() is usable. This also adds fixmap support for permanent fixed mappings such as that used by the earlyprintk device register region.
--- Documentation/arm64/memory.txt | 4 +- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/Kbuild | 1 + arch/arm64/include/asm/fixmap.h | 68 ++++++++++++++++++++++++++++++++ arch/arm64/include/asm/io.h | 1 + arch/arm64/include/asm/memory.h | 2 +- arch/arm64/kernel/early_printk.c | 8 +++- arch/arm64/kernel/head.S | 9 ++--- arch/arm64/kernel/setup.c | 2 + arch/arm64/mm/ioremap.c | 85 ++++++++++++++++++++++++++++++++++++++++ arch/arm64/mm/mmu.c | 41 ------------------- 11 files changed, 170 insertions(+), 52 deletions(-) create mode 100644 arch/arm64/include/asm/fixmap.h
Documentation/arm64/memory.txt +2 -2
@@ -35,7 +35,7 @@ ffffffbc00000000 ffffffbdffffffff 8GB vmemmap ffffffbe00000000 ffffffbffbbfffff ~8GB [guard, future vmmemap] -ffffffbffbc00000 ffffffbffbdfffff 2MB earlyprintk device +ffffffbffbc00000 ffffffbffbdfffff 2MB fixed mappings ffffffbffbe00000 ffffffbffbe0ffff 64KB PCI I/O space
@@ -60,7 +60,7 @@ fffffdfc00000000 fffffdfdffffffff 8GB vmemmap fffffdfe00000000 fffffdfffbbfffff ~8GB [guard, future vmmemap] -fffffdfffbc00000 fffffdfffbdfffff 2MB earlyprintk device +fffffdfffbc00000 fffffdfffbdfffff 2MB fixed mappings fffffdfffbe00000 fffffdfffbe0ffff 64KB PCI I/O space
arch/arm64/Kconfig +1 -0
@@ -12,6 +12,7 @@ config ARM64 select CLONE_BACKWARDS select COMMON_CLK select GENERIC_CLOCKEVENTS + select GENERIC_EARLY_IOREMAP select GENERIC_IOMAP select GENERIC_IRQ_PROBE select GENERIC_IRQ_SHOW
arch/arm64/include/asm/Kbuild +1 -0
@@ -10,6 +10,7 @@ generic-y += delay.h generic-y += div64.h generic-y += dma.h generic-y += emergency-restart.h +generic-y += early_ioremap.h generic-y += errno.h generic-y += ftrace.h generic-y += hw_irq.h
arch/arm64/include/asm/fixmap.h new file +68 -0
68 lines not on this page · raw message
arch/arm64/include/asm/io.h +1 -0
@@ -27,6 +27,7 @@#include <asm/byteorder.h> #include <asm/barrier.h> #include <asm/pgtable.h> +#include <asm/early_ioremap.h> #include <xen/xen.h>
arch/arm64/include/asm/memory.h +1 -1
@@ -49,7 +49,7 @@#define PAGE_OFFSET (UL(0xffffffffffffffff) << (VA_BITS - 1))#define MODULES_END (PAGE_OFFSET)#define MODULES_VADDR (MODULES_END - SZ_64M) -#define EARLYCON_IOBASE (MODULES_VADDR - SZ_4M) +#define FIXADDR_TOP (MODULES_VADDR - SZ_2M - PAGE_SIZE)#define TASK_SIZE_64 (UL(1) << VA_BITS)#ifdef CONFIG_COMPAT
arch/arm64/kernel/early_printk.c +6 -2
@@ -26,6 +26,8 @@#include <linux/amba/serial.h> #include <linux/serial_reg.h> +#include <asm/fixmap.h> +static void __iomem *early_base;static void (*printch)(char ch);
@@ -141,8 +143,10 @@ static int __init setup_early_printk(char *buf) }/* no options parsing yet */ -if (paddr) - early_base =early_io_map (paddr,EARLYCON_IOBASE ); +if (paddr) { +set_fixmap_io (FIX_EARLYCON , paddr); + early_base = (void __iomem *)fix_to_virt (FIX_EARLYCON ); + } printch = match->printch; early_console = &early_console_dev;
arch/arm64/kernel/head.S +3 -6
@@ -412,7 +412,7 @@ ENDPROC(__calc_phys_offset) * - identity mapping to enable the MMU (low address, TTBR0) * - first few MB of the kernel linear mapping to jump to once the MMU has * been enabled, including the FDT blob (TTBR1) - * - UART mapping if CONFIG_EARLY_PRINTK is enabled (TTBR1) + * - pgd entry for fixed mappings (TTBR1) */ __create_page_tables: pgtbl x25, x26, x24 // idmap_pg_dir and swapper_pg_dir addresses
@@ -465,15 +465,12 @@ __create_page_tables: sub x6, x6, #1 // inclusive range create_block_map x0, x7, x3, x5, x6 1: -#ifdef CONFIG_EARLY_PRINTK /* - * Create the pgd entry for the UART mapping. The full mapping is done - * later based earlyprintk kernel parameter. + * Create the pgd entry for the fixed mappings. */ - ldr x5, =EARLYCON_IOBASE // UART virtual address + ldr x5, =FIXADDR_TOP // Fixed mapping virtual address add x0, x26, #2 * PAGE_SIZE // section table address create_pgd_entry x26, x0, x5, x6, x7 -#endif ret ENDPROC(__create_page_tables) .ltorg
arch/arm64/kernel/setup.c +2 -0
@@ -42,6 +42,7 @@#include <linux/of_fdt.h> #include <linux/of_platform.h> +#include <asm/fixmap.h> #include <asm/cputype.h> #include <asm/elf.h> #include <asm/cputable.h>
@@ -222,6 +223,7 @@ void __init setup_arch(char **cmdline_p) *cmdline_p = boot_command_line;init_mem_pgprot (); +early_ioremap_init ();parse_early_param ();
arch/arm64/mm/ioremap.c +85 -0
94 lines not on this page · raw message
arch/arm64/mm/mmu.c +0 -41
47 lines not on this page · raw message
Signature · 7 lines
1.8.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Catalin Marinas
maintainerQuoted 10 lines · Mark Salter
This patch series takes the common bits from the x86 early ioremap implementation and creates a generic implementation which may be used by other architectures. The early ioremap interfaces are intended for situations where boot code needs to make temporary virtual mappings before the normal ioremap interfaces are available. Typically, this means before
paging_init()has run.These patches are layered on top of generic fixmap patches which were discussed here (and are in the akpm tree):
Quoted 6 lines
http://lkml.org/lkml/2013/11/25/474
This is version 2 of the patch series. These patches (and underlying fixmap patches) may be found at:
git://github.com/mosalter/linux.git(early-ioremap-v2 branch)
The patches look fine to me. I haven't acked the arm64 patches as I'll eventually merge/sign them off once the first patch in the series goes in.
Thanks.
Signature · 7 lines
Catalin -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>