On Mon, Mar 04, 2024 at 07:34:44AM +0000, Nikos Nikoleris wrote: > On 27/02/2024 19:21, Andrew Jones wrote: > > Zero is a valid address for the device tree so add an fdt_valid data > > member to determine when the address is valid or not. Also, check the > > device tree GUID when the environment variable is missing. The latter > > change allows directly loading the unit test with QEMU's '-kernel' > > command line parameter, which is much faster than putting the test > > in the EFI file system and then running it from the UEFI shell. > > > > Out of curiosity, the fdt pointer can be zero just in KUT or zero is an > address that efi_load_image or efi_get_system_config_table could return? > Similar code in Linux treats 0 an non valid address https://elixir.bootlin.com/linux/latest/source/drivers/firmware/efi/libstub/fdt.c#L370 Actually, on second thought, it can't be zero. I momentarily forgot that when we get the fdt pointer from EFI it'll be a virtual address (unlike when we get it from x0). For v2, I'll drop the fdt_valid since fdt==NULL is sufficient. > > > Signed-off-by: Andrew Jones <andrew.jones@xxxxxxxxx> > > In any case, this won't hurt: > > Reviewed-by: Nikos Nikoleris <nikos.nikoleris@xxxxxxx> Thanks, drew