On Wed, 19 Dec 2018 at 18:01, Julien Thierry <[email protected]> wrote: > > Hi Ard, > > On 14/12/2018 16:40, Julien Thierry wrote: > > > > > > On 14/12/2018 15:49, Ard Biesheuvel wrote: > >> On Fri, 14 Dec 2018 at 16:23, Julien Thierry <[email protected]> > >> wrote: > >>> > >>> Hi, > >>> > >>> On 13/12/2018 15:03, Julien Thierry wrote: > >>>> > >>>> Argh, not as simple as I had expected. > >>>> > >>>> Turns out include/linux/efi.h does not include asm/efi.h (including it > >>>> at the beginning of the file breaks the build because asm/efi.h misses > >>>> the efi type definitions. > >>>> > >>>> So a thing like: > >>>> > >>>> #ifndef efi_get_irqflags > >>>> #define efi_get_irqflags(flags) local_save_flags(flags) > >>>> #endif > >>>> > >>>> in include/linux/efi.h cannot be overridden. > >>>> > >>>> Either I would need to introduce the definitions arm, arm64 and x86 (I > >>>> don't think there are other arch supporting EFI right now) or I'll need > >>>> to come up with another solution. > >>>> > >>> > >> > >> It might be a bit nasty, but can we put the #ifndef above in > >> runtime-wrappers.c directly? The only reference in linux/efi.h is a > >> macro, so that shouldn't matter afaict. > >> > > > > Sadly, in arch/x86/platform/uv/bios_uv.c, uv_bios_call() has a reference > > to the macro efi_call_virt_pointer() which wouldn't be able to see the > > definition in runtime-wrappers.c > > > > Otherwise, we could've moved efi_call_virt_pointer() and > > __efi_call_virt_pointer in runtime-wrappers.c and things would not have > > been as nasty. > > > > But no, I don't think we can do that without breaking some x86 build :( . > > > > Since the above does not work, would the solution with the > HAVE_GENERIC_EFI_FLAGS below be acceptable to you? Or would you rather I > defined helpers in <asm/efi.h> for all arm/arm64/x86? > > Or neither and I shall find another way? >
Would it be possible to introduce a function efi_call_virt_save_flags() [as a counterpart to efi_call_virt_check_flags()], and put the implementation in runtime-wrappers.c (which already includes asm/efi.h)? That should allow you to put arch-specific hooks in asm/efi.h, and use them in the implementation of efi_call_virt_save_flags(). AFAICT, that removes the need for Kconfig glue.

