All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Ard Biesheuvel <ardb@kernel.org>, linux-efi@vger.kernel.org
Cc: Matthew Garrett <matthewgarrett@google.com>,
	Ingo Molnar <mingo@kernel.org>, Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Arvind Sankar <nivedita@alum.mit.edu>
Subject: Re: [PATCH v2 13/21] efi/libstub/x86: drop __efi_early() export of efi_config struct
Date: Tue, 24 Dec 2019 20:34:00 +0100	[thread overview]
Message-ID: <463b0b17-3be7-697e-1227-5d3df52996d6@redhat.com> (raw)
In-Reply-To: <20191218170139.9468-14-ardb@kernel.org>

Hi Ard,

On 12/18/19 6:01 PM, Ard Biesheuvel wrote:
> The various pointers we stash in the efi_config struct which we
> retrieve using __efi_early() are simply copies of the ones in
> the EFI system table, which we have started accessing directly
> in the previous patch. So drop all the __efi_early() related
> plumbing, except for the access to a boolean which tells us
> whether the firmware is 64-bit or not.
> 
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

I synced my personal tree yesterday to 5.5-rc3 + the most
recent version (as of yesterday afternoon) of your
efistub-x86-cleanup-v3 branch on top.

This has been working fine on a bunch of devices, but it fails
on a Teclast X89 Bay Trail (mixed mode) device. When reverting all
the commits from your efistub-x86-cleanup-v3 branch one by one, things
start working again after reverting this one.

Regards,

Hans


> ---
>   arch/x86/boot/compressed/eboot.c   | 36 ++++++++------------
>   arch/x86/boot/compressed/head_32.S |  2 +-
>   arch/x86/boot/compressed/head_64.S |  4 +--
>   arch/x86/include/asm/efi.h         | 23 +++++--------
>   4 files changed, 26 insertions(+), 39 deletions(-)
> 
> diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
> index 2bcab1ef5a56..53e67334c4c3 100644
> --- a/arch/x86/boot/compressed/eboot.c
> +++ b/arch/x86/boot/compressed/eboot.c
> @@ -20,11 +20,17 @@
>   
>   static efi_system_table_t *sys_table;
>   
> -static struct efi_config *efi_early;
> +struct efi_config {
> +	u64 image_handle;
> +	u64 table;
> +	bool is64;
> +} __packed;
>   
> -__pure const struct efi_config *__efi_early(void)
> +static bool is64;
> +
> +__pure bool __efi_early_is64(void)
>   {
> -	return efi_early;
> +	return is64;
>   }
>   
>   __pure efi_system_table_t *efi_system_table(void)
> @@ -32,13 +38,6 @@ __pure efi_system_table_t *efi_system_table(void)
>   	return sys_table;
>   }
>   
> -static void setup_boot_services(struct efi_config *c)
> -{
> -	c->runtime_services	= efi_table_attr(efi_system_table, runtime, sys_table);
> -	c->boot_services	= efi_table_attr(efi_system_table, boottime, sys_table);
> -	c->text_output		= efi_table_attr(efi_system_table, con_out, sys_table);
> -}
> -
>   static efi_status_t
>   preserve_pci_rom_image(efi_pci_io_protocol_t *pci, struct pci_setup_rom **__rom)
>   {
> @@ -382,16 +381,14 @@ struct boot_params *make_boot_params(struct efi_config *c)
>   	unsigned long ramdisk_addr;
>   	unsigned long ramdisk_size;
>   
> -	efi_early = c;
> -	sys_table = (efi_system_table_t *)(unsigned long)efi_early->table;
> -	handle = (void *)(unsigned long)efi_early->image_handle;
> +	sys_table = (efi_system_table_t *)(unsigned long)c->table;
> +	handle = (void *)(unsigned long)c->image_handle;
> +	is64 = c->is64;
>   
>   	/* Check if we were booted by the EFI firmware */
>   	if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
>   		return NULL;
>   
> -	setup_boot_services(efi_early);
> -
>   	status = efi_call_early(handle_protocol, handle,
>   				&proto, (void *)&image);
>   	if (status != EFI_SUCCESS) {
> @@ -738,10 +735,9 @@ efi_main(struct efi_config *c, struct boot_params *boot_params)
>   	efi_system_table_t *_table;
>   	unsigned long cmdline_paddr;
>   
> -	efi_early = c;
> -
> -	_table = (efi_system_table_t *)(unsigned long)efi_early->table;
> -	handle = (void *)(unsigned long)efi_early->image_handle;
> +	_table = (efi_system_table_t *)(unsigned long)c->table;
> +	handle = (void *)(unsigned long)c->image_handle;
> +	is64 = c->is64;
>   
>   	sys_table = _table;
>   
> @@ -749,8 +745,6 @@ efi_main(struct efi_config *c, struct boot_params *boot_params)
>   	if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
>   		goto fail;
>   
> -	setup_boot_services(efi_early);
> -
>   	/*
>   	 * make_boot_params() may have been called before efi_main(), in which
>   	 * case this is the second time we parse the cmdline. This is ok,
> diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
> index 7da4dfc53df6..c026ab881405 100644
> --- a/arch/x86/boot/compressed/head_32.S
> +++ b/arch/x86/boot/compressed/head_32.S
> @@ -261,7 +261,7 @@ SYM_FUNC_END(.Lrelocated)
>   #ifdef CONFIG_EFI_STUB
>   	.data
>   efi32_config:
> -	.fill 7,4,0
> +	.fill 4,4,0
>   	.byte 0
>   #endif
>   
> diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
> index 6dc6a7ebb9e1..72065735abc1 100644
> --- a/arch/x86/boot/compressed/head_64.S
> +++ b/arch/x86/boot/compressed/head_64.S
> @@ -672,13 +672,13 @@ SYM_DATA_LOCAL(efi_config, .quad 0)
>   
>   #ifdef CONFIG_EFI_MIXED
>   SYM_DATA_START(efi32_config)
> -	.fill	5,8,0
> +	.fill	2,8,0
>   	.byte	0
>   SYM_DATA_END(efi32_config)
>   #endif
>   
>   SYM_DATA_START(efi64_config)
> -	.fill	5,8,0
> +	.fill	2,8,0
>   	.byte	1
>   SYM_DATA_END(efi64_config)
>   #endif /* CONFIG_EFI_STUB */
> diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
> index e0789ec5c9f6..8137d4f5c104 100644
> --- a/arch/x86/include/asm/efi.h
> +++ b/arch/x86/include/asm/efi.h
> @@ -200,16 +200,7 @@ static inline efi_status_t efi_thunk_set_virtual_address_map(
>   
>   /* arch specific definitions used by the stub code */
>   
> -struct efi_config {
> -	u64 image_handle;
> -	u64 table;
> -	efi_runtime_services_t *runtime_services;
> -	efi_boot_services_t *boot_services;
> -	efi_simple_text_output_protocol_t *text_output;
> -	bool is64;
> -} __packed;
> -
> -__pure const struct efi_config *__efi_early(void);
> +__pure bool __efi_early_is64(void);
>   
>   static inline bool efi_is_64bit(void)
>   {
> @@ -219,7 +210,7 @@ static inline bool efi_is_64bit(void)
>   	if (!IS_ENABLED(CONFIG_EFI_MIXED))
>   		return true;
>   
> -	return __efi_early()->is64;
> +	return __efi_early_is64();
>   }
>   
>   static inline bool efi_is_native(void)
> @@ -252,14 +243,16 @@ static inline bool efi_is_native(void)
>   
>   #define efi_call_early(f, ...)						\
>   	(efi_is_native()						\
> -		? __efi_early()->boot_services->f(__VA_ARGS__)		\
> -		: efi64_thunk(__efi_early()->boot_services->mixed_mode.f,\
> +		? efi_system_table()->boottime->f(__VA_ARGS__)		\
> +		: efi64_thunk(efi_table_attr(efi_boot_services,		\
> +			boottime, efi_system_table())->mixed_mode.f,	\
>   			__VA_ARGS__))
>   
>   #define efi_call_runtime(f, ...)					\
>   	(efi_is_native()						\
> -		? __efi_early()->runtime_services->f(__VA_ARGS__)	\
> -		: efi64_thunk(__efi_early()->runtime_services->mixed_mode.f,\
> +		? efi_system_table()->runtime->f(__VA_ARGS__)		\
> +		: efi64_thunk(efi_table_attr(efi_runtime_services,	\
> +			runtime, efi_system_table())->mixed_mode.f,	\
>   			__VA_ARGS__))
>   
>   extern bool efi_reboot_required(void);
> 


  reply	other threads:[~2019-12-24 19:34 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18 17:01 [PATCH v2 00/21] efi/x86: confine type unsafe casting to mixed mode Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 01/21] efi/libstub: remove unused __efi_call_early() macro Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 02/21] efi/x86: rename efi_is_native() to efi_is_mixed() Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 03/21] efi/libstub: use a helper to iterate over a EFI handle array Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 04/21] efi/libstub: extend native protocol definitions with mixed_mode aliases Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 05/21] efi/libstub: distinguish between native/mixed not 32/64 bit Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 06/21] efi/libstub/x86: use mixed mode helpers to populate efi_config Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 07/21] efi/libstub: drop explicit 32/64-bit protocol definitions Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 08/21] efi/libstub: use stricter typing for firmware function pointers Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 09/21] efi/libstub: annotate firmware routines as __efiapi Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 10/21] efi/libstub/x86: avoid thunking for native firmware calls Ard Biesheuvel
2019-12-21 21:22   ` Hans de Goede
2019-12-22 12:02     ` Ard Biesheuvel
2019-12-22 12:37       ` Ard Biesheuvel
2019-12-22 12:46       ` Andy Lutomirski
2019-12-22 15:29         ` Ard Biesheuvel
2019-12-22 21:12           ` Arvind Sankar
2019-12-22 21:25             ` Ard Biesheuvel
2019-12-23 11:49       ` Hans de Goede
2019-12-23 12:00         ` Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 11/21] efi/libstub: get rid of 'sys_table_arg' macro parameter Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 12/21] efi/libstub: unify the efi_char16_printk implementations Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 13/21] efi/libstub/x86: drop __efi_early() export of efi_config struct Ard Biesheuvel
2019-12-24 19:34   ` Hans de Goede [this message]
2019-12-25 14:42     ` Ard Biesheuvel
2019-12-27 22:44       ` Hans de Goede
2019-12-27 22:51         ` Ard Biesheuvel
2019-12-31 23:04   ` Arvind Sankar
2020-01-01 18:13     ` Ard Biesheuvel
2020-01-01 19:08       ` Arvind Sankar
2020-01-02  7:33         ` Ard Biesheuvel
2020-01-02 14:06           ` Arvind Sankar
2020-01-02 15:20             ` Ard Biesheuvel
2020-01-02 15:51               ` Arvind Sankar
2020-01-02 15:58                 ` Ard Biesheuvel
2020-01-02 16:28                   ` Ard Biesheuvel
2020-01-02 16:59                     ` Ard Biesheuvel
2020-01-02 17:26                       ` Arvind Sankar
2020-01-02 17:30                         ` Ard Biesheuvel
2020-01-02 17:41                           ` Arvind Sankar
2020-01-02 17:48                             ` Ard Biesheuvel
2020-01-02 18:10                               ` Arvind Sankar
2020-01-02 18:38                                 ` Ard Biesheuvel
2020-01-03 14:16                                   ` Arvind Sankar
2020-01-03 14:23                                     ` Ard Biesheuvel
2020-01-02 18:38                               ` Arvind Sankar
2020-01-02 16:59                     ` Arvind Sankar
2020-01-02 17:03                       ` Ard Biesheuvel
2020-01-02 17:21                         ` Arvind Sankar
2019-12-18 17:01 ` [PATCH v2 14/21] efi/libstub: drop sys_table_arg from printk routines Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 15/21] efi/libstub: remove 'sys_table_arg' from all function prototypes Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 16/21] efi/libstub: drop protocol argument from efi_call_proto() macro Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 17/21] efi/libstub: drop 'table' argument from efi_table_attr() macro Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 18/21] efi/libstub: use 'func' not 'f' as macro parameter Ard Biesheuvel
2019-12-31 16:51   ` Arvind Sankar
2019-12-31 17:06     ` Ard Biesheuvel
2019-12-31 17:36       ` Arvind Sankar
2019-12-18 17:01 ` [PATCH v2 19/21] efi/libstub: tidy up types and names of global cmdline variables Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 20/21] efi/libstub: import type definitions for creating and signalling events Ard Biesheuvel
2019-12-18 17:01 ` [PATCH v2 21/21] efi: Allow disabling PCI busmastering on bridges during boot Ard Biesheuvel
2019-12-19  2:50   ` Andy Lutomirski
2019-12-19 13:17     ` Ard Biesheuvel
2019-12-19 20:04       ` Matthew Garrett
2019-12-19 20:04   ` Matthew Garrett
2019-12-20  7:06     ` Ard Biesheuvel
2019-12-20  7:17       ` Andy Lutomirski
2019-12-20  8:11         ` Ard Biesheuvel
2019-12-20 19:41           ` Arvind Sankar
2020-01-02 14:46             ` Laszlo Ersek
2020-01-02 15:40               ` Ard Biesheuvel
2019-12-20 20:43       ` Matthew Garrett
2019-12-21 16:44         ` Ard Biesheuvel
2019-12-21 21:24           ` Matthew Garrett
2019-12-21 22:54             ` Arvind Sankar
2019-12-23 14:02               ` Ard Biesheuvel
2019-12-23 15:46                 ` Arvind Sankar
2019-12-23 15:58                   ` Ard Biesheuvel
2019-12-23 16:12                     ` Arvind Sankar
2019-12-23 20:57                   ` Matthew Garrett
2020-02-06 14:30   ` Hans de Goede
2020-02-06 14:35     ` Ard Biesheuvel
2020-03-04 10:38       ` Hans de Goede
2020-03-04 18:26         ` Ard Biesheuvel
2020-03-04 18:49           ` Hans de Goede
2020-03-04 21:59             ` Ard Biesheuvel
2019-12-19 11:12 ` [PATCH v2 00/21] efi/x86: confine type unsafe casting to mixed mode Hans de Goede
2019-12-19 13:22   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=463b0b17-3be7-697e-1227-5d3df52996d6@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=ardb@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=matthewgarrett@google.com \
    --cc=mingo@kernel.org \
    --cc=nivedita@alum.mit.edu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.