Re: [PATCH] wait_on_bit: add an acquire memory barrier

From: Ard Biesheuvel
Date: Sat Aug 27 2022 - 02:56:30 EST


On Sat, 27 Aug 2022 at 08:32, Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:
>
> On Fri, 26 Aug 2022 at 21:10, Mikulas Patocka <mpatocka@xxxxxxxxxx> wrote:
> >
> >
> >
> > On Fri, 26 Aug 2022, Ard Biesheuvel wrote:
> >
> > > Could you try booting with earlycon?
> > >
> > > Just 'earlycon' and if that does not help,
> >
> > It doesn't help.
> >
> > > 'earlycon=uart8250,mmio32,<uart PA>' [IIRC, mcbin uses 16550
> > > compatible UARTs, right?]
> >
> > mcbin is the host system (running a stable kernel fine). The crash happens
> > in a virtual machine. The vm uses /dev/ttyAMA0 as a console:
> >
> > Serial: AMBA PL011 UART driver
> > 9000000.pl011: ttyAMA0 at MMIO 0x9000000 (irq = 45, base_baud = 0) is a PL011 rev1
> > printk: console [ttyAMA0] enabled
> >
> > I tried earlycon=pl011,mmio32,0x9000000 - but it doesn't help, it hangs
> > without printing anything.
> >
>
> If you are using pl011, you should drop the mmio32 - it only takes a
> physical address (and optionally baud rate etc, but QEMU doesn't need
> those)

Could you try the diff below please?

--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -371,7 +371,9 @@ SYM_FUNC_END(create_idmap)
SYM_FUNC_START_LOCAL(create_kernel_mapping)
adrp x0, init_pg_dir
mov_q x5, KIMAGE_VADDR // compile time __va(_text)
+#ifdef CONFIG_RELOCATABLE
add x5, x5, x23 // add KASLR displacement
+#endif
adrp x6, _end // runtime __pa(_end)
adrp x3, _text // runtime __pa(_text)
sub x6, x6, x3 // _end - _text