diff options
| author | Toshi Kani <toshi.kani@hp.com> | 2015-04-14 18:47:23 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 19:49:04 -0400 |
| commit | e61ce6ade404ef17bd63d62bec78e29047a47b47 (patch) | |
| tree | 4a3e14abad0216e51f781b2776562829febe2626 /lib | |
| parent | 0ddab1d2ed664c85c95488eef569786a84aedf37 (diff) | |
mm: change ioremap to set up huge I/O mappings
ioremap_pud_range() and ioremap_pmd_range() are changed to create huge I/O
mappings when their capability is enabled, and a request meets required
conditions -- both virtual & physical addresses are aligned by their huge
page size, and a requested range fufills their huge page size. When
pud_set_huge() or pmd_set_huge() returns zero, i.e. no-operation is
performed, the code simply falls back to the next level.
The changes are only enabled when CONFIG_HAVE_ARCH_HUGE_VMAP is defined on
the architecture.
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')
| -rw-r--r-- | lib/ioremap.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/ioremap.c b/lib/ioremap.c index 2008652c9a1f..be249062ba6e 100644 --- a/lib/ioremap.c +++ b/lib/ioremap.c | |||
| @@ -80,6 +80,14 @@ static inline int ioremap_pmd_range(pud_t *pud, unsigned long addr, | |||
| 80 | return -ENOMEM; | 80 | return -ENOMEM; |
| 81 | do { | 81 | do { |
| 82 | next = pmd_addr_end(addr, end); | 82 | next = pmd_addr_end(addr, end); |
| 83 | |||
| 84 | if (ioremap_pmd_enabled() && | ||
| 85 | ((next - addr) == PMD_SIZE) && | ||
| 86 | IS_ALIGNED(phys_addr + addr, PMD_SIZE)) { | ||
| 87 | if (pmd_set_huge(pmd, phys_addr + addr, prot)) | ||
| 88 | continue; | ||
| 89 | } | ||
| 90 | |||
| 83 | if (ioremap_pte_range(pmd, addr, next, phys_addr + addr, prot)) | 91 | if (ioremap_pte_range(pmd, addr, next, phys_addr + addr, prot)) |
| 84 | return -ENOMEM; | 92 | return -ENOMEM; |
| 85 | } while (pmd++, addr = next, addr != end); | 93 | } while (pmd++, addr = next, addr != end); |
| @@ -98,6 +106,14 @@ static inline int ioremap_pud_range(pgd_t *pgd, unsigned long addr, | |||
| 98 | return -ENOMEM; | 106 | return -ENOMEM; |
| 99 | do { | 107 | do { |
| 100 | next = pud_addr_end(addr, end); | 108 | next = pud_addr_end(addr, end); |
| 109 | |||
| 110 | if (ioremap_pud_enabled() && | ||
| 111 | ((next - addr) == PUD_SIZE) && | ||
| 112 | IS_ALIGNED(phys_addr + addr, PUD_SIZE)) { | ||
| 113 | if (pud_set_huge(pud, phys_addr + addr, prot)) | ||
| 114 | continue; | ||
| 115 | } | ||
| 116 | |||
| 101 | if (ioremap_pmd_range(pud, addr, next, phys_addr + addr, prot)) | 117 | if (ioremap_pmd_range(pud, addr, next, phys_addr + addr, prot)) |
| 102 | return -ENOMEM; | 118 | return -ENOMEM; |
| 103 | } while (pud++, addr = next, addr != end); | 119 | } while (pud++, addr = next, addr != end); |
