Implement huge I/O mapping capability interfaces on x86. Also define IOREMAP_MAX_ORDER to the size of PUD or PMD on x86. When IOREMAP_MAX_ORDER is not defined on x86, it will be defined to the default value in <linux/vmalloc.h>. Signed-off-by: Toshi Kani <toshi.kani@xxxxxx> --- arch/x86/include/asm/page_types.h | 8 ++++++++ arch/x86/mm/ioremap.c | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h index f97fbe3..debbfff 100644 --- a/arch/x86/include/asm/page_types.h +++ b/arch/x86/include/asm/page_types.h @@ -38,6 +38,14 @@ #define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START) +#ifdef CONFIG_HUGE_IOMAP +#ifdef CONFIG_X86_64 +#define IOREMAP_MAX_ORDER (PUD_SHIFT) +#elif defined(PMD_SHIFT) +#define IOREMAP_MAX_ORDER (PMD_SHIFT) +#endif +#endif /* CONFIG_HUGE_IOMAP */ + #ifdef CONFIG_X86_64 #include <asm/page_64_types.h> #else diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index fdf617c..ef32bec 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -326,6 +326,22 @@ void iounmap(volatile void __iomem *addr) } EXPORT_SYMBOL(iounmap); +#ifdef CONFIG_HUGE_IOMAP +int arch_ioremap_pud_supported(void) +{ +#ifdef CONFIG_X86_64 + return cpu_has_gbpages; +#else + return 0; +#endif +} + +int arch_ioremap_pmd_supported(void) +{ + return cpu_has_pse; +} +#endif /* CONFIG_HUGE_IOMAP */ + /* * Convert a physical pointer to a virtual kernel pointer for /dev/mem * access -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>