"x86/mm: Introduce the 'no5lvl' kernel parameter" broke SETUP_DTB?

From: Alistair Strachan
Date: Fri Nov 02 2018 - 13:59:21 EST


Hi Kirill,

I noticed that booting 4.19 in qemu while injecting a FDT using the
"-dtb /path/to/blob" feature might have been broken by your change
372fddf70904 ("x86/mm: Introduce the 'no5lvl' kernel parameter").

This manifests either as FDT corruption, which causes the setup code
to fail to unpack it (i.e. corruption of the device-tree structure),
or simply bad node data. If I make the below change, the problem goes
away:

diff --git a/arch/x86/boot/compressed/pgtable_64.c
b/arch/x86/boot/compressed/pgtable_64.c
index 8c5107545251..bfe5aca71254 100644
--- a/arch/x86/boot/compressed/pgtable_64.c
+++ b/arch/x86/boot/compressed/pgtable_64.c
@@ -40,7 +40,7 @@ struct paging_config paging_prepare(void *rmode)
unsigned long bios_start, ebda_start;

/* Initialize boot_params. Required for cmdline_find_option_bool(). */
- boot_params = rmode;
+ //boot_params = rmode;

/*
* Check if LA57 is desired and supported.

This can be reproduced with the system-root.dtb file in
https://android.googlesource.com/device/google/cuttlefish/+archive/master.tar.gz
using "qemu -dtb system-root.dtb -kernel /path/to/bzImage -drive
file=root.ext4" on x86_64_defconfig with CONFIG_OF_UNITTEST enabled.

If the FDT is unpacked successfully, the
/proc/device-tree/firmware/android/compatible file will exist, and
contain the string "android,firmware" instead of junk.

I'm still looking into the root cause for this, but I just wanted to
let you know.

Alistair.