Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1259658ybl; Fri, 30 Aug 2019 14:49:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxk11QRP6Tf9Ba0/kBVQN/4rzO4+P02wtDh7oAIV9Ln++040H7J2auoi/PnNfxlETWADTDg X-Received: by 2002:a17:902:6b81:: with SMTP id p1mr17718625plk.91.1567201794318; Fri, 30 Aug 2019 14:49:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567201794; cv=none; d=google.com; s=arc-20160816; b=PHamfR89p0IuRlAUeCon4hdbkakodTHQpHL4nt5sVvliLfKCIU1p32XXlxEa54c6Mi CyHmybRVggbDnJF7v0HCkjvRHantjNN77klMeg+dRKmj4Lf7zQP9VjcAnyiyQw+VT5MY nEUY/Iu2Ozh46Of9/WEtfLxx7wkuDveKuDuF8yUsSOlBFoL8e7kN/jZcjJsfOkWBtDyw km2RKMB1Ykh07/mcK+t6Ttg7pnii6wQVmII5fYUykT9SSJfDuPJJdi4Ze3mEjLIN7Ads 3AmImBYQM36osTvWt2fbKtP1bqtDf/PVnzS4wQLyyev5Bgr1Sot53o1Zm0LBpXi8Q02h Pz9A== 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=sVV2lnPwOeX0GLUaJ7vmcH2fqnxehztPL1uAZs7p67k=; b=OLJHlyf7HgbC9w+4dWce09ZzaTpmFMkCCxYdZ+Zb+7uvRbAj+fTYhCkozeAj7YGwqi Rv8jSFtGcJHJTiMxD1VGM1BCTp6mr9HhAHV2lxbS2zOOEDtW+KelH1rYzKk5pnVIO8Zm gVyQzIm/OOJxT/OfggmOwVraYLwjVEpkE3pfSXBh0vvU49t9ZQXU5xKnI4WtUvU49VgS EHW1R1OfjLVg/9DCoT163LH+Ui/HaB1Pd6aGXb3GR46DluLFfckarGRG4Ihg+TLuBuio mU1VcppfuUypuqT7R8pmF8Sy40sYOXbRdZ8Hr73TQ5PIcIIVzfZ/2ozY61Xq1r/2oQAp c1ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UsO5zQPF; 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 x3si7140630pfx.193.2019.08.30.14.49.39; Fri, 30 Aug 2019 14:49:54 -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=UsO5zQPF; 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 S1728499AbfH3VsS (ORCPT + 99 others); Fri, 30 Aug 2019 17:48:18 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:44692 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728424AbfH3VsE (ORCPT ); Fri, 30 Aug 2019 17:48:04 -0400 Received: by mail-qk1-f193.google.com with SMTP id i78so6050376qke.11 for ; Fri, 30 Aug 2019 14:48:03 -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=sVV2lnPwOeX0GLUaJ7vmcH2fqnxehztPL1uAZs7p67k=; b=UsO5zQPFVoEncEhyBWusu7AbBJG0hM5eKksQ5djE5aKLAhKfy7+vWv2eCIxIheWe3I s4QoGnOPidtTbwF1cL+W2bC7g/EGoeZJQxaAC+s3GEDlyaRKlsGDlVSBJYIaq1niVQhQ 005UqMPzL1TC+r5CuMTb0fmifJnw1dTLm5D3LgVJyP8d+TwbJP5kdpckG27JOWVRT66/ zfHbu3nF3zsunx/nW8xSNq0yUzNn3zzrO4rZKKyCIKi1AAq9G5QZg908kuHy4E7iByUT AhOAd8mhX2UY6GbJ4DhDaNUEsuMejaZGeXkCGSiE4cpxVXMJY2jV8NUdq5ni/+QogGMv ONoA== 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=sVV2lnPwOeX0GLUaJ7vmcH2fqnxehztPL1uAZs7p67k=; b=IW7q1jwJ9xJpu0OUEurH6TL0VpJE4B3qV3s4VheL+AsopjEya7K209g4kKEE29fKHD k71du76QhxKRway/M5W9JCVIuz/fC/QwdR70laUKmu3deuFVKUOb6vtzw9IrA/9Mlmx1 bCVE6bkkOiK8fo+3IIghQLHrT+YRWQbNUUd3hIB/yQVz9aH/9CEsExwr3RTXiVgE+R4x XCuiD6dHJVaXv2vErsfxo1dvU1m4e3kMksYwbcrR1aQJTtNfwk0lzUFcxKVp9vNOTR9o U6pBZbDbsLov/anS5xy1GvBkEpfiUU3mqPqu9Ns35dTIQM6sPV0Udh6U+2qujNXHjiWc LUJQ== X-Gm-Message-State: APjAAAUFpHAdv4ghE0X5GZDHjAiTk9rjg1ID1yhkwtL0RcDL+hlbpwBg e7zMeakv34zXdaBup88eZg== X-Received: by 2002:a05:620a:126c:: with SMTP id b12mr18299361qkl.177.1567201683411; Fri, 30 Aug 2019 14:48:03 -0700 (PDT) Received: from gabell.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id a4sm4857834qtb.17.2019.08.30.14.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2019 14:48:02 -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 v3 3/5] x86/boot: Get the max address from SRAT Date: Fri, 30 Aug 2019 17:47:05 -0400 Message-Id: <20190830214707.1201-4-msys.mizuma@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190830214707.1201-1-msys.mizuma@gmail.com> References: <20190830214707.1201-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 | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c index 908a1bfab..ba2bc5ab9 100644 --- a/arch/x86/boot/compressed/acpi.c +++ b/arch/x86/boot/compressed/acpi.c @@ -362,16 +362,24 @@ static unsigned long get_acpi_srat_table(void) return 0; } -static void subtable_parse(struct acpi_subtable_header *sub_table, int *num) +static void subtable_parse(struct acpi_subtable_header *sub_table, int *num, + unsigned long *max_addr) { struct acpi_srat_mem_affinity *ma; + unsigned long addr; 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; + if (addr > *max_addr) + *max_addr = addr; + } else { + immovable_mem[*num].start = ma->base_address; + immovable_mem[*num].size = ma->length; + (*num)++; + } } } @@ -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; int num = 0; if (cmdline_find_option("acpi", arg, sizeof(arg)) == 3 && @@ -409,7 +418,7 @@ 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); + subtable_parse(sub_table, &num, &max_addr); if (num >= MAX_NUMNODES*2) { debug_putstr("Too many immovable memory regions, aborting.\n"); @@ -418,6 +427,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.18.1