[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-3c98e71b42a7d0c14639ccb565ea315f3c887f92@git.kernel.org>
Date: Fri, 1 Feb 2019 02:59:19 -0800
From: tip-bot for Chao Fan <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: mingo@...nel.org, mingo@...hat.com, jgross@...e.com,
thomas.lendacky@....com, tglx@...utronix.de, hpa@...or.com,
fanc.fnst@...fujitsu.com, linux-kernel@...r.kernel.org, bp@...e.de,
x86@...nel.org, kirill.shutemov@...ux.intel.com,
keescook@...omium.org
Subject: [tip:x86/boot] x86/boot: Add "acpi_rsdp=" early parsing
Commit-ID: 3c98e71b42a7d0c14639ccb565ea315f3c887f92
Gitweb: https://git.kernel.org/tip/3c98e71b42a7d0c14639ccb565ea315f3c887f92
Author: Chao Fan <fanc.fnst@...fujitsu.com>
AuthorDate: Wed, 23 Jan 2019 19:08:45 +0800
Committer: Borislav Petkov <bp@...e.de>
CommitDate: Fri, 1 Feb 2019 11:52:54 +0100
x86/boot: Add "acpi_rsdp=" early parsing
KASLR may randomly choose offsets which are located in movable memory
regions resulting in the movable memory becoming immovable.
The ACPI SRAT (System/Static Resource Affinity Table) describes memory
ranges including ranges of memory provided by hot-added memory devices.
In order to access SRAT, one needs the Root System Description Pointer
(RSDP) with which to find the Root/Extended System Description Table
(R/XSDT) which then contains the system description tables of which SRAT
is one of.
In case the RSDP address has been passed on the command line (kexec-ing
a second kernel) parse it from there.
[ bp: Rewrite the commit message and cleanup the code. ]
Signed-off-by: Chao Fan <fanc.fnst@...fujitsu.com>
Signed-off-by: Borislav Petkov <bp@...e.de>
Cc: bhe@...hat.com
Cc: caoj.fnst@...fujitsu.com
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: indou.takao@...fujitsu.com
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Juergen Gross <jgross@...e.com>
Cc: kasong@...hat.com
Cc: Kees Cook <keescook@...omium.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: msys.mizuma@...il.com
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Tom Lendacky <thomas.lendacky@....com>
Cc: x86-ml <x86@...nel.org>
Link: https://lkml.kernel.org/r/20190123110850.12433-3-fanc.fnst@cn.fujitsu.com
---
arch/x86/boot/compressed/acpi.c | 32 ++++++++++++++++++++++++++++++++
arch/x86/boot/compressed/misc.h | 3 +++
2 files changed, 35 insertions(+)
diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c
new file mode 100644
index 000000000000..bacfc4ea35ac
--- /dev/null
+++ b/arch/x86/boot/compressed/acpi.c
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0
+#define BOOT_CTYPE_H
+#include "misc.h"
+#include "error.h"
+#include "../string.h"
+
+#ifdef CONFIG_ACPI
+
+/*
+ * Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex
+ * digits, and '\0' for termination.
+ */
+#define MAX_ADDR_LEN 19
+
+static acpi_physical_address get_acpi_rsdp(void)
+{
+ acpi_physical_address addr = 0;
+
+#ifdef CONFIG_KEXEC
+ char val[MAX_ADDR_LEN] = { };
+ int ret;
+
+ ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN);
+ if (ret < 0)
+ return 0;
+
+ if (kstrtoull(val, 16, &addr))
+ return 0;
+#endif
+ return addr;
+}
+#endif /* CONFIG_ACPI */
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index a1d5918765f3..764ad50c0119 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -25,6 +25,9 @@
#include <asm/bootparam.h>
#include <asm/bootparam_utils.h>
+#define BOOT_CTYPE_H
+#include <linux/acpi.h>
+
#define BOOT_BOOT_H
#include "../ctype.h"
Powered by blists - more mailing lists