Subject: [PATCH v3 5/9] efi/arm64: libstub: make screen_info accessible to the UEFI stub

From: [email-masked] (Will Deacon)
Date: Thu, 14 Apr 2016 17:46:17 +0100

On Fri, Apr 01, 2016 at 06:05:31PM +0200, Ard Biesheuvel wrote:
> Unlike on 32-bit ARM, where we need to pass the stub's version of struct
> screen_info to the kernel proper via a configuration table, on 64-bit ARM
> it simply involves making the core kernel's copy of struct screen_info
> visible to the stub by exposing an __efistub_ alias for it.
> 
> Signed-off-by: Ard Biesheuvel <[email-masked]>
> ---
>  arch/arm64/include/asm/efi.h | 3 +++
>  arch/arm64/kernel/efi.c      | 3 +++
>  arch/arm64/kernel/image.h    | 1 +
>  3 files changed, 7 insertions(+)

Since I assume this will all go via the EFI tree:

Acked-by: Will Deacon <[email-masked]>

for this patch.

Will

> diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
> index bb26f2205973..ed6c85d3a583 100644
> --- a/arch/arm64/include/asm/efi.h
> +++ b/arch/arm64/include/asm/efi.h
> @@ -54,6 +54,9 @@ int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
>  #define __efi_call_early(f, ...)	f(__VA_ARGS__)
>  #define efi_is_64bit()			(true)
>  
> +#define alloc_screen_info(x...)		&screen_info
> +#define free_screen_info(x...)
> +
>  #define EFI_ALLOC_ALIGN		SZ_64K
>  
>  /*
> diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
> index b6abc852f2a1..6f4b3ea359db 100644
> --- a/arch/arm64/kernel/efi.c
> +++ b/arch/arm64/kernel/efi.c
> @@ -17,6 +17,9 @@
>  
>  #include <asm/efi.h>
>  
> +/* we will fill this structure from the stub, so don't put it in .bss */
> +struct screen_info screen_info __section(.data);
> +
>  int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md)
>  {
>  	pteval_t prot_val;
> diff --git a/arch/arm64/kernel/image.h b/arch/arm64/kernel/image.h
> index 5e360ce88f10..1428849aece8 100644
> --- a/arch/arm64/kernel/image.h
> +++ b/arch/arm64/kernel/image.h
> @@ -112,6 +112,7 @@ __efistub___memset		= KALLSYMS_HIDE(__pi_memset);
>  __efistub__text			= KALLSYMS_HIDE(_text);
>  __efistub__end			= KALLSYMS_HIDE(_end);
>  __efistub__edata		= KALLSYMS_HIDE(_edata);
> +__efistub_screen_info		= KALLSYMS_HIDE(screen_info);
>  
>  #endif
>  
> -- 
> 2.5.0
>