linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] efi: Check the number of EFI configuration tables entries
@ 2019-04-16  9:59 Rob Bradford
  2019-05-21 12:20 ` Bradford, Robert
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Bradford @ 2019-04-16  9:59 UTC (permalink / raw)
  To: linux-efi
  Cc: Ard Biesheuvel, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	H . Peter Anvin, Rob Bradford

Only try and access the EFI configuration tables if there there are any
reported. This allows EFI to be continued to used on systems where there
are no configuration table entries.

v2: Move return on nr_tables==0 earlier

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
---
 arch/x86/platform/efi/quirks.c | 3 +++
 drivers/firmware/efi/efi.c     | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
index 95e77a667ba5..6b9a4792242b 100644
--- a/arch/x86/platform/efi/quirks.c
+++ b/arch/x86/platform/efi/quirks.c
@@ -471,6 +471,9 @@ int __init efi_reuse_config(u64 tables, int nr_tables)
 	void *p, *tablep;
 	struct efi_setup_data *data;
 
+	if (nr_tables == 0)
+		return 0;
+
 	if (!efi_setup)
 		return 0;
 
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 415849bab233..185424a8b879 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -628,6 +628,9 @@ int __init efi_config_init(efi_config_table_type_t *arch_tables)
 	void *config_tables;
 	int sz, ret;
 
+	if (efi.systab->nr_tables == 0)
+		return 0;
+
 	if (efi_enabled(EFI_64BIT))
 		sz = sizeof(efi_config_table_64_t);
 	else
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] efi: Check the number of EFI configuration tables entries
  2019-04-16  9:59 [PATCH v2] efi: Check the number of EFI configuration tables entries Rob Bradford
@ 2019-05-21 12:20 ` Bradford, Robert
  2019-05-24 11:20   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Bradford, Robert @ 2019-05-21 12:20 UTC (permalink / raw)
  To: linux-efi; +Cc: tglx, hpa, ard.biesheuvel, mingo, bp

On Tue, 2019-04-16 at 10:59 +0100, Rob Bradford wrote:
> Only try and access the EFI configuration tables if there there are
> any
> reported. This allows EFI to be continued to used on systems where
> there
> are no configuration table entries.
> 
> v2: Move return on nr_tables==0 earlier
> 
> Signed-off-by: Rob Bradford <robert.bradford@intel.com>
> ---
>  arch/x86/platform/efi/quirks.c | 3 +++
>  drivers/firmware/efi/efi.c     | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/arch/x86/platform/efi/quirks.c
> b/arch/x86/platform/efi/quirks.c
> index 95e77a667ba5..6b9a4792242b 100644
> --- a/arch/x86/platform/efi/quirks.c
> +++ b/arch/x86/platform/efi/quirks.c
> @@ -471,6 +471,9 @@ int __init efi_reuse_config(u64 tables, int
> nr_tables)
>  	void *p, *tablep;
>  	struct efi_setup_data *data;
>  
> +	if (nr_tables == 0)
> +		return 0;
> +
>  	if (!efi_setup)
>  		return 0;
>  
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 415849bab233..185424a8b879 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -628,6 +628,9 @@ int __init
> efi_config_init(efi_config_table_type_t *arch_tables)
>  	void *config_tables;
>  	int sz, ret;
>  
> +	if (efi.systab->nr_tables == 0)
> +		return 0;
> +
>  	if (efi_enabled(EFI_64BIT))
>  		sz = sizeof(efi_config_table_64_t);
>  	else

Any chance of getting this into the tree? Without this we can't boot
the kernel in EFI mode on our KVM based hypervisor[1] & firmware[2] as
it does not provide any tables, nor does it need to.

Rob

[1] https://github.com/intel/cloud-hypervisor
[2] https://github.com/intel/rust-hypervisor-firmware




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] efi: Check the number of EFI configuration tables entries
  2019-05-21 12:20 ` Bradford, Robert
@ 2019-05-24 11:20   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2019-05-24 11:20 UTC (permalink / raw)
  To: Bradford, Robert; +Cc: linux-efi, tglx, hpa, mingo, bp

On Tue, 21 May 2019 at 14:20, Bradford, Robert
<robert.bradford@intel.com> wrote:
>
> On Tue, 2019-04-16 at 10:59 +0100, Rob Bradford wrote:
> > Only try and access the EFI configuration tables if there there are
> > any
> > reported. This allows EFI to be continued to used on systems where
> > there
> > are no configuration table entries.
> >
> > v2: Move return on nr_tables==0 earlier
> >
> > Signed-off-by: Rob Bradford <robert.bradford@intel.com>
> > ---
> >  arch/x86/platform/efi/quirks.c | 3 +++
> >  drivers/firmware/efi/efi.c     | 3 +++
> >  2 files changed, 6 insertions(+)
> >
> > diff --git a/arch/x86/platform/efi/quirks.c
> > b/arch/x86/platform/efi/quirks.c
> > index 95e77a667ba5..6b9a4792242b 100644
> > --- a/arch/x86/platform/efi/quirks.c
> > +++ b/arch/x86/platform/efi/quirks.c
> > @@ -471,6 +471,9 @@ int __init efi_reuse_config(u64 tables, int
> > nr_tables)
> >       void *p, *tablep;
> >       struct efi_setup_data *data;
> >
> > +     if (nr_tables == 0)
> > +             return 0;
> > +
> >       if (!efi_setup)
> >               return 0;
> >
> > diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> > index 415849bab233..185424a8b879 100644
> > --- a/drivers/firmware/efi/efi.c
> > +++ b/drivers/firmware/efi/efi.c
> > @@ -628,6 +628,9 @@ int __init
> > efi_config_init(efi_config_table_type_t *arch_tables)
> >       void *config_tables;
> >       int sz, ret;
> >
> > +     if (efi.systab->nr_tables == 0)
> > +             return 0;
> > +
> >       if (efi_enabled(EFI_64BIT))
> >               sz = sizeof(efi_config_table_64_t);
> >       else
>
> Any chance of getting this into the tree? Without this we can't boot
> the kernel in EFI mode on our KVM based hypervisor[1] & firmware[2] as
> it does not provide any tables, nor does it need to.
>

Apologies for the delay. I will pick it up today.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-24 11:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16  9:59 [PATCH v2] efi: Check the number of EFI configuration tables entries Rob Bradford
2019-05-21 12:20 ` Bradford, Robert
2019-05-24 11:20   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).