diff options
author | Laura Abbott <labbott@redhat.com> | 2017-01-10 16:35:41 -0500 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2017-01-11 08:56:49 -0500 |
commit | 2dece445b6dbdaa3d94f38ef44aa1b63bc2a6bb9 (patch) | |
tree | ec3a9b45f2541d3b7e0e371b73add340dbeae0ea /mm/cma.c | |
parent | fa5b6ec9e5274aeae2326e25995506a953e5f878 (diff) |
mm/cma: Cleanup highmem check
6b101e2a3ce4 ("mm/CMA: fix boot regression due to physical address of
high_memory") added checks to use __pa_nodebug on x86 since
CONFIG_DEBUG_VIRTUAL complains about high_memory not being linearlly
mapped. arm64 is now getting support for CONFIG_DEBUG_VIRTUAL as well.
Rather than add an explosion of arches to the #ifdef, switch to an
alternate method to calculate the physical start of highmem using
the page before highmem starts. This avoids the need for the #ifdef and
extra __pa_nodebug calls.
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'mm/cma.c')
-rw-r--r-- | mm/cma.c | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -235,18 +235,13 @@ int __init cma_declare_contiguous(phys_addr_t base, | |||
235 | phys_addr_t highmem_start; | 235 | phys_addr_t highmem_start; |
236 | int ret = 0; | 236 | int ret = 0; |
237 | 237 | ||
238 | #ifdef CONFIG_X86 | ||
239 | /* | 238 | /* |
240 | * high_memory isn't direct mapped memory so retrieving its physical | 239 | * We can't use __pa(high_memory) directly, since high_memory |
241 | * address isn't appropriate. But it would be useful to check the | 240 | * isn't a valid direct map VA, and DEBUG_VIRTUAL will (validly) |
242 | * physical address of the highmem boundary so it's justifiable to get | 241 | * complain. Find the boundary by adding one to the last valid |
243 | * the physical address from it. On x86 there is a validation check for | 242 | * address. |
244 | * this case, so the following workaround is needed to avoid it. | ||
245 | */ | 243 | */ |
246 | highmem_start = __pa_nodebug(high_memory); | 244 | highmem_start = __pa(high_memory - 1) + 1; |
247 | #else | ||
248 | highmem_start = __pa(high_memory); | ||
249 | #endif | ||
250 | pr_debug("%s(size %pa, base %pa, limit %pa alignment %pa)\n", | 245 | pr_debug("%s(size %pa, base %pa, limit %pa alignment %pa)\n", |
251 | __func__, &size, &base, &limit, &alignment); | 246 | __func__, &size, &base, &limit, &alignment); |
252 | 247 | ||