Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3117429imu; Sun, 6 Jan 2019 19:25:11 -0800 (PST) X-Google-Smtp-Source: AFSGD/XsaeVxh4PrGMXXELNhZHDnsrczeWmmAItA3budRF1f6YNIliVsVoC/30D97J8e1m1dVmrC X-Received: by 2002:a62:1112:: with SMTP id z18mr60999768pfi.173.1546831511271; Sun, 06 Jan 2019 19:25:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546831511; cv=none; d=google.com; s=arc-20160816; b=sbXiTdsm61s3p+5Rc2ARr89bQQucmADpbff0r+NGejhETrIQtAdsrOo9kcnAFbhegb XHT2frLGL/mkDtPlQn6WeuuD+uurfDq3Pn10HSfwOTXkUHBLkU0eJ1JoW9UpbCxYcfv5 LKXSt2nvcXj3LJyusdawaRfbsPz8PZz8HnLbwTqAJIoH61Go70K3plURdRyU/DKgdKk/ FtrLriIoO9VGlYEbq+ccDEnhXQeWIghFp+RHPQZcubBK6UBg+XdmxdgDirEZNQbO1TI2 jHDB/kwkFXHkzitJ8U0fSZxbGHbYpwVnWbbUkSDl/+1pNmKBPuehvPhFXVBcQvXYxP/o /oCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Gav49HppifeuWSmnWumtBUWq+D/8/y8xR9hNAwm1Npg=; b=tz3IsQ5ipu4AnvKOl4fcHhIMhm/Pr/9pRjlpdHI6CmUzaK2E48GI+bCVqrYA77wcIC 5k/pFu0S4mCRCae+3K3/uLCLWQDPGbpZeLJBBo3i7HAzCmA5WWPiDrUosXN0YX0RUcas g519OMlPxf3eojf01VzU0gQtUJ7mwCxPlJbn/D+Gyo5xqxjvRBHuvf/NalqA2yO6gwcy zyP201LcBmj5IUU2S35T4n2Oh4nmUn2guB4pbwSJ5ow8cvnRO95uZ9HpZx1ueFX8kLQu KWN1lvkI4O+Dp6dlK8Ub52vTglpuX2cHolced+XJRym+vN+jZBUfnCqhl7kBqoZJjrY1 nS3w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c6si18028780plo.270.2019.01.06.19.24.56; Sun, 06 Jan 2019 19:25:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726282AbfAGDXo (ORCPT + 99 others); Sun, 6 Jan 2019 22:23:44 -0500 Received: from mail.cn.fujitsu.com ([183.91.158.132]:54897 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726180AbfAGDXo (ORCPT ); Sun, 6 Jan 2019 22:23:44 -0500 X-IronPort-AV: E=Sophos;i="5.56,449,1539619200"; d="scan'208";a="51438959" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 07 Jan 2019 11:23:42 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 568DD4B7EC5C; Mon, 7 Jan 2019 11:23:36 +0800 (CST) Received: from localhost.local (10.167.225.56) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 7 Jan 2019 11:23:41 +0800 From: Chao Fan To: , , , , , , , , CC: , , Subject: [PATCH v15 2/6] x86/boot: Introduce get_acpi_rsdp() to parse RSDP in cmdline from KEXEC Date: Mon, 7 Jan 2019 11:22:39 +0800 Message-ID: <20190107032243.25324-3-fanc.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107032243.25324-1-fanc.fnst@cn.fujitsu.com> References: <20190107032243.25324-1-fanc.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.167.225.56] X-yoursite-MailScanner-ID: 568DD4B7EC5C.AA513 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: fanc.fnst@cn.fujitsu.com X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org KASLR may randomly choose some positions which are located in movable memory regions. This will make the movable memory chosen by KASLR can't be removed. Memory information in SRAT is necessary to fix the conflict between KASLR and memory-hotremove. ACPI SRAT (System/Static Resource Affinity Table) shows the details about memory ranges, including ranges of memory provided by hot-added memory devices. SRAT is introduced by Root System Description Pointer(RSDP). So RSDP should be found firstly. When booting form KEXEC/EFI/BIOS, the methods to find RSDP are different. When booting from KEXEC, 'acpi_rsdp=' may have been added to cmdline, so parse cmdline to find RSDP. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/acpi.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 arch/x86/boot/compressed/acpi.c diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c new file mode 100644 index 000000000000..7ca5001d7639 --- /dev/null +++ b/arch/x86/boot/compressed/acpi.c @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0 +#define BOOT_CTYPE_H +#include "misc.h" +#include "error.h" +#include "../string.h" + +#include + +/* + * Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex + * digits, and '\0' for termination. + */ +#define MAX_HEX_ADDRESS_STRING_LEN 19 + +static acpi_physical_address get_acpi_rsdp(void) +{ +#ifdef CONFIG_KEXEC + char val[MAX_HEX_ADDRESS_STRING_LEN]; + unsigned long long res; + int len = 0; + + len = cmdline_find_option("acpi_rsdp", val, MAX_HEX_ADDRESS_STRING_LEN); + if (len > 0) { + val[len] = '\0'; + if (!kstrtoull(val, 16, &res)) + return res; + } +#endif + return 0; +} -- 2.20.1