powerpc/32s: fix booting with CONFIG_PPC_EARLY_DEBUG_BOOTX
authorChristophe Leroy <christophe.leroy@c-s.fr>
Mon, 3 Jun 2019 13:00:51 +0000 (13:00 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 7 Jun 2019 09:00:14 +0000 (19:00 +1000)
When booting through OF, setup_disp_bat() does nothing because
disp_BAT are not set. By change, it used to work because BOOTX
buffer is mapped 1:1 at address 0x81000000 by the bootloader, and
btext_setup_display() sets virt addr same as phys addr.

But since commit 215b823707ce ("powerpc/32s: set up an early static
hash table for KASAN."), a temporary page table overrides the
bootloader mapping.

This 0x81000000 is also problematic with the newly implemented
Kernel Userspace Access Protection (KUAP) because it is within user
address space.

This patch fixes those issues by properly setting disp_BAT through
a call to btext_prepare_BAT(), allowing setup_disp_bat() to
properly setup BAT3 for early bootx screen buffer access.

Reported-by: Mathieu Malaterre <malat@debian.org>
Fixes: 215b823707ce ("powerpc/32s: set up an early static hash table for KASAN.")
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Tested-by: Mathieu Malaterre <malat@debian.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/btext.h
arch/powerpc/kernel/prom_init.c
arch/powerpc/kernel/prom_init_check.sh

index 3ffad030393c13b2c00277953b34f07e648f2e52..461b0f1938647f7730fd08b51d807ef618643760 100644 (file)
@@ -13,7 +13,11 @@ extern void btext_update_display(unsigned long phys, int width, int height,
                                 int depth, int pitch);
 extern void btext_setup_display(int width, int height, int depth, int pitch,
                                unsigned long address);
+#ifdef CONFIG_PPC32
 extern void btext_prepare_BAT(void);
+#else
+static inline void btext_prepare_BAT(void) { }
+#endif
 extern void btext_map(void);
 extern void btext_unmap(void);
 
index 00682b8df3305aa16c5ede61467a33f5207978f9..61795c39de21587030e597374d382ba6edfe487b 100644 (file)
@@ -2340,6 +2340,7 @@ static void __init prom_check_displays(void)
                        prom_printf("W=%d H=%d LB=%d addr=0x%x\n",
                                    width, height, pitch, addr);
                        btext_setup_display(width, height, 8, pitch, addr);
+                       btext_prepare_BAT();
                }
 #endif /* CONFIG_PPC_EARLY_DEBUG_BOOTX */
        }
index 4cac45cb5de53dc8738b29241d4344972bf42881..acf63ad8f4ce90a55a6bc5a48256fb7abb29befc 100644 (file)
@@ -27,7 +27,7 @@ fi
 WHITELIST="add_reloc_offset __bss_start __bss_stop copy_and_flush
 _end enter_prom $MEM_FUNCS reloc_offset __secondary_hold
 __secondary_hold_acknowledge __secondary_hold_spinloop __start
-logo_linux_clut224
+logo_linux_clut224 btext_prepare_BAT
 reloc_got2 kernstart_addr memstart_addr linux_banner _stext
 __prom_init_toc_start __prom_init_toc_end btext_setup_display TOC."