On Mon, Jan 07, 2019 at 11:22:39AM +0800, Chao Fan wrote:
> 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 <fanc.f...@cn.fujitsu.com>
> ---
>  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 <linux/acpi.h>

Ok, I corrected it to this, please replace in your version:

/*
 * 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;
}


-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

Reply via email to