Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1181924ybx; Fri, 1 Nov 2019 18:10:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgCuZ7Xr5G9E7u+iwe9UZUeEOEmVeyxC1sWEPLSDwpeMXIbuJZ79bLbtmXScSHJ8aOwoiz X-Received: by 2002:aa7:d6ca:: with SMTP id x10mr16216514edr.27.1572657057772; Fri, 01 Nov 2019 18:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572657057; cv=none; d=google.com; s=arc-20160816; b=M3hK0WvhTdGhBXRjZiuhjaFGoUfYMgKNOp8qu3Dhe19QzOzUv7Kf2qf4bgy/jEnBgm I2rnSXMaNUv3THCX41Bq5GRNjMHY3S7FxaZCKfw1zADDYiHwQ76B3rMllk9RhToGVhTf kCEWjOAGa97EkJtG9pYW7skBcvg3XbC2m/Lh0krI0sI8AT5lc3TN4wYn8v6hMBPCcgjK hHqnGoH38qjyD3yAtJPGqqJI8W/YH6eG4+dBq6Mcxu6qD0Q8tJWI6KcjmHDwzO8lsyKB rLPeWrY0QDnskJO3qZ3nnjBc9szGfMD3z0h5XQ4k+mY7NJPcX1NaH7N78EpUlFt4GwJT Sn/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=FNEy2tjllNac7TGpNIeINoGyg9O8UmQJiFsXOS83HnQ=; b=j2f5idoZ5WroEKziq+H6/FCQOi31yimPnjvyy9zox5HRhtGdjgpIgPN7FjEFPsPXAz e8iqssGkpjzSS5iWrHJ82UZUeTF5aHWUjz2FrUkJAPi1wBPBWHdaBGh2w6Tt1ebqazNS R5qeR348UxaPwEFIz48zyVPPBEZhZLM7U9W720fUMr+/09YbArzz9oPMQpzCfW0S+ce2 zLUIgpxjb0Mkb0F9SX8l7zMVzMkQMDX39imcMuJ7QHKqaPqelAQnF9A43Whlf7hnFjDI EqCqmK7dtc2g7bO8XUXt2MmgIm798xBoDA7QdCxhTT4mH4mj/cFoRl3rlOjrvcLQqsE/ as7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=X4w0sVaq; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4si6664589ejw.206.2019.11.01.18.10.34; Fri, 01 Nov 2019 18:10:57 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=X4w0sVaq; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728579AbfKBBJg (ORCPT + 99 others); Fri, 1 Nov 2019 21:09:36 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:34672 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727806AbfKBBJf (ORCPT ); Fri, 1 Nov 2019 21:09:35 -0400 Received: by mail-qk1-f193.google.com with SMTP id 205so11098561qkk.1 for ; Fri, 01 Nov 2019 18:09:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FNEy2tjllNac7TGpNIeINoGyg9O8UmQJiFsXOS83HnQ=; b=X4w0sVaqg9YPTa4r/3IdKQbM6Q7uQgrNtPAnD6fQZWNMnj7AEBPdJpztW0I783FEP8 og7zUjeee5qbyFhlU4eNdmC8qRCNqBt/p2C3DB/dHXG/lbbhyJeo53D0B3LPajYyP6hG Q0wSoPD6C3b3uWpcRZqPpGmZZC6PfT3yjglkVH5/Lk7sX43F3aCGwBaeAIi3nJMSwCzz IIFeRMUBkZt6fhexFbGaan9w8xlgwozSTZFm9t7/MLuBWea5L9+fR1lO86jgxaQxIc18 7NUPdhuYFh9qkYK9LCFCF8i2B4xh/Vyi2v0IHrL5eARs0vERsWDH8DswwICGEWOnqrD6 Cjrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FNEy2tjllNac7TGpNIeINoGyg9O8UmQJiFsXOS83HnQ=; b=b60vll4d8MRC03Pptjl/WQLVqnvACYflWvpPeIaIZFhz9sFk7F0hotpfW3ciU6+M0V jhdMRxGrq9xyX1mHYdLYUrQG7UO/iVgSPuKeayqZ5JbvLmV5AUj2T8i1KXZJL9Qb3wDk r/vedWQlKTGWkR8hFutanFqRUbQgw9oiqr40z7RY+kOv5+0l+w5oCvbHgoG/OZYwffmO C7wn4XgYdBRypYY/7gLC/wsLdIktIPf8RkkW8I0TJ58v79RzMybfH4lvLsdtqDraNmY6 S2y1HgawcpG3C/hMDGQwf4tIHxHOJJhPANR9m3Wih47ZxrkuYspGvACeG7zL2fa+awNY 3/eA== X-Gm-Message-State: APjAAAU31V+sN36Yc2CjrTWhn2EFdzKCm1nrfbKgne3SDR84Cw6S/Sjl HWBvxcjS/fwYTfhkCKeaSw== X-Received: by 2002:a37:6305:: with SMTP id x5mr13210163qkb.498.1572656974842; Fri, 01 Nov 2019 18:09:34 -0700 (PDT) Received: from gabell.cable.rcn.com (209-6-122-159.s2973.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [209.6.122.159]) by smtp.gmail.com with ESMTPSA id i66sm4234340qkb.105.2019.11.01.18.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 18:09:34 -0700 (PDT) From: Masayoshi Mizuma To: Borislav Petkov , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Baoquan He Cc: Masayoshi Mizuma , Masayoshi Mizuma , linux-kernel@vger.kernel.org Subject: [PATCH v4 3/4] x86/boot: Get the max address from SRAT Date: Fri, 1 Nov 2019 21:09:10 -0400 Message-Id: <20191102010911.21460-4-msys.mizuma@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191102010911.21460-1-msys.mizuma@gmail.com> References: <20191102010911.21460-1-msys.mizuma@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masayoshi Mizuma Get the max address from SRAT and write it into boot_params->max_addr. Signed-off-by: Masayoshi Mizuma --- arch/x86/boot/compressed/acpi.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c index a0f81438a..764206c23 100644 --- a/arch/x86/boot/compressed/acpi.c +++ b/arch/x86/boot/compressed/acpi.c @@ -362,17 +362,25 @@ static unsigned long get_acpi_srat_table(void) return 0; } -static void subtable_parse(struct acpi_subtable_header *sub_table, int *num) +static unsigned long subtable_parse(struct acpi_subtable_header *sub_table, + int *num) { struct acpi_srat_mem_affinity *ma; + unsigned long addr = 0; ma = (struct acpi_srat_mem_affinity *)sub_table; - if (!(ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) && ma->length) { - immovable_mem[*num].start = ma->base_address; - immovable_mem[*num].size = ma->length; - (*num)++; + if (ma->length) { + if (ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) + addr = ma->base_address + ma->length; + else { + immovable_mem[*num].start = ma->base_address; + immovable_mem[*num].size = ma->length; + (*num)++; + } } + + return addr; } /** @@ -391,6 +399,7 @@ int count_immovable_mem_regions(void) struct acpi_subtable_header *sub_table; struct acpi_table_header *table_header; char arg[MAX_ACPI_ARG_LENGTH]; + unsigned long max_addr = 0, addr; int num = 0; if (cmdline_find_option("acpi", arg, sizeof(arg)) == 3 && @@ -409,7 +418,9 @@ int count_immovable_mem_regions(void) sub_table = (struct acpi_subtable_header *)table; if (sub_table->type == ACPI_SRAT_TYPE_MEMORY_AFFINITY) { - subtable_parse(sub_table, &num); + addr = subtable_parse(sub_table, &num); + if (addr > max_addr) + max_addr = addr; if (num >= MAX_NUMNODES*2) { debug_putstr("Too many immovable memory regions, aborting.\n"); @@ -418,6 +429,9 @@ int count_immovable_mem_regions(void) } table += sub_table->length; } + + boot_params->max_addr = max_addr; + return num; } #endif /* CONFIG_RANDOMIZE_BASE && CONFIG_MEMORY_HOTREMOVE */ -- 2.20.1