aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2017-06-02 09:52:07 -0400
committerIngo Molnar <mingo@kernel.org>2017-06-05 11:50:44 -0400
commitbb817bef3b1989a9cdb40362cfb8d2aa224ac1bc (patch)
tree6c824c3bac353dc7f94a6087574c48d5d401cac4
parentac81d3de03f7d8593a94240d057c8e2e8e869897 (diff)
efi/arm: Enable DMI/SMBIOS
Wire up the existing arm64 support for SMBIOS tables (aka DMI) for ARM as well, by moving the arm64 init code to drivers/firmware/efi/arm-runtime.c (which is shared between ARM and arm64), and adding a asm/dmi.h header to ARM that defines the mapping routines for the firmware tables. This allows userspace to access these tables to discover system information exposed by the firmware. It also sets the hardware name used in crash dumps, e.g.: Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = ed3c0000 [00000000] *pgd=bf1f3835 Internal error: Oops: 817 [#1] SMP THUMB2 Modules linked in: CPU: 0 PID: 759 Comm: bash Not tainted 4.10.0-09601-g0e8f38792120-dirty #112 Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015 ^^^ NOTE: This does *NOT* enable or encourage the use of DMI quirks, i.e., the the practice of identifying the platform via DMI to decide whether certain workarounds for buggy hardware and/or firmware need to be enabled. This would require the DMI subsystem to be enabled much earlier than we do on ARM, which is non-trivial. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Russell King <rmk+kernel@armlinux.org.uk> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/20170602135207.21708-14-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/arm/Kconfig17
-rw-r--r--arch/arm/include/asm/dmi.h19
-rw-r--r--arch/arm64/kernel/efi.c15
-rw-r--r--drivers/firmware/efi/arm-runtime.c16
4 files changed, 52 insertions, 15 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4c1a35f15838..dabcaeb2ee3e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -2061,6 +2061,23 @@ config EFI
2061 is only useful for kernels that may run on systems that have 2061 is only useful for kernels that may run on systems that have
2062 UEFI firmware. 2062 UEFI firmware.
2063 2063
2064config DMI
2065 bool "Enable support for SMBIOS (DMI) tables"
2066 depends on EFI
2067 default y
2068 help
2069 This enables SMBIOS/DMI feature for systems.
2070
2071 This option is only useful on systems that have UEFI firmware.
2072 However, even with this option, the resultant kernel should
2073 continue to boot on existing non-UEFI platforms.
2074
2075 NOTE: This does *NOT* enable or encourage the use of DMI quirks,
2076 i.e., the the practice of identifying the platform via DMI to
2077 decide whether certain workarounds for buggy hardware and/or
2078 firmware need to be enabled. This would require the DMI subsystem
2079 to be enabled much earlier than we do on ARM, which is non-trivial.
2080
2064endmenu 2081endmenu
2065 2082
2066menu "CPU Power Management" 2083menu "CPU Power Management"
diff --git a/arch/arm/include/asm/dmi.h b/arch/arm/include/asm/dmi.h
new file mode 100644
index 000000000000..df2d2ff06f5b
--- /dev/null
+++ b/arch/arm/include/asm/dmi.h
@@ -0,0 +1,19 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 */
6
7#ifndef __ASM_DMI_H
8#define __ASM_DMI_H
9
10#include <linux/io.h>
11#include <linux/slab.h>
12
13#define dmi_early_remap(x, l) memremap(x, l, MEMREMAP_WB)
14#define dmi_early_unmap(x, l) memunmap(x)
15#define dmi_remap(x, l) memremap(x, l, MEMREMAP_WB)
16#define dmi_unmap(x) memunmap(x)
17#define dmi_alloc(l) kzalloc(l, GFP_KERNEL)
18
19#endif
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index 5d17f377d905..82cd07592519 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -11,7 +11,6 @@
11 * 11 *
12 */ 12 */
13 13
14#include <linux/dmi.h>
15#include <linux/efi.h> 14#include <linux/efi.h>
16#include <linux/init.h> 15#include <linux/init.h>
17 16
@@ -117,20 +116,6 @@ int __init efi_set_mapping_permissions(struct mm_struct *mm,
117 set_permissions, md); 116 set_permissions, md);
118} 117}
119 118
120static int __init arm64_dmi_init(void)
121{
122 /*
123 * On arm64, DMI depends on UEFI, and dmi_scan_machine() needs to
124 * be called early because dmi_id_init(), which is an arch_initcall
125 * itself, depends on dmi_scan_machine() having been called already.
126 */
127 dmi_scan_machine();
128 if (dmi_available)
129 dmi_set_dump_stack_arch_desc();
130 return 0;
131}
132core_initcall(arm64_dmi_init);
133
134/* 119/*
135 * UpdateCapsule() depends on the system being shutdown via 120 * UpdateCapsule() depends on the system being shutdown via
136 * ResetSystem(). 121 * ResetSystem().
diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c
index 974c5a31a005..1cc41c3d6315 100644
--- a/drivers/firmware/efi/arm-runtime.c
+++ b/drivers/firmware/efi/arm-runtime.c
@@ -11,6 +11,7 @@
11 * 11 *
12 */ 12 */
13 13
14#include <linux/dmi.h>
14#include <linux/efi.h> 15#include <linux/efi.h>
15#include <linux/io.h> 16#include <linux/io.h>
16#include <linux/memblock.h> 17#include <linux/memblock.h>
@@ -166,3 +167,18 @@ void efi_virtmap_unload(void)
166 efi_set_pgd(current->active_mm); 167 efi_set_pgd(current->active_mm);
167 preempt_enable(); 168 preempt_enable();
168} 169}
170
171
172static int __init arm_dmi_init(void)
173{
174 /*
175 * On arm64/ARM, DMI depends on UEFI, and dmi_scan_machine() needs to
176 * be called early because dmi_id_init(), which is an arch_initcall
177 * itself, depends on dmi_scan_machine() having been called already.
178 */
179 dmi_scan_machine();
180 if (dmi_available)
181 dmi_set_dump_stack_arch_desc();
182 return 0;
183}
184core_initcall(arm_dmi_init);