Skip to contentSkip to conversation

efi: Check the number of EFI configuration tables entries

PATCH In review Rob Bradford 2 participants 3 messages Apr 16, 2019 – May 24, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 efi: Check the number of EFI configuration tables entries

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

---
 arch/x86/platform/efi/quirks.c | 3 +++
 drivers/firmware/efi/efi.c     | 3 +++
 2 files changed, 6 insertions(+)
arch/x86/platform/efi/quirks.c +3 -0
index 95e77a667ba5..6b9a4792242b 100644
@@ -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;
 
drivers/firmware/efi/efi.c +3 -0
index 415849bab233..185424a8b879 100644
@@ -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
Signature · 1 line
2.20.1
#1 lore raw
Quoted 44 lines · 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

---
 arch/x86/platform/efi/quirks.c | 3 +++
 drivers/firmware/efi/efi.c     | 3 +++
 2 files changed, 6 insertions(+)
arch/x86/platform/efi/quirks.c +3 -0
index 95e77a667ba5..6b9a4792242b 100644
@@ -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;
drivers/firmware/efi/efi.c +3 -0
index 415849bab233..185424a8b879 100644
@@ -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);
Quoted 1 line

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

#2 lore raw
Quoted 41 lines · Robert
Quoted 39 lines · 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

---
 arch/x86/platform/efi/quirks.c | 3 +++
 drivers/firmware/efi/efi.c     | 3 +++
 2 files changed, 6 insertions(+)
arch/x86/platform/efi/quirks.c +3 -0
index 95e77a667ba5..6b9a4792242b 100644
@@ -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;
drivers/firmware/efi/efi.c +0 -0
index 415849bab233..185424a8b879 100644
@@ -628,6 +628,9 @@ int __init
 efi_config_init(efi_config_table_type_t *arch_tables)
      void *config_tables;
      int sz, ret;
 
Quoted 11 lines
Quoted 6 lines
drivers/firmware/efi/efi.c +3 -0
+     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.