Re: [PATCH 03/33] efi/libstub: Unify EFI call wrappers for non-x86

Arvind Sankar
2020-05-03T16:09:49Z

On Sun, May 03, 2020 at 08:09:06AM -0700, Guenter Roeck wrote:
> Hi,
>
> On Fri, Apr 24, 2020 at 03:05:01PM +0200, Ard Biesheuvel wrote:
> > We have wrappers around EFI calls so that x86 can define special
> > versions for mixed mode, while all other architectures can use the
> > same simple definition that just issues the call directly.
> > In preparation for the arrival of yet another architecture that doesn't
> > need anything special here (RISC-V), let's move the default definition
> > into a shared header.
> >
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
>
> This patch causes an immediate reboot in linux-next when booting
> in qemu with an efi32 bios. Bisect log attached.
>
> Qemu command line:
>
> qemu-system-x86_64 -kernel arch/x86/boot/bzImage -m 1G \
> -no-reboot -snapshot \
> -bios OVMF-pure-efi-32.fd \
> -drive file=rootfs.ext2,format=raw \
> --append 'earlycon=uart8250,io,0x3f8,9600n8 panic=-1 root=/dev/sda console=ttyS0' \
> -nographic
>
> The same command succeeds with OVMF-pure-efi-64.fd.
>
> Bisect log attached.
>
> File locations:
> https://github.com/groeck/linux-build-test/blob/master/rootfs/firmware/OVMF-pure-efi-32.fd
> https://github.com/groeck/linux-build-test/blob/master/rootfs/x86_64/rootfs.ext2.gz
>
> Guenter
>

The issue is that efi_is_native is an inline function on x86, not a
macro, so the #ifndef efi_is_native is broken.

We can either turn it into a macro, or add
#define efi_is_native efi_is_native
in arch/x86/include/asm/efi.h.