2019-08-12 15:06:06

by Ard Biesheuvel

[permalink] [raw]
Subject: [GIT PULL 0/5] EFI updates for v5.4

The following changes since commit 5f9e832c137075045d15cd6899ab0505cfb2ca4b:

Linus 5.3-rc1 (2019-07-21 14:05:38 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git tags/efi-next

for you to fetch changes up to b194a77fcc4001dc40aecdd15d249648e8a436d1:

efi: cper: print AER info of PCIe fatal error (2019-08-12 12:06:23 +0300)

----------------------------------------------------------------
EFI changes for v5.4:
- Some refactoring of the EFI config table handling across architectures.
- Add support for the Dell EMC OEM config table.
- Include AER diagnostic output to CPER handling of fatal PCIe errors.

----------------------------------------------------------------
Ard Biesheuvel (3):
efi: x86: move efi_is_table_address() into arch/x86
efi/x86: move UV_SYSTAB handling into arch/x86
efi: ia64: move SAL systab handling out of generic EFI code

Narendra K (1):
efi: Export Runtime Configuration Interface table to sysfs

Xiaofei Tan (1):
efi: cper: print AER info of PCIe fatal error

Documentation/ABI/testing/sysfs-firmware-efi | 8 ++
arch/ia64/include/asm/sal.h | 1 +
arch/ia64/include/asm/sn/sn_sal.h | 2 +-
arch/ia64/kernel/efi.c | 3 +
arch/ia64/kernel/setup.c | 2 +-
arch/x86/include/asm/efi.h | 5 +
arch/x86/include/asm/uv/uv.h | 4 +-
arch/x86/mm/ioremap.c | 1 +
arch/x86/platform/efi/efi.c | 39 ++++++-
arch/x86/platform/uv/bios_uv.c | 10 +-
drivers/firmware/efi/Kconfig | 13 +++
drivers/firmware/efi/Makefile | 1 +
drivers/firmware/efi/cper.c | 15 +++
drivers/firmware/efi/efi.c | 39 +------
drivers/firmware/efi/rci2-table.c | 147 +++++++++++++++++++++++++++
include/linux/efi.h | 14 +--
16 files changed, 251 insertions(+), 53 deletions(-)
create mode 100644 drivers/firmware/efi/rci2-table.c


2019-08-12 15:06:14

by Ard Biesheuvel

[permalink] [raw]
Subject: [PATCH 3/5] efi: ia64: move SAL systab handling out of generic EFI code

The SAL systab is an Itanium specific EFI configuration table, so
move its handling into arch/ia64 where it belongs.

Cc; Tony Luck <[email protected]>
Cc: Fenghua Yu <[email protected]>
Cc: [email protected]
Signed-off-by: Ard Biesheuvel <[email protected]>
---
arch/ia64/include/asm/sal.h | 1 +
arch/ia64/include/asm/sn/sn_sal.h | 2 +-
arch/ia64/kernel/efi.c | 3 +++
arch/ia64/kernel/setup.c | 2 +-
arch/x86/platform/efi/efi.c | 1 -
drivers/firmware/efi/efi.c | 2 --
include/linux/efi.h | 1 -
7 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/ia64/include/asm/sal.h b/arch/ia64/include/asm/sal.h
index 588f33156da6..08f5b6aaed73 100644
--- a/arch/ia64/include/asm/sal.h
+++ b/arch/ia64/include/asm/sal.h
@@ -43,6 +43,7 @@
#include <asm/pal.h>
#include <asm/fpu.h>

+extern unsigned long sal_systab_phys;
extern spinlock_t sal_lock;

/* SAL spec _requires_ eight args for each call. */
diff --git a/arch/ia64/include/asm/sn/sn_sal.h b/arch/ia64/include/asm/sn/sn_sal.h
index 1f5ff470a5a1..5142c444652d 100644
--- a/arch/ia64/include/asm/sn/sn_sal.h
+++ b/arch/ia64/include/asm/sn/sn_sal.h
@@ -167,7 +167,7 @@
static inline u32
sn_sal_rev(void)
{
- struct ia64_sal_systab *systab = __va(efi.sal_systab);
+ struct ia64_sal_systab *systab = __va(sal_systab_phys);

return (u32)(systab->sal_b_rev_major << 8 | systab->sal_b_rev_minor);
}
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 3795d18276c4..0a34dcc435c6 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -47,8 +47,11 @@

static __initdata unsigned long palo_phys;

+unsigned long sal_systab_phys = EFI_INVALID_TABLE_ADDR;
+
static __initdata efi_config_table_type_t arch_tables[] = {
{PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID, "PALO", &palo_phys},
+ {SAL_SYSTEM_TABLE_GUID, "SALsystab", &sal_systab_phys},
{NULL_GUID, NULL, 0},
};

diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index c9cfa760cd57..0e1b4eb149b4 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -572,7 +572,7 @@ setup_arch (char **cmdline_p)
find_memory();

/* process SAL system table: */
- ia64_sal_init(__va(efi.sal_systab));
+ ia64_sal_init(__va(sal_systab_phys));

#ifdef CONFIG_ITANIUM
ia64_patch_rse((u64) __start___rse_patchlist, (u64) __end___rse_patchlist);
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 9866a3584765..6697c109c449 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -70,7 +70,6 @@ static const unsigned long * const efi_tables[] = {
&efi.acpi20,
&efi.smbios,
&efi.smbios3,
- &efi.sal_systab,
&efi.boot_info,
&efi.hcdp,
&efi.uga,
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 4dfd873373bd..801925c5bcfb 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -39,7 +39,6 @@ struct efi __read_mostly efi = {
.acpi20 = EFI_INVALID_TABLE_ADDR,
.smbios = EFI_INVALID_TABLE_ADDR,
.smbios3 = EFI_INVALID_TABLE_ADDR,
- .sal_systab = EFI_INVALID_TABLE_ADDR,
.boot_info = EFI_INVALID_TABLE_ADDR,
.hcdp = EFI_INVALID_TABLE_ADDR,
.uga = EFI_INVALID_TABLE_ADDR,
@@ -456,7 +455,6 @@ static __initdata efi_config_table_type_t common_tables[] = {
{ACPI_TABLE_GUID, "ACPI", &efi.acpi},
{HCDP_TABLE_GUID, "HCDP", &efi.hcdp},
{MPS_TABLE_GUID, "MPS", &efi.mps},
- {SAL_SYSTEM_TABLE_GUID, "SALsystab", &efi.sal_systab},
{SMBIOS_TABLE_GUID, "SMBIOS", &efi.smbios},
{SMBIOS3_TABLE_GUID, "SMBIOS 3.0", &efi.smbios3},
{UGA_IO_PROTOCOL_GUID, "UGA", &efi.uga},
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 171bb1005a10..f88318b85fb0 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -984,7 +984,6 @@ extern struct efi {
unsigned long acpi20; /* ACPI table (ACPI 2.0) */
unsigned long smbios; /* SMBIOS table (32 bit entry point) */
unsigned long smbios3; /* SMBIOS table (64 bit entry point) */
- unsigned long sal_systab; /* SAL system table */
unsigned long boot_info; /* boot info table */
unsigned long hcdp; /* HCDP table */
unsigned long uga; /* UGA table */
--
2.17.1

2019-08-12 15:06:27

by Ard Biesheuvel

[permalink] [raw]
Subject: [PATCH 5/5] efi: cper: print AER info of PCIe fatal error

From: Xiaofei Tan <[email protected]>

AER info of PCIe fatal error is not printed in the current driver.
Because APEI driver will panic directly for fatal error, and can't
run to the place of printing AER info.

An example log is as following:
{763}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 11
{763}[Hardware Error]: event severity: fatal
{763}[Hardware Error]: Error 0, type: fatal
{763}[Hardware Error]: section_type: PCIe error
{763}[Hardware Error]: port_type: 0, PCIe end point
{763}[Hardware Error]: version: 4.0
{763}[Hardware Error]: command: 0x0000, status: 0x0010
{763}[Hardware Error]: device_id: 0000:82:00.0
{763}[Hardware Error]: slot: 0
{763}[Hardware Error]: secondary_bus: 0x00
{763}[Hardware Error]: vendor_id: 0x8086, device_id: 0x10fb
{763}[Hardware Error]: class_code: 000002
Kernel panic - not syncing: Fatal hardware error!

This issue was imported by the patch, '37448adfc7ce ("aerdrv: Move
cper_print_aer() call out of interrupt context")'. To fix this issue,
this patch adds print of AER info in cper_print_pcie() for fatal error.

Here is the example log after this patch applied:
{24}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 10
{24}[Hardware Error]: event severity: fatal
{24}[Hardware Error]: Error 0, type: fatal
{24}[Hardware Error]: section_type: PCIe error
{24}[Hardware Error]: port_type: 0, PCIe end point
{24}[Hardware Error]: version: 4.0
{24}[Hardware Error]: command: 0x0546, status: 0x4010
{24}[Hardware Error]: device_id: 0000:01:00.0
{24}[Hardware Error]: slot: 0
{24}[Hardware Error]: secondary_bus: 0x00
{24}[Hardware Error]: vendor_id: 0x15b3, device_id: 0x1019
{24}[Hardware Error]: class_code: 000002
{24}[Hardware Error]: aer_uncor_status: 0x00040000, aer_uncor_mask: 0x00000000
{24}[Hardware Error]: aer_uncor_severity: 0x00062010
{24}[Hardware Error]: TLP Header: 000000c0 01010000 00000001 00000000
Kernel panic - not syncing: Fatal hardware error!

Fixes: 37448adfc7ce ("aerdrv: Move cper_print_aer() call out of interrupt context")
Signed-off-by: Xiaofei Tan <[email protected]>
Reviewed-by: James Morse <[email protected]>
[ardb: put parens around terms of && operator]
Signed-off-by: Ard Biesheuvel <[email protected]>
---
drivers/firmware/efi/cper.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c
index 8fa977c7861f..addf0749dd8b 100644
--- a/drivers/firmware/efi/cper.c
+++ b/drivers/firmware/efi/cper.c
@@ -390,6 +390,21 @@ static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie,
printk(
"%s""bridge: secondary_status: 0x%04x, control: 0x%04x\n",
pfx, pcie->bridge.secondary_status, pcie->bridge.control);
+
+ /* Fatal errors call __ghes_panic() before AER handler prints this */
+ if ((pcie->validation_bits & CPER_PCIE_VALID_AER_INFO) &&
+ (gdata->error_severity & CPER_SEV_FATAL)) {
+ struct aer_capability_regs *aer;
+
+ aer = (struct aer_capability_regs *)pcie->aer_info;
+ printk("%saer_uncor_status: 0x%08x, aer_uncor_mask: 0x%08x\n",
+ pfx, aer->uncor_status, aer->uncor_mask);
+ printk("%saer_uncor_severity: 0x%08x\n",
+ pfx, aer->uncor_severity);
+ printk("%sTLP Header: %08x %08x %08x %08x\n", pfx,
+ aer->header_log.dw0, aer->header_log.dw1,
+ aer->header_log.dw2, aer->header_log.dw3);
+ }
}

static void cper_print_tstamp(const char *pfx,
--
2.17.1

2019-08-12 15:07:12

by Ard Biesheuvel

[permalink] [raw]
Subject: [PATCH 2/5] efi/x86: move UV_SYSTAB handling into arch/x86

The SGI UV UEFI machines are tightly coupled to the x86 architecture
so there is no need to keep any awareness of its existence in the
generic EFI layer, especially since we already have the infrastructure
to handle arch-specific configuration tables, and were even already
using it to some extent.

Signed-off-by: Ard Biesheuvel <[email protected]>
---
arch/x86/include/asm/uv/uv.h | 4 +++-
arch/x86/platform/efi/efi.c | 6 ++++--
arch/x86/platform/uv/bios_uv.c | 10 ++++++----
drivers/firmware/efi/efi.c | 1 -
include/linux/efi.h | 1 -
5 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/uv/uv.h b/arch/x86/include/asm/uv/uv.h
index e60c45fd3679..6bc6d89d8e2a 100644
--- a/arch/x86/include/asm/uv/uv.h
+++ b/arch/x86/include/asm/uv/uv.h
@@ -12,10 +12,12 @@ struct mm_struct;
#ifdef CONFIG_X86_UV
#include <linux/efi.h>

+extern unsigned long uv_systab_phys;
+
extern enum uv_system_type get_uv_system_type(void);
static inline bool is_early_uv_system(void)
{
- return !((efi.uv_systab == EFI_INVALID_TABLE_ADDR) || !efi.uv_systab);
+ return uv_systab_phys && uv_systab_phys != EFI_INVALID_TABLE_ADDR;
}
extern int is_uv_system(void);
extern int is_uv_hubless(void);
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 8d9be97a5607..9866a3584765 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -59,7 +59,7 @@ static efi_system_table_t efi_systab __initdata;

static efi_config_table_type_t arch_tables[] __initdata = {
#ifdef CONFIG_X86_UV
- {UV_SYSTEM_TABLE_GUID, "UVsystab", &efi.uv_systab},
+ {UV_SYSTEM_TABLE_GUID, "UVsystab", &uv_systab_phys},
#endif
{NULL_GUID, NULL, NULL},
};
@@ -74,7 +74,9 @@ static const unsigned long * const efi_tables[] = {
&efi.boot_info,
&efi.hcdp,
&efi.uga,
- &efi.uv_systab,
+#ifdef CONFIG_X86_UV
+ &uv_systab_phys,
+#endif
&efi.fw_vendor,
&efi.runtime,
&efi.config_table,
diff --git a/arch/x86/platform/uv/bios_uv.c b/arch/x86/platform/uv/bios_uv.c
index 7c69652ffeea..c2ee31953372 100644
--- a/arch/x86/platform/uv/bios_uv.c
+++ b/arch/x86/platform/uv/bios_uv.c
@@ -14,6 +14,8 @@
#include <asm/uv/bios.h>
#include <asm/uv/uv_hub.h>

+unsigned long uv_systab_phys __ro_after_init = EFI_INVALID_TABLE_ADDR;
+
struct uv_systab *uv_systab;

static s64 __uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
@@ -185,13 +187,13 @@ EXPORT_SYMBOL_GPL(uv_bios_set_legacy_vga_target);
void uv_bios_init(void)
{
uv_systab = NULL;
- if ((efi.uv_systab == EFI_INVALID_TABLE_ADDR) ||
- !efi.uv_systab || efi_runtime_disabled()) {
+ if ((uv_systab_phys == EFI_INVALID_TABLE_ADDR) ||
+ !uv_systab_phys || efi_runtime_disabled()) {
pr_crit("UV: UVsystab: missing\n");
return;
}

- uv_systab = ioremap(efi.uv_systab, sizeof(struct uv_systab));
+ uv_systab = ioremap(uv_systab_phys, sizeof(struct uv_systab));
if (!uv_systab || strncmp(uv_systab->signature, UV_SYSTAB_SIG, 4)) {
pr_err("UV: UVsystab: bad signature!\n");
iounmap(uv_systab);
@@ -203,7 +205,7 @@ void uv_bios_init(void)
int size = uv_systab->size;

iounmap(uv_systab);
- uv_systab = ioremap(efi.uv_systab, size);
+ uv_systab = ioremap(uv_systab_phys, size);
if (!uv_systab) {
pr_err("UV: UVsystab: ioremap(%d) failed!\n", size);
return;
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index cbdbdbc8f9eb..4dfd873373bd 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -43,7 +43,6 @@ struct efi __read_mostly efi = {
.boot_info = EFI_INVALID_TABLE_ADDR,
.hcdp = EFI_INVALID_TABLE_ADDR,
.uga = EFI_INVALID_TABLE_ADDR,
- .uv_systab = EFI_INVALID_TABLE_ADDR,
.fw_vendor = EFI_INVALID_TABLE_ADDR,
.runtime = EFI_INVALID_TABLE_ADDR,
.config_table = EFI_INVALID_TABLE_ADDR,
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 60a6242765d8..171bb1005a10 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -988,7 +988,6 @@ extern struct efi {
unsigned long boot_info; /* boot info table */
unsigned long hcdp; /* HCDP table */
unsigned long uga; /* UGA table */
- unsigned long uv_systab; /* UV system table */
unsigned long fw_vendor; /* fw_vendor */
unsigned long runtime; /* runtime table */
unsigned long config_table; /* config tables */
--
2.17.1

2019-08-12 15:07:40

by Ard Biesheuvel

[permalink] [raw]
Subject: [PATCH 4/5] efi: Export Runtime Configuration Interface table to sysfs

From: Narendra K <[email protected]>

System firmware advertises the address of the 'Runtime
Configuration Interface table version 2 (RCI2)' via
an EFI Configuration Table entry. This code retrieves the RCI2
table from the address and exports it to sysfs as a binary
attribute 'rci2' under /sys/firmware/efi/tables directory.
The approach adopted is similar to the attribute 'DMI' under
/sys/firmware/dmi/tables.

RCI2 table contains BIOS HII in XML format and is used to populate
BIOS setup page in Dell EMC OpenManage Server Administrator tool.
The BIOS setup page contains BIOS tokens which can be configured.

Signed-off-by: Narendra K <[email protected]>
Reviewed-by: Mario Limonciello <[email protected]>
Signed-off-by: Ard Biesheuvel <[email protected]>
---
Documentation/ABI/testing/sysfs-firmware-efi | 8 +
arch/x86/platform/efi/efi.c | 3 +
drivers/firmware/efi/Kconfig | 13 ++
drivers/firmware/efi/Makefile | 1 +
drivers/firmware/efi/efi.c | 3 +
drivers/firmware/efi/rci2-table.c | 147 +++++++++++++++++++
include/linux/efi.h | 5 +
7 files changed, 180 insertions(+)
create mode 100644 drivers/firmware/efi/rci2-table.c

diff --git a/Documentation/ABI/testing/sysfs-firmware-efi b/Documentation/ABI/testing/sysfs-firmware-efi
index e794eac32a90..5e4d0b27cdfe 100644
--- a/Documentation/ABI/testing/sysfs-firmware-efi
+++ b/Documentation/ABI/testing/sysfs-firmware-efi
@@ -28,3 +28,11 @@ Description: Displays the physical addresses of all EFI Configuration
versions are always printed first, i.e. ACPI20 comes
before ACPI.
Users: dmidecode
+
+What: /sys/firmware/efi/tables/rci2
+Date: July 2019
+Contact: Narendra K <[email protected]>, [email protected]
+Description: Displays the content of the Runtime Configuration Interface
+ Table version 2 on Dell EMC PowerEdge systems in binary format
+Users: It is used by Dell EMC OpenManage Server Administrator tool to
+ populate BIOS setup page.
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 6697c109c449..c202e1b07e29 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -82,6 +82,9 @@ static const unsigned long * const efi_tables[] = {
&efi.esrt,
&efi.properties_table,
&efi.mem_attr_table,
+#ifdef CONFIG_EFI_RCI2_TABLE
+ &rci2_table_phys,
+#endif
};

u64 efi_setup; /* efi setup_data physical address */
diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index d4ea929e8b34..178ee8106828 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -180,6 +180,19 @@ config RESET_ATTACK_MITIGATION
have been evicted, since otherwise it will trigger even on clean
reboots.

+config EFI_RCI2_TABLE
+ bool "EFI Runtime Configuration Interface Table Version 2 Support"
+ help
+ Displays the content of the Runtime Configuration Interface
+ Table version 2 on Dell EMC PowerEdge systems as a binary
+ attribute 'rci2' under /sys/firmware/efi/tables directory.
+
+ RCI2 table contains BIOS HII in XML format and is used to populate
+ BIOS setup page in Dell EMC OpenManage Server Administrator tool.
+ The BIOS setup page contains BIOS tokens which can be configured.
+
+ Say Y here for Dell EMC PowerEdge systems.
+
endmenu

config UEFI_CPER
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile
index d2d0d2030620..4ac2de4dfa72 100644
--- a/drivers/firmware/efi/Makefile
+++ b/drivers/firmware/efi/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_EFI_BOOTLOADER_CONTROL) += efibc.o
obj-$(CONFIG_EFI_TEST) += test/
obj-$(CONFIG_EFI_DEV_PATH_PARSER) += dev-path-parser.o
obj-$(CONFIG_APPLE_PROPERTIES) += apple-properties.o
+obj-$(CONFIG_EFI_RCI2_TABLE) += rci2-table.o

arm-obj-$(CONFIG_EFI) := arm-init.o arm-runtime.o
obj-$(CONFIG_ARM) += $(arm-obj-y)
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 801925c5bcfb..8f1ab04f6743 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -465,6 +465,9 @@ static __initdata efi_config_table_type_t common_tables[] = {
{LINUX_EFI_TPM_EVENT_LOG_GUID, "TPMEventLog", &efi.tpm_log},
{LINUX_EFI_TPM_FINAL_LOG_GUID, "TPMFinalLog", &efi.tpm_final_log},
{LINUX_EFI_MEMRESERVE_TABLE_GUID, "MEMRESERVE", &efi.mem_reserve},
+#ifdef CONFIG_EFI_RCI2_TABLE
+ {DELLEMC_EFI_RCI2_TABLE_GUID, NULL, &rci2_table_phys},
+#endif
{NULL_GUID, NULL, NULL},
};

diff --git a/drivers/firmware/efi/rci2-table.c b/drivers/firmware/efi/rci2-table.c
new file mode 100644
index 000000000000..3e290f96620a
--- /dev/null
+++ b/drivers/firmware/efi/rci2-table.c
@@ -0,0 +1,147 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Export Runtime Configuration Interface Table Version 2 (RCI2)
+ * to sysfs
+ *
+ * Copyright (C) 2019 Dell Inc
+ * by Narendra K <[email protected]>
+ *
+ * System firmware advertises the address of the RCI2 Table via
+ * an EFI Configuration Table entry. This code retrieves the RCI2
+ * table from the address and exports it to sysfs as a binary
+ * attribute 'rci2' under /sys/firmware/efi/tables directory.
+ */
+
+#include <linux/kobject.h>
+#include <linux/device.h>
+#include <linux/sysfs.h>
+#include <linux/efi.h>
+#include <linux/types.h>
+#include <linux/io.h>
+
+#define RCI_SIGNATURE "_RC_"
+
+struct rci2_table_global_hdr {
+ u16 type;
+ u16 resvd0;
+ u16 hdr_len;
+ u8 rci2_sig[4];
+ u16 resvd1;
+ u32 resvd2;
+ u32 resvd3;
+ u8 major_rev;
+ u8 minor_rev;
+ u16 num_of_structs;
+ u32 rci2_len;
+ u16 rci2_chksum;
+} __packed;
+
+static u8 *rci2_base;
+static u32 rci2_table_len;
+unsigned long rci2_table_phys __ro_after_init = EFI_INVALID_TABLE_ADDR;
+
+static ssize_t raw_table_read(struct file *file, struct kobject *kobj,
+ struct bin_attribute *attr, char *buf,
+ loff_t pos, size_t count)
+{
+ memcpy(buf, attr->private + pos, count);
+ return count;
+}
+
+static BIN_ATTR(rci2, S_IRUSR, raw_table_read, NULL, 0);
+
+static u16 checksum(void)
+{
+ u8 len_is_odd = rci2_table_len % 2;
+ u32 chksum_len = rci2_table_len;
+ u16 *base = (u16 *)rci2_base;
+ u8 buf[2] = {0};
+ u32 offset = 0;
+ u16 chksum = 0;
+
+ if (len_is_odd)
+ chksum_len -= 1;
+
+ while (offset < chksum_len) {
+ chksum += *base;
+ offset += 2;
+ base++;
+ }
+
+ if (len_is_odd) {
+ buf[0] = *(u8 *)base;
+ chksum += *(u16 *)(buf);
+ }
+
+ return chksum;
+}
+
+int __init efi_rci2_sysfs_init(void)
+{
+ struct kobject *tables_kobj;
+ int ret = -ENOMEM;
+
+ rci2_base = memremap(rci2_table_phys,
+ sizeof(struct rci2_table_global_hdr),
+ MEMREMAP_WB);
+ if (!rci2_base) {
+ pr_debug("RCI2 table init failed - could not map RCI2 table\n");
+ goto err;
+ }
+
+ if (strncmp(rci2_base +
+ offsetof(struct rci2_table_global_hdr, rci2_sig),
+ RCI_SIGNATURE, 4)) {
+ pr_debug("RCI2 table init failed - incorrect signature\n");
+ ret = -ENODEV;
+ goto err_unmap;
+ }
+
+ rci2_table_len = *(u32 *)(rci2_base +
+ offsetof(struct rci2_table_global_hdr,
+ rci2_len));
+
+ memunmap(rci2_base);
+
+ if (!rci2_table_len) {
+ pr_debug("RCI2 table init failed - incorrect table length\n");
+ goto err;
+ }
+
+ rci2_base = memremap(rci2_table_phys, rci2_table_len, MEMREMAP_WB);
+ if (!rci2_base) {
+ pr_debug("RCI2 table - could not map RCI2 table\n");
+ goto err;
+ }
+
+ if (checksum() != 0) {
+ pr_debug("RCI2 table - incorrect checksum\n");
+ ret = -ENODEV;
+ goto err_unmap;
+ }
+
+ tables_kobj = kobject_create_and_add("tables", efi_kobj);
+ if (!tables_kobj) {
+ pr_debug("RCI2 table - tables_kobj creation failed\n");
+ goto err_unmap;
+ }
+
+ bin_attr_rci2.size = rci2_table_len;
+ bin_attr_rci2.private = rci2_base;
+ ret = sysfs_create_bin_file(tables_kobj, &bin_attr_rci2);
+ if (ret != 0) {
+ pr_debug("RCI2 table - rci2 sysfs bin file creation failed\n");
+ kobject_del(tables_kobj);
+ kobject_put(tables_kobj);
+ goto err_unmap;
+ }
+
+ return 0;
+
+ err_unmap:
+ memunmap(rci2_base);
+ err:
+ pr_debug("RCI2 table - sysfs initialization failed\n");
+ return ret;
+}
+late_initcall(efi_rci2_sysfs_init);
diff --git a/include/linux/efi.h b/include/linux/efi.h
index f88318b85fb0..bd3837022307 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -692,6 +692,9 @@ void efi_native_runtime_setup(void);
#define LINUX_EFI_TPM_FINAL_LOG_GUID EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25)
#define LINUX_EFI_MEMRESERVE_TABLE_GUID EFI_GUID(0x888eb0c6, 0x8ede, 0x4ff5, 0xa8, 0xf0, 0x9a, 0xee, 0x5c, 0xb9, 0x77, 0xc2)

+/* OEM GUIDs */
+#define DELLEMC_EFI_RCI2_TABLE_GUID EFI_GUID(0x2d9f28a2, 0xa886, 0x456a, 0x97, 0xa8, 0xf1, 0x1e, 0xf2, 0x4f, 0xf4, 0x55)
+
typedef struct {
efi_guid_t guid;
u64 table;
@@ -1713,6 +1716,8 @@ struct efi_tcg2_final_events_table {
};
extern int efi_tpm_final_log_size;

+extern unsigned long rci2_table_phys;
+
/*
* efi_runtime_service() function identifiers.
* "NONE" is used by efi_recover_from_page_fault() to check if the page
--
2.17.1

2019-08-12 15:08:28

by Ard Biesheuvel

[permalink] [raw]
Subject: [PATCH 1/5] efi: x86: move efi_is_table_address() into arch/x86

The function efi_is_table_address() and the associated array of table
pointers is specific to x86. Since we will be adding some more x86
specific tables, let's move this code out of the generic code first.

Signed-off-by: Ard Biesheuvel <[email protected]>
---
arch/x86/include/asm/efi.h | 5 +++++
arch/x86/mm/ioremap.c | 1 +
arch/x86/platform/efi/efi.c | 33 +++++++++++++++++++++++++++++++++
drivers/firmware/efi/efi.c | 33 ---------------------------------
include/linux/efi.h | 7 -------
5 files changed, 39 insertions(+), 40 deletions(-)

diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 606a4b6a9812..43a82e59c59d 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -242,6 +242,7 @@ static inline bool efi_is_64bit(void)
__efi_early()->runtime_services), __VA_ARGS__)

extern bool efi_reboot_required(void);
+extern bool efi_is_table_address(unsigned long phys_addr);

#else
static inline void parse_efi_setup(u64 phys_addr, u32 data_len) {}
@@ -249,6 +250,10 @@ static inline bool efi_reboot_required(void)
{
return false;
}
+static inline bool efi_is_table_address(unsigned long phys_addr)
+{
+ return false;
+}
#endif /* CONFIG_EFI */

#endif /* _ASM_X86_EFI_H */
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 63e99f15d7cf..a39dcdb5ae34 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -19,6 +19,7 @@

#include <asm/set_memory.h>
#include <asm/e820/api.h>
+#include <asm/efi.h>
#include <asm/fixmap.h>
#include <asm/pgtable.h>
#include <asm/tlbflush.h>
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index a7189a3b4d70..8d9be97a5607 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -64,6 +64,25 @@ static efi_config_table_type_t arch_tables[] __initdata = {
{NULL_GUID, NULL, NULL},
};

+static const unsigned long * const efi_tables[] = {
+ &efi.mps,
+ &efi.acpi,
+ &efi.acpi20,
+ &efi.smbios,
+ &efi.smbios3,
+ &efi.sal_systab,
+ &efi.boot_info,
+ &efi.hcdp,
+ &efi.uga,
+ &efi.uv_systab,
+ &efi.fw_vendor,
+ &efi.runtime,
+ &efi.config_table,
+ &efi.esrt,
+ &efi.properties_table,
+ &efi.mem_attr_table,
+};
+
u64 efi_setup; /* efi setup_data physical address */

static int add_efi_memmap __initdata;
@@ -1049,3 +1068,17 @@ static int __init arch_parse_efi_cmdline(char *str)
return 0;
}
early_param("efi", arch_parse_efi_cmdline);
+
+bool efi_is_table_address(unsigned long phys_addr)
+{
+ unsigned int i;
+
+ if (phys_addr == EFI_INVALID_TABLE_ADDR)
+ return false;
+
+ for (i = 0; i < ARRAY_SIZE(efi_tables); i++)
+ if (*(efi_tables[i]) == phys_addr)
+ return true;
+
+ return false;
+}
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index ad3b1f4866b3..cbdbdbc8f9eb 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -57,25 +57,6 @@ struct efi __read_mostly efi = {
};
EXPORT_SYMBOL(efi);

-static unsigned long *efi_tables[] = {
- &efi.mps,
- &efi.acpi,
- &efi.acpi20,
- &efi.smbios,
- &efi.smbios3,
- &efi.sal_systab,
- &efi.boot_info,
- &efi.hcdp,
- &efi.uga,
- &efi.uv_systab,
- &efi.fw_vendor,
- &efi.runtime,
- &efi.config_table,
- &efi.esrt,
- &efi.properties_table,
- &efi.mem_attr_table,
-};
-
struct mm_struct efi_mm = {
.mm_rb = RB_ROOT,
.mm_users = ATOMIC_INIT(2),
@@ -964,20 +945,6 @@ int efi_status_to_err(efi_status_t status)
return err;
}

-bool efi_is_table_address(unsigned long phys_addr)
-{
- unsigned int i;
-
- if (phys_addr == EFI_INVALID_TABLE_ADDR)
- return false;
-
- for (i = 0; i < ARRAY_SIZE(efi_tables); i++)
- if (*(efi_tables[i]) == phys_addr)
- return true;
-
- return false;
-}
-
static DEFINE_SPINLOCK(efi_mem_reserve_persistent_lock);
static struct linux_efi_memreserve *efi_memreserve_root __ro_after_init;

diff --git a/include/linux/efi.h b/include/linux/efi.h
index f87fabea4a85..60a6242765d8 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1211,8 +1211,6 @@ static inline bool efi_enabled(int feature)
return test_bit(feature, &efi.flags) != 0;
}
extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
-
-extern bool efi_is_table_address(unsigned long phys_addr);
#else
static inline bool efi_enabled(int feature)
{
@@ -1226,11 +1224,6 @@ efi_capsule_pending(int *reset_type)
{
return false;
}
-
-static inline bool efi_is_table_address(unsigned long phys_addr)
-{
- return false;
-}
#endif

extern int efi_status_to_err(efi_status_t status);
--
2.17.1

2019-10-01 08:55:13

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 4/5] efi: Export Runtime Configuration Interface table to sysfs

Hi Ard, Narendra,

On Mon, Aug 12, 2019 at 5:07 PM Ard Biesheuvel
<[email protected]> wrote:
> From: Narendra K <[email protected]>
>
> System firmware advertises the address of the 'Runtime
> Configuration Interface table version 2 (RCI2)' via
> an EFI Configuration Table entry. This code retrieves the RCI2
> table from the address and exports it to sysfs as a binary
> attribute 'rci2' under /sys/firmware/efi/tables directory.
> The approach adopted is similar to the attribute 'DMI' under
> /sys/firmware/dmi/tables.
>
> RCI2 table contains BIOS HII in XML format and is used to populate
> BIOS setup page in Dell EMC OpenManage Server Administrator tool.
> The BIOS setup page contains BIOS tokens which can be configured.
>
> Signed-off-by: Narendra K <[email protected]>
> Reviewed-by: Mario Limonciello <[email protected]>
> Signed-off-by: Ard Biesheuvel <[email protected]>

Thanks, this is now commit 1c5fecb61255aa12 ("efi: Export Runtime
Configuration Interface table to sysfs").

> --- a/drivers/firmware/efi/Kconfig
> +++ b/drivers/firmware/efi/Kconfig
> @@ -180,6 +180,19 @@ config RESET_ATTACK_MITIGATION
> have been evicted, since otherwise it will trigger even on clean
> reboots.
>
> +config EFI_RCI2_TABLE
> + bool "EFI Runtime Configuration Interface Table Version 2 Support"
> + help
> + Displays the content of the Runtime Configuration Interface
> + Table version 2 on Dell EMC PowerEdge systems as a binary
> + attribute 'rci2' under /sys/firmware/efi/tables directory.
> +
> + RCI2 table contains BIOS HII in XML format and is used to populate
> + BIOS setup page in Dell EMC OpenManage Server Administrator tool.
> + The BIOS setup page contains BIOS tokens which can be configured.
> +
> + Say Y here for Dell EMC PowerEdge systems.

A quick Google search tells me these are Intel Xeon.
Are arm/arm64/ia64 variants available, too?
If not, this should be protected by "depends on x86" ("|| COMPILE_TEST"?).

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2019-10-01 08:55:57

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: [PATCH 4/5] efi: Export Runtime Configuration Interface table to sysfs

On Tue, 1 Oct 2019 at 10:51, Geert Uytterhoeven <[email protected]> wrote:
>
> Hi Ard, Narendra,
>
> On Mon, Aug 12, 2019 at 5:07 PM Ard Biesheuvel
> <[email protected]> wrote:
> > From: Narendra K <[email protected]>
> >
> > System firmware advertises the address of the 'Runtime
> > Configuration Interface table version 2 (RCI2)' via
> > an EFI Configuration Table entry. This code retrieves the RCI2
> > table from the address and exports it to sysfs as a binary
> > attribute 'rci2' under /sys/firmware/efi/tables directory.
> > The approach adopted is similar to the attribute 'DMI' under
> > /sys/firmware/dmi/tables.
> >
> > RCI2 table contains BIOS HII in XML format and is used to populate
> > BIOS setup page in Dell EMC OpenManage Server Administrator tool.
> > The BIOS setup page contains BIOS tokens which can be configured.
> >
> > Signed-off-by: Narendra K <[email protected]>
> > Reviewed-by: Mario Limonciello <[email protected]>
> > Signed-off-by: Ard Biesheuvel <[email protected]>
>
> Thanks, this is now commit 1c5fecb61255aa12 ("efi: Export Runtime
> Configuration Interface table to sysfs").
>
> > --- a/drivers/firmware/efi/Kconfig
> > +++ b/drivers/firmware/efi/Kconfig
> > @@ -180,6 +180,19 @@ config RESET_ATTACK_MITIGATION
> > have been evicted, since otherwise it will trigger even on clean
> > reboots.
> >
> > +config EFI_RCI2_TABLE
> > + bool "EFI Runtime Configuration Interface Table Version 2 Support"
> > + help
> > + Displays the content of the Runtime Configuration Interface
> > + Table version 2 on Dell EMC PowerEdge systems as a binary
> > + attribute 'rci2' under /sys/firmware/efi/tables directory.
> > +
> > + RCI2 table contains BIOS HII in XML format and is used to populate
> > + BIOS setup page in Dell EMC OpenManage Server Administrator tool.
> > + The BIOS setup page contains BIOS tokens which can be configured.
> > +
> > + Say Y here for Dell EMC PowerEdge systems.
>
> A quick Google search tells me these are Intel Xeon.
> Are arm/arm64/ia64 variants available, too?
> If not, this should be protected by "depends on x86" ("|| COMPILE_TEST"?).
>

Hello Geert,

The code in question is entirely architecture agnostic, and defaults
to 'n', so I am not convinced this is needed. (It came up in the
review as well)

2019-10-01 09:06:43

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 4/5] efi: Export Runtime Configuration Interface table to sysfs

Hi Ard,

On Tue, Oct 1, 2019 at 10:54 AM Ard Biesheuvel
<[email protected]> wrote:
> On Tue, 1 Oct 2019 at 10:51, Geert Uytterhoeven <[email protected]> wrote:
> > On Mon, Aug 12, 2019 at 5:07 PM Ard Biesheuvel
> > <[email protected]> wrote:
> > > From: Narendra K <[email protected]>
> > >
> > > System firmware advertises the address of the 'Runtime
> > > Configuration Interface table version 2 (RCI2)' via
> > > an EFI Configuration Table entry. This code retrieves the RCI2
> > > table from the address and exports it to sysfs as a binary
> > > attribute 'rci2' under /sys/firmware/efi/tables directory.
> > > The approach adopted is similar to the attribute 'DMI' under
> > > /sys/firmware/dmi/tables.
> > >
> > > RCI2 table contains BIOS HII in XML format and is used to populate
> > > BIOS setup page in Dell EMC OpenManage Server Administrator tool.
> > > The BIOS setup page contains BIOS tokens which can be configured.
> > >
> > > Signed-off-by: Narendra K <[email protected]>
> > > Reviewed-by: Mario Limonciello <[email protected]>
> > > Signed-off-by: Ard Biesheuvel <[email protected]>
> >
> > Thanks, this is now commit 1c5fecb61255aa12 ("efi: Export Runtime
> > Configuration Interface table to sysfs").
> >
> > > --- a/drivers/firmware/efi/Kconfig
> > > +++ b/drivers/firmware/efi/Kconfig
> > > @@ -180,6 +180,19 @@ config RESET_ATTACK_MITIGATION
> > > have been evicted, since otherwise it will trigger even on clean
> > > reboots.
> > >
> > > +config EFI_RCI2_TABLE
> > > + bool "EFI Runtime Configuration Interface Table Version 2 Support"
> > > + help
> > > + Displays the content of the Runtime Configuration Interface
> > > + Table version 2 on Dell EMC PowerEdge systems as a binary
> > > + attribute 'rci2' under /sys/firmware/efi/tables directory.
> > > +
> > > + RCI2 table contains BIOS HII in XML format and is used to populate
> > > + BIOS setup page in Dell EMC OpenManage Server Administrator tool.
> > > + The BIOS setup page contains BIOS tokens which can be configured.
> > > +
> > > + Say Y here for Dell EMC PowerEdge systems.
> >
> > A quick Google search tells me these are Intel Xeon.
> > Are arm/arm64/ia64 variants available, too?
> > If not, this should be protected by "depends on x86" ("|| COMPILE_TEST"?).
>
> The code in question is entirely architecture agnostic, and defaults
> to 'n', so I am not convinced this is needed. (It came up in the
> review as well)

"make oldconfig" still asks me the question on e.g. arm64, where it is
irrelevant, until arm64 variants of the hardware show up.

So IMHO it should have "depends on X86 || COMPILE_TEST".

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2019-10-01 09:42:53

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: [PATCH 4/5] efi: Export Runtime Configuration Interface table to sysfs

On Tue, 1 Oct 2019 at 11:03, Geert Uytterhoeven <[email protected]> wrote:
>
> Hi Ard,
>
> On Tue, Oct 1, 2019 at 10:54 AM Ard Biesheuvel
> <[email protected]> wrote:
> > On Tue, 1 Oct 2019 at 10:51, Geert Uytterhoeven <[email protected]> wrote:
> > > On Mon, Aug 12, 2019 at 5:07 PM Ard Biesheuvel
> > > <[email protected]> wrote:
> > > > From: Narendra K <[email protected]>
> > > >
> > > > System firmware advertises the address of the 'Runtime
> > > > Configuration Interface table version 2 (RCI2)' via
> > > > an EFI Configuration Table entry. This code retrieves the RCI2
> > > > table from the address and exports it to sysfs as a binary
> > > > attribute 'rci2' under /sys/firmware/efi/tables directory.
> > > > The approach adopted is similar to the attribute 'DMI' under
> > > > /sys/firmware/dmi/tables.
> > > >
> > > > RCI2 table contains BIOS HII in XML format and is used to populate
> > > > BIOS setup page in Dell EMC OpenManage Server Administrator tool.
> > > > The BIOS setup page contains BIOS tokens which can be configured.
> > > >
> > > > Signed-off-by: Narendra K <[email protected]>
> > > > Reviewed-by: Mario Limonciello <[email protected]>
> > > > Signed-off-by: Ard Biesheuvel <[email protected]>
> > >
> > > Thanks, this is now commit 1c5fecb61255aa12 ("efi: Export Runtime
> > > Configuration Interface table to sysfs").
> > >
> > > > --- a/drivers/firmware/efi/Kconfig
> > > > +++ b/drivers/firmware/efi/Kconfig
> > > > @@ -180,6 +180,19 @@ config RESET_ATTACK_MITIGATION
> > > > have been evicted, since otherwise it will trigger even on clean
> > > > reboots.
> > > >
> > > > +config EFI_RCI2_TABLE
> > > > + bool "EFI Runtime Configuration Interface Table Version 2 Support"
> > > > + help
> > > > + Displays the content of the Runtime Configuration Interface
> > > > + Table version 2 on Dell EMC PowerEdge systems as a binary
> > > > + attribute 'rci2' under /sys/firmware/efi/tables directory.
> > > > +
> > > > + RCI2 table contains BIOS HII in XML format and is used to populate
> > > > + BIOS setup page in Dell EMC OpenManage Server Administrator tool.
> > > > + The BIOS setup page contains BIOS tokens which can be configured.
> > > > +
> > > > + Say Y here for Dell EMC PowerEdge systems.
> > >
> > > A quick Google search tells me these are Intel Xeon.
> > > Are arm/arm64/ia64 variants available, too?
> > > If not, this should be protected by "depends on x86" ("|| COMPILE_TEST"?).
> >
> > The code in question is entirely architecture agnostic, and defaults
> > to 'n', so I am not convinced this is needed. (It came up in the
> > review as well)
>
> "make oldconfig" still asks me the question on e.g. arm64, where it is
> irrelevant, until arm64 variants of the hardware show up.
>
> So IMHO it should have "depends on X86 || COMPILE_TEST".
>

Fair enough. I am going to send out a bunch of EFI fixes this week, so
I'll accept a patch that makes the change above.

2019-10-01 13:22:44

by Mario Limonciello

[permalink] [raw]
Subject: RE: [PATCH 4/5] efi: Export Runtime Configuration Interface table to sysfs

> -----Original Message-----
> From: Ard Biesheuvel <[email protected]>
> Sent: Tuesday, October 1, 2019 4:42 AM
> To: Geert Uytterhoeven
> Cc: K, Narendra; linux-efi; Ingo Molnar; Thomas Gleixner; Linux Kernel Mailing List;
> James Morse; Limonciello, Mario; Xiaofei Tan
> Subject: Re: [PATCH 4/5] efi: Export Runtime Configuration Interface table to sysfs
>
>
> [EXTERNAL EMAIL]
>
> On Tue, 1 Oct 2019 at 11:03, Geert Uytterhoeven <[email protected]> wrote:
> >
> > Hi Ard,
> >
> > On Tue, Oct 1, 2019 at 10:54 AM Ard Biesheuvel
> > <[email protected]> wrote:
> > > On Tue, 1 Oct 2019 at 10:51, Geert Uytterhoeven <[email protected]>
> wrote:
> > > > On Mon, Aug 12, 2019 at 5:07 PM Ard Biesheuvel
> > > > <[email protected]> wrote:
> > > > > From: Narendra K <[email protected]>
> > > > >
> > > > > System firmware advertises the address of the 'Runtime
> > > > > Configuration Interface table version 2 (RCI2)' via
> > > > > an EFI Configuration Table entry. This code retrieves the RCI2
> > > > > table from the address and exports it to sysfs as a binary
> > > > > attribute 'rci2' under /sys/firmware/efi/tables directory.
> > > > > The approach adopted is similar to the attribute 'DMI' under
> > > > > /sys/firmware/dmi/tables.
> > > > >
> > > > > RCI2 table contains BIOS HII in XML format and is used to populate
> > > > > BIOS setup page in Dell EMC OpenManage Server Administrator tool.
> > > > > The BIOS setup page contains BIOS tokens which can be configured.
> > > > >
> > > > > Signed-off-by: Narendra K <[email protected]>
> > > > > Reviewed-by: Mario Limonciello <[email protected]>
> > > > > Signed-off-by: Ard Biesheuvel <[email protected]>
> > > >
> > > > Thanks, this is now commit 1c5fecb61255aa12 ("efi: Export Runtime
> > > > Configuration Interface table to sysfs").
> > > >
> > > > > --- a/drivers/firmware/efi/Kconfig
> > > > > +++ b/drivers/firmware/efi/Kconfig
> > > > > @@ -180,6 +180,19 @@ config RESET_ATTACK_MITIGATION
> > > > > have been evicted, since otherwise it will trigger even on clean
> > > > > reboots.
> > > > >
> > > > > +config EFI_RCI2_TABLE
> > > > > + bool "EFI Runtime Configuration Interface Table Version 2 Support"
> > > > > + help
> > > > > + Displays the content of the Runtime Configuration Interface
> > > > > + Table version 2 on Dell EMC PowerEdge systems as a binary
> > > > > + attribute 'rci2' under /sys/firmware/efi/tables directory.
> > > > > +
> > > > > + RCI2 table contains BIOS HII in XML format and is used to populate
> > > > > + BIOS setup page in Dell EMC OpenManage Server Administrator tool.
> > > > > + The BIOS setup page contains BIOS tokens which can be configured.
> > > > > +
> > > > > + Say Y here for Dell EMC PowerEdge systems.
> > > >
> > > > A quick Google search tells me these are Intel Xeon.
> > > > Are arm/arm64/ia64 variants available, too?
> > > > If not, this should be protected by "depends on x86" ("|| COMPILE_TEST"?).
> > >
> > > The code in question is entirely architecture agnostic, and defaults
> > > to 'n', so I am not convinced this is needed. (It came up in the
> > > review as well)
> >
> > "make oldconfig" still asks me the question on e.g. arm64, where it is
> > irrelevant, until arm64 variants of the hardware show up.
> >
> > So IMHO it should have "depends on X86 || COMPILE_TEST".
> >
>
> Fair enough. I am going to send out a bunch of EFI fixes this week, so
> I'll accept a patch that makes the change above.

Is it really a problem to just say n?

I think this seems like a needless change that would slow down adoption of
!x86 if Dell EMC PowerEdge systems did start going that route, especially
when it comes to distributions that move glacially slow with picking up new
kernel code.

2019-10-01 18:04:45

by K, Narendra

[permalink] [raw]
Subject: Re: [PATCH 4/5] efi: Export Runtime Configuration Interface table to sysfs

On Tue, Oct 01, 2019 at 01:20:46PM +0000, Limonciello, Mario wrote:
[...]
> > > > > > +config EFI_RCI2_TABLE
> > > > > > + bool "EFI Runtime Configuration Interface Table Version 2 Support"
> > > > > > + help
> > > > > > + Displays the content of the Runtime Configuration Interface
> > > > > > + Table version 2 on Dell EMC PowerEdge systems as a binary
> > > > > > + attribute 'rci2' under /sys/firmware/efi/tables directory.
> > > > > > +
> > > > > > + RCI2 table contains BIOS HII in XML format and is used to populate
> > > > > > + BIOS setup page in Dell EMC OpenManage Server Administrator tool.
> > > > > > + The BIOS setup page contains BIOS tokens which can be configured.
> > > > > > +
> > > > > > + Say Y here for Dell EMC PowerEdge systems.
> > > > >
> > > > > A quick Google search tells me these are Intel Xeon.
> > > > > Are arm/arm64/ia64 variants available, too?
> > > > > If not, this should be protected by "depends on x86" ("|| COMPILE_TEST"?).
> > > >
> > > > The code in question is entirely architecture agnostic, and defaults
> > > > to 'n', so I am not convinced this is needed. (It came up in the
> > > > review as well)
> > >
> > > "make oldconfig" still asks me the question on e.g. arm64, where it is
> > > irrelevant, until arm64 variants of the hardware show up.
> > >
> > > So IMHO it should have "depends on X86 || COMPILE_TEST".
> > >
> >
> > Fair enough. I am going to send out a bunch of EFI fixes this week, so
> > I'll accept a patch that makes the change above.
>
> Is it really a problem to just say n?
>
> I think this seems like a needless change that would slow down adoption of
> !x86 if Dell EMC PowerEdge systems did start going that route, especially
> when it comes to distributions that move glacially slow with picking up new
> kernel code.

Hi Ard/Geert,

Any additional thoughts here ?

--
With regards,
Narendra K

2019-10-01 18:26:51

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 4/5] efi: Export Runtime Configuration Interface table to sysfs

Hi Narendra,

On Tue, Oct 1, 2019 at 8:01 PM <[email protected]> wrote:
> On Tue, Oct 01, 2019 at 01:20:46PM +0000, Limonciello, Mario wrote:
> [...]
> > > > > > > +config EFI_RCI2_TABLE
> > > > > > > + bool "EFI Runtime Configuration Interface Table Version 2 Support"
> > > > > > > + help
> > > > > > > + Displays the content of the Runtime Configuration Interface
> > > > > > > + Table version 2 on Dell EMC PowerEdge systems as a binary
> > > > > > > + attribute 'rci2' under /sys/firmware/efi/tables directory.
> > > > > > > +
> > > > > > > + RCI2 table contains BIOS HII in XML format and is used to populate
> > > > > > > + BIOS setup page in Dell EMC OpenManage Server Administrator tool.
> > > > > > > + The BIOS setup page contains BIOS tokens which can be configured.
> > > > > > > +
> > > > > > > + Say Y here for Dell EMC PowerEdge systems.
> > > > > >
> > > > > > A quick Google search tells me these are Intel Xeon.
> > > > > > Are arm/arm64/ia64 variants available, too?
> > > > > > If not, this should be protected by "depends on x86" ("|| COMPILE_TEST"?).
> > > > >
> > > > > The code in question is entirely architecture agnostic, and defaults
> > > > > to 'n', so I am not convinced this is needed. (It came up in the
> > > > > review as well)
> > > >
> > > > "make oldconfig" still asks me the question on e.g. arm64, where it is
> > > > irrelevant, until arm64 variants of the hardware show up.
> > > >
> > > > So IMHO it should have "depends on X86 || COMPILE_TEST".
> > > >
> > >
> > > Fair enough. I am going to send out a bunch of EFI fixes this week, so
> > > I'll accept a patch that makes the change above.
> >
> > Is it really a problem to just say n?
> >
> > I think this seems like a needless change that would slow down adoption of
> > !x86 if Dell EMC PowerEdge systems did start going that route, especially
> > when it comes to distributions that move glacially slow with picking up new
> > kernel code.
>
> Hi Ard/Geert,
>
> Any additional thoughts here ?

Sure ;-)

A typical platform-specific sarm/arm64 .config file has almost 3000
config options
disabled. Hence that means I have to say "n" almost 3000 times.
Fortunately I started doing this several years ago, so I can do this
incrementally ;-)

Perhaps someone should try to remove all lines like "depends on ... ||
COMPILE_TEST", run "make oldconfig", read all help texts before saying "n",
and time the whole operation...

I hope I managed to convince you of the benefits.
Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2019-10-02 12:07:16

by K, Narendra

[permalink] [raw]
Subject: Re: [PATCH 4/5] efi: Export Runtime Configuration Interface table to sysfs

On Tue, Oct 01, 2019 at 08:23:51PM +0200, Geert Uytterhoeven wrote:
[...]
> > > > > > > > +config EFI_RCI2_TABLE
> > > > > > > > + bool "EFI Runtime Configuration Interface Table Version 2 Support"
[...]
> > > Is it really a problem to just say n?
> > >
> > > I think this seems like a needless change that would slow down adoption of
> > > !x86 if Dell EMC PowerEdge systems did start going that route, especially
> > > when it comes to distributions that move glacially slow with picking up new
> > > kernel code.
> >
> > Hi Ard/Geert,
> >
> > Any additional thoughts here ?
>
> Sure ;-)
>
> A typical platform-specific sarm/arm64 .config file has almost 3000
> config options
> disabled. Hence that means I have to say "n" almost 3000 times.
> Fortunately I started doing this several years ago, so I can do this
> incrementally ;-)
>
> Perhaps someone should try to remove all lines like "depends on ... ||
> COMPILE_TEST", run "make oldconfig", read all help texts before saying "n",
> and time the whole operation...
>
> I hope I managed to convince you of the benefits.

Thank you Geert. The description is helpful. I am working on it.
As I understand, the issue is 'make oldconfig' provides a prompt to the user
and user is expecting that a prompt is not needed as the option is not
relevant.

I cloned upstream kernel 5.3.2 as it does not have EFI_RCI2_TABLE option
and generated a .config by calling 'make defconfig'. The .config has
COMPILE_TEST set to n. I copied it to 5.4-rc1 and added 'depends on COMPILE_TEST'
to drivers/firmware/efi/Kconfig (did not add CONFIG_X86 because it is
set to y by the defconfig from 5.3.2). 'make oldconfig' still provides a
prompt for CONFIG_EFI_RCI2_TABLE.

I removed 'depends on COMPILE_TEST' from Kconfig and modified it to
include the below change -


config EFI_RCI2_TABLE
bool
prompt "EFI Runtime Configuration Interface Table Version 2 Support" if COMPILE_TEST
default n
help

Adding the condition to the 'prompt' section seems to have desired
result. With this change, 'make oldconfig' did not provide a prompt.

It seems like 'make oldconfig' will provide a prompt to the user if the
CONFIG option is new and providing the prompt does not depend on the
'depends on' section. It seems to be dependent on the 'prompt' section.

Any thoughts ? If the above understanding is correct, I will work to
submit a patch with 'prompt' section modified to contain

prompt "EFI Runtime Configuration Interface Table Version 2 Support" if X86 || COMPILE_TEST

--
With regards,
Narendra K

2019-10-02 21:41:23

by K, Narendra

[permalink] [raw]
Subject: Re: [PATCH 4/5] efi: Export Runtime Configuration Interface table to sysfs

On Wed, Oct 02, 2019 at 10:22:10AM +0000, K, Narendra wrote:
[...]
> > I hope I managed to convince you of the benefits.
>
> Thank you Geert. The description is helpful. I am working on it.
> As I understand, the issue is 'make oldconfig' provides a prompt to the user
> and user is expecting that a prompt is not needed as the option is not
> relevant.
>
> I cloned upstream kernel 5.3.2 as it does not have EFI_RCI2_TABLE option
> and generated a .config by calling 'make defconfig'. The .config has
> COMPILE_TEST set to n. I copied it to 5.4-rc1 and added 'depends on COMPILE_TEST'
> to drivers/firmware/efi/Kconfig (did not add CONFIG_X86 because it is
> set to y by the defconfig from 5.3.2). 'make oldconfig' still provides a
> prompt for CONFIG_EFI_RCI2_TABLE.
>
> I removed 'depends on COMPILE_TEST' from Kconfig and modified it to
> include the below change -
>
>
> config EFI_RCI2_TABLE
> bool
> prompt "EFI Runtime Configuration Interface Table Version 2 Support" if COMPILE_TEST
> default n
> help
>
> Adding the condition to the 'prompt' section seems to have desired
> result. With this change, 'make oldconfig' did not provide a prompt.
>
> It seems like 'make oldconfig' will provide a prompt to the user if the
> CONFIG option is new and providing the prompt does not depend on the
> 'depends on' section. It seems to be dependent on the 'prompt' section.
>
> Any thoughts ? If the above understanding is correct, I will work to
> submit a patch with 'prompt' section modified to contain
>
> prompt "EFI Runtime Configuration Interface Table Version 2 Support" if X86 || COMPILE_TEST

Geert/Ard,

I submitted the patch with above approach.

--
With regards,
Narendra K