Skip to content

Commit 6deccaf

Browse files
committed
Merge tag 'parisc-for-7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc fixes from Helge Deller: "While testing Sasha Levin's 'kallsyms: embed source file:line info in kernel stack traces' patch series, which increases the typical kernel image size, I found some issues with the parisc initial kernel mapping which may prevent the kernel to boot. The three small patches here fix this" * tag 'parisc-for-7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Fix initial page table creation for boot parisc: Check kernel mapping earlier at bootup parisc: Increase initial mapping to 64 MB with KALLSYMS
2 parents 8b7f4cd + 8475d8f commit 6deccaf

3 files changed

Lines changed: 19 additions & 10 deletions

File tree

arch/parisc/include/asm/pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ extern void __update_cache(pte_t pte);
8585
printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, (unsigned long)pgd_val(e))
8686

8787
/* This is the size of the initially mapped kernel memory */
88-
#if defined(CONFIG_64BIT)
88+
#if defined(CONFIG_64BIT) || defined(CONFIG_KALLSYMS)
8989
#define KERNEL_INITIAL_ORDER 26 /* 1<<26 = 64MB */
9090
#else
9191
#define KERNEL_INITIAL_ORDER 25 /* 1<<25 = 32MB */

arch/parisc/kernel/head.S

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ ENTRY(parisc_kernel_start)
5656

5757
.import __bss_start,data
5858
.import __bss_stop,data
59+
.import __end,data
5960

6061
load32 PA(__bss_start),%r3
6162
load32 PA(__bss_stop),%r4
@@ -149,7 +150,11 @@ $cpu_ok:
149150
* everything ... it will get remapped correctly later */
150151
ldo 0+_PAGE_KERNEL_RWX(%r0),%r3 /* Hardwired 0 phys addr start */
151152
load32 (1<<(KERNEL_INITIAL_ORDER-PAGE_SHIFT)),%r11 /* PFN count */
152-
load32 PA(pg0),%r1
153+
load32 PA(_end),%r1
154+
SHRREG %r1,PAGE_SHIFT,%r1 /* %r1 is PFN count for _end symbol */
155+
cmpb,<<,n %r11,%r1,1f
156+
copy %r1,%r11 /* %r1 PFN count smaller than %r11 */
157+
1: load32 PA(pg0),%r1
153158

154159
$pgt_fill_loop:
155160
STREGM %r3,ASM_PTE_ENTRY_SIZE(%r1)

arch/parisc/kernel/setup.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,6 @@ void __init setup_arch(char **cmdline_p)
120120
#endif
121121
printk(KERN_CONT ".\n");
122122

123-
/*
124-
* Check if initial kernel page mappings are sufficient.
125-
* panic early if not, else we may access kernel functions
126-
* and variables which can't be reached.
127-
*/
128-
if (__pa((unsigned long) &_end) >= KERNEL_INITIAL_SIZE)
129-
panic("KERNEL_INITIAL_ORDER too small!");
130-
131123
#ifdef CONFIG_64BIT
132124
if(parisc_narrow_firmware) {
133125
printk(KERN_INFO "Kernel is using PDC in 32-bit mode.\n");
@@ -279,6 +271,18 @@ void __init start_parisc(void)
279271
int ret, cpunum;
280272
struct pdc_coproc_cfg coproc_cfg;
281273

274+
/*
275+
* Check if initial kernel page mapping is sufficient.
276+
* Print warning if not, because we may access kernel functions and
277+
* variables which can't be reached yet through the initial mappings.
278+
* Note that the panic() and printk() functions are not functional
279+
* yet, so we need to use direct iodc() firmware calls instead.
280+
*/
281+
const char warn1[] = "CRITICAL: Kernel may crash because "
282+
"KERNEL_INITIAL_ORDER is too small.\n";
283+
if (__pa((unsigned long) &_end) >= KERNEL_INITIAL_SIZE)
284+
pdc_iodc_print(warn1, sizeof(warn1) - 1);
285+
282286
/* check QEMU/SeaBIOS marker in PAGE0 */
283287
running_on_qemu = (memcmp(&PAGE0->pad0, "SeaBIOS", 8) == 0);
284288

0 commit comments

Comments
 (0)