Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lib/ioremap.c: add huge I/O map capability interfaces

Add ioremap_pud_enabled() and ioremap_pmd_enabled(), which return 1 when
I/O mappings with pud/pmd are enabled on the kernel.

ioremap_huge_init() calls arch_ioremap_pud_supported() and
arch_ioremap_pmd_supported() to initialize the capabilities at boot-time.

A new kernel option "nohugeiomap" is also added, so that user can disable
the huge I/O map capabilities when necessary.

Signed-off-by: Toshi Kani <toshi.kani@hp.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Robert Elliott <Elliott@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Toshi Kani and committed by
Linus Torvalds
0ddab1d2 0f616be1

+52
+2
Documentation/kernel-parameters.txt
··· 2323 2323 register save and restore. The kernel will only save 2324 2324 legacy floating-point registers on task switch. 2325 2325 2326 + nohugeiomap [KNL,x86] Disable kernel huge I/O mappings. 2327 + 2326 2328 noxsave [BUGS=X86] Disables x86 extended register state save 2327 2329 and restore using xsave. The kernel will fallback to 2328 2330 enabling legacy floating-point and sse state.
+3
arch/Kconfig
··· 446 446 config HAVE_ARCH_TRANSPARENT_HUGEPAGE 447 447 bool 448 448 449 + config HAVE_ARCH_HUGE_VMAP 450 + bool 451 + 449 452 config HAVE_ARCH_SOFT_DIRTY 450 453 bool 451 454
+8
include/linux/io.h
··· 38 38 } 39 39 #endif 40 40 41 + #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP 42 + void __init ioremap_huge_init(void); 43 + int arch_ioremap_pud_supported(void); 44 + int arch_ioremap_pmd_supported(void); 45 + #else 46 + static inline void ioremap_huge_init(void) { } 47 + #endif 48 + 41 49 /* 42 50 * Managed iomap interface 43 51 */
+2
init/main.c
··· 80 80 #include <linux/list.h> 81 81 #include <linux/integrity.h> 82 82 #include <linux/proc_ns.h> 83 + #include <linux/io.h> 83 84 84 85 #include <asm/io.h> 85 86 #include <asm/bugs.h> ··· 485 484 percpu_init_late(); 486 485 pgtable_init(); 487 486 vmalloc_init(); 487 + ioremap_huge_init(); 488 488 } 489 489 490 490 asmlinkage __visible void __init start_kernel(void)
+37
lib/ioremap.c
··· 13 13 #include <asm/cacheflush.h> 14 14 #include <asm/pgtable.h> 15 15 16 + #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP 17 + int __read_mostly ioremap_pud_capable; 18 + int __read_mostly ioremap_pmd_capable; 19 + int __read_mostly ioremap_huge_disabled; 20 + 21 + static int __init set_nohugeiomap(char *str) 22 + { 23 + ioremap_huge_disabled = 1; 24 + return 0; 25 + } 26 + early_param("nohugeiomap", set_nohugeiomap); 27 + 28 + void __init ioremap_huge_init(void) 29 + { 30 + if (!ioremap_huge_disabled) { 31 + if (arch_ioremap_pud_supported()) 32 + ioremap_pud_capable = 1; 33 + if (arch_ioremap_pmd_supported()) 34 + ioremap_pmd_capable = 1; 35 + } 36 + } 37 + 38 + static inline int ioremap_pud_enabled(void) 39 + { 40 + return ioremap_pud_capable; 41 + } 42 + 43 + static inline int ioremap_pmd_enabled(void) 44 + { 45 + return ioremap_pmd_capable; 46 + } 47 + 48 + #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */ 49 + static inline int ioremap_pud_enabled(void) { return 0; } 50 + static inline int ioremap_pmd_enabled(void) { return 0; } 51 + #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */ 52 + 16 53 static int ioremap_pte_range(pmd_t *pmd, unsigned long addr, 17 54 unsigned long end, phys_addr_t phys_addr, pgprot_t prot) 18 55 {