Skip to content

Commit c70e9b8

Browse files
committed
Merge tag 'm68k-for-v6.3-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
Pull m68k fixes from Geert Uytterhoeven: - Fix systems with memory at end of 32-bit address space - Fix initrd on systems where memory does not start at address zero - Fix 68030 handling of bus errors for addresses in exception tables * tag 'm68k-for-v6.3-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k: m68k: Only force 030 bus error if PC not in exception table m68k: mm: Move initrd phys_to_virt handling after paging_init() m68k: mm: Fix systems with memory at end of 32-bit address space
2 parents 573b22c + e36a82b commit c70e9b8

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

arch/m68k/kernel/setup_mm.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,16 +326,16 @@ void __init setup_arch(char **cmdline_p)
326326
panic("No configuration setup");
327327
}
328328

329-
#ifdef CONFIG_BLK_DEV_INITRD
330-
if (m68k_ramdisk.size) {
329+
if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && m68k_ramdisk.size)
331330
memblock_reserve(m68k_ramdisk.addr, m68k_ramdisk.size);
331+
332+
paging_init();
333+
334+
if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && m68k_ramdisk.size) {
332335
initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
333336
initrd_end = initrd_start + m68k_ramdisk.size;
334337
pr_info("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
335338
}
336-
#endif
337-
338-
paging_init();
339339

340340
#ifdef CONFIG_NATFEAT
341341
nf_init();

arch/m68k/kernel/traps.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/init.h>
3131
#include <linux/ptrace.h>
3232
#include <linux/kallsyms.h>
33+
#include <linux/extable.h>
3334

3435
#include <asm/setup.h>
3536
#include <asm/fpu.h>
@@ -545,7 +546,8 @@ static inline void bus_error030 (struct frame *fp)
545546
errorcode |= 2;
546547

547548
if (mmusr & (MMU_I | MMU_WP)) {
548-
if (ssw & 4) {
549+
/* We might have an exception table for this PC */
550+
if (ssw & 4 && !search_exception_tables(fp->ptregs.pc)) {
549551
pr_err("Data %s fault at %#010lx in %s (pc=%#lx)\n",
550552
ssw & RW ? "read" : "write",
551553
fp->un.fmtb.daddr,

arch/m68k/mm/motorola.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ void __init paging_init(void)
437437
}
438438

439439
min_addr = m68k_memory[0].addr;
440-
max_addr = min_addr + m68k_memory[0].size;
440+
max_addr = min_addr + m68k_memory[0].size - 1;
441441
memblock_add_node(m68k_memory[0].addr, m68k_memory[0].size, 0,
442442
MEMBLOCK_NONE);
443443
for (i = 1; i < m68k_num_memory;) {
@@ -452,21 +452,21 @@ void __init paging_init(void)
452452
}
453453
memblock_add_node(m68k_memory[i].addr, m68k_memory[i].size, i,
454454
MEMBLOCK_NONE);
455-
addr = m68k_memory[i].addr + m68k_memory[i].size;
455+
addr = m68k_memory[i].addr + m68k_memory[i].size - 1;
456456
if (addr > max_addr)
457457
max_addr = addr;
458458
i++;
459459
}
460460
m68k_memoffset = min_addr - PAGE_OFFSET;
461-
m68k_virt_to_node_shift = fls(max_addr - min_addr - 1) - 6;
461+
m68k_virt_to_node_shift = fls(max_addr - min_addr) - 6;
462462

463463
module_fixup(NULL, __start_fixup, __stop_fixup);
464464
flush_icache();
465465

466-
high_memory = phys_to_virt(max_addr);
466+
high_memory = phys_to_virt(max_addr) + 1;
467467

468468
min_low_pfn = availmem >> PAGE_SHIFT;
469-
max_pfn = max_low_pfn = max_addr >> PAGE_SHIFT;
469+
max_pfn = max_low_pfn = (max_addr >> PAGE_SHIFT) + 1;
470470

471471
/* Reserve kernel text/data/bss and the memory allocated in head.S */
472472
memblock_reserve(m68k_memory[0].addr, availmem - m68k_memory[0].addr);

0 commit comments

Comments
 (0)