Skip to content

Commit 6b101e2

Browse files
JoonsooKimtorvalds
authored andcommitted
mm/CMA: fix boot regression due to physical address of high_memory
high_memory isn't direct mapped memory so retrieving it's physical address isn't appropriate. But, it would be useful to check physical address of highmem boundary so it's justfiable to get physical address from it. In x86, there is a validation check if CONFIG_DEBUG_VIRTUAL and it triggers following boot failure reported by Ingo. ... BUG: Int 6: CR2 00f06f53 ... Call Trace: dump_stack+0x41/0x52 early_idt_handler+0x6b/0x6b cma_declare_contiguous+0x33/0x212 dma_contiguous_reserve_area+0x31/0x4e dma_contiguous_reserve+0x11d/0x125 setup_arch+0x7b5/0xb63 start_kernel+0xb8/0x3e6 i386_start_kernel+0x79/0x7d To fix boot regression, this patch implements workaround to avoid validation check in x86 when retrieving physical address of high_memory. __pa_nodebug() used by this patch is implemented only in x86 so there is no choice but to use dirty #ifdef. [akpm@linux-foundation.org: tweak comment] Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com> Reported-by: Ingo Molnar <mingo@kernel.org> Tested-by: Ingo Molnar <mingo@kernel.org> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Russell King <rmk@arm.linux.org.uk> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent d820126 commit 6b101e2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

mm/cma.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,21 @@ int __init cma_declare_contiguous(phys_addr_t base,
215215
bool fixed, struct cma **res_cma)
216216
{
217217
phys_addr_t memblock_end = memblock_end_of_DRAM();
218-
phys_addr_t highmem_start = __pa(high_memory);
218+
phys_addr_t highmem_start;
219219
int ret = 0;
220220

221+
#ifdef CONFIG_X86
222+
/*
223+
* high_memory isn't direct mapped memory so retrieving its physical
224+
* address isn't appropriate. But it would be useful to check the
225+
* physical address of the highmem boundary so it's justfiable to get
226+
* the physical address from it. On x86 there is a validation check for
227+
* this case, so the following workaround is needed to avoid it.
228+
*/
229+
highmem_start = __pa_nodebug(high_memory);
230+
#else
231+
highmem_start = __pa(high_memory);
232+
#endif
221233
pr_debug("%s(size %pa, base %pa, limit %pa alignment %pa)\n",
222234
__func__, &size, &base, &limit, &alignment);
223235

0 commit comments

Comments
 (0)