diff options
author | Toshi Kani <toshi.kani@hp.com> | 2015-04-14 18:47:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 19:49:04 -0400 |
commit | 0ddab1d2ed664c85c95488eef569786a84aedf37 (patch) | |
tree | b7f2d24f5ba9e307052833500758e0d7bf10bf53 /lib/ioremap.c | |
parent | 0f616be120c632c818faaea9adcb8f05a7a8601f (diff) |
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>
Diffstat (limited to 'lib/ioremap.c')
-rw-r--r-- | lib/ioremap.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/ioremap.c b/lib/ioremap.c index 0c9216c48762..2008652c9a1f 100644 --- a/lib/ioremap.c +++ b/lib/ioremap.c | |||
@@ -13,6 +13,43 @@ | |||
13 | #include <asm/cacheflush.h> | 13 | #include <asm/cacheflush.h> |
14 | #include <asm/pgtable.h> | 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 | static int ioremap_pte_range(pmd_t *pmd, unsigned long addr, | 53 | static int ioremap_pte_range(pmd_t *pmd, unsigned long addr, |
17 | unsigned long end, phys_addr_t phys_addr, pgprot_t prot) | 54 | unsigned long end, phys_addr_t phys_addr, pgprot_t prot) |
18 | { | 55 | { |