Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1182892ybx; Fri, 1 Nov 2019 18:11:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRDVsRdYfrksvof9NnoIbur7JbFdnpTzoGAndlpin0y5BKXFkp5gZlWgmOZk1Sf6t3EWNg X-Received: by 2002:a17:906:9504:: with SMTP id u4mr12412741ejx.317.1572657103126; Fri, 01 Nov 2019 18:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572657103; cv=none; d=google.com; s=arc-20160816; b=O/85vIybFSFtpQklXksHwg/jLv5uMiR2S2W6dh7jucOQv7ZYwC2uOs9wcwK5yxn5n+ MK6ExD70PuQLZBwmbUow0uKGymmHViR8owtlWQ1DxXG/HM4BqFEW2UKga3tZLSk2gFYJ 9pKmiTWxYOHlKf/IpfALroixD/jMkMmIBGkoWRpGXsC3ABuq2wm2cbdWjrGTlWrcQabh /5D4ZSvMRwoccV54Snc1+EbMZjKj0BEp0MmccDA8QBolAleuNX3k73AuBoBdLlrvbKoe 4CMa7URTC8UigKJ1gyrmlFSp1rSYb3sWR4Ua+tKH5BMa6Rj6zTNnRE2s6SpZ/pImft+w 9Pfg== 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=HiTrRYovNg8dXt0LJIo4hhRMok+7+qAUJqR1zx6Do2E=; b=RHUBwzSXmSr34v+ev787WjfFaiKnRhR6HneQTUsHwyyzoPZDErtz7Lc9ERsKREIkpP qYP6ANao5Xp+H/TQMg82A4BVBHxA3WMFG28tph066YV8umXVH03fbq4OLG101/iqpHmw d0D+zhG03AcRNWM89aimcwL/cTCPDjbNoBZtZcMI4AZAq+kkc92WQIFv3S3/A6gTELjr tdd2Cg0dqCGUzQWLgziR9mfIMzukMu60PMy2Ed+fQW9wZ5mvpGSS9UviBkh9qzQZXcdL 0HcPsph6jZ7lpq0f2BkVOQVXK40ubyFeBamzTUHArx/fwEGmwMAn/sOgsK345AzQ1rk1 rSoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u6lvtzKo; 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 j11si1860561edj.43.2019.11.01.18.11.19; Fri, 01 Nov 2019 18:11:43 -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=u6lvtzKo; 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 S1727707AbfKBBJe (ORCPT + 99 others); Fri, 1 Nov 2019 21:09:34 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:39655 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbfKBBJd (ORCPT ); Fri, 1 Nov 2019 21:09:33 -0400 Received: by mail-qt1-f194.google.com with SMTP id t8so15401187qtc.6 for ; Fri, 01 Nov 2019 18:09:33 -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=HiTrRYovNg8dXt0LJIo4hhRMok+7+qAUJqR1zx6Do2E=; b=u6lvtzKoWjJoOBknp7TwHbV/v2Tqs8QuJik3YlZjUj8zDpkzhPFpryTKGjMywxDhhu aWiRM6VbVHaDAm3rmN3YR18Kx+WZKuhblnMad9t/2K/w71VOsRudJW4AmW3IPiETOWLf JsWubH0TBT3aWGHa1w6O5bYE9hP2q+oK6C67bGXl2KqyRP1VqorqkJIomgTmBz7YOIPy smf/qBmjaTe7qqLfkC06edme14n0oSdlAOd46jJlV4wFQ0NnpPjlRxG6U009qsX8aAWG dgP8wqVqbXtaI8C9uWUDh6os3RrJ37nv19Thxr7ck//+Iyi9tNMh9w3KbAaSQUZaukAN kZHg== 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=HiTrRYovNg8dXt0LJIo4hhRMok+7+qAUJqR1zx6Do2E=; b=LHGRnILREGDeGCFnVxOuLGZdpuL4wcdNl5BAs+3fXTB1K3r3+MZU6L73FqUuNEr2Ca CE1Lddf0c2T7VFrPyKlHmmhw7ERB/pmw29zlxGRY9r05Hh6eIzU2I2gINd65hek/hQ9F 7KDT6/86jhqERjciAr35ZH584MXrQglhZtkvIf/xDBUIEAezGNZhvqqfY0JKeqhaJEpy lNxjkTK2QzKktM9uUvDYikXd84/mVzDdbF/6tSuLFQ/6mR0hLGn0qiovswSfYxFVUqZJ k8UapniLljvHroH1aUDXaMzfXp8ww/ERoeqiFaBTy+r6Zw337B3TYnylIdIyjfbcYxYx fcTg== X-Gm-Message-State: APjAAAXXfCSwobA17huvsAcCMwEA9b8E97BFeKIDkGAxnIhRMyPTcK3L CJGHevhUNJ98U548MPjaVg== X-Received: by 2002:aed:3f63:: with SMTP id q32mr2560523qtf.340.1572656972727; Fri, 01 Nov 2019 18:09:32 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 18:09:32 -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 1/4] x86/boot: Wrap up the SRAT traversing code into subtable_parse() Date: Fri, 1 Nov 2019 21:09:08 -0400 Message-Id: <20191102010911.21460-2-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 Wrap up the SRAT traversing code into subtable_parse(). Reviewed-by: Baoquan He Signed-off-by: Masayoshi Mizuma --- arch/x86/boot/compressed/acpi.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c index 25019d42a..a0f81438a 100644 --- a/arch/x86/boot/compressed/acpi.c +++ b/arch/x86/boot/compressed/acpi.c @@ -362,6 +362,19 @@ static unsigned long get_acpi_srat_table(void) return 0; } +static void subtable_parse(struct acpi_subtable_header *sub_table, int *num) +{ + struct acpi_srat_mem_affinity *ma; + + 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)++; + } +} + /** * count_immovable_mem_regions - Parse SRAT and cache the immovable * memory regions into the immovable_mem array. @@ -395,14 +408,8 @@ int count_immovable_mem_regions(void) while (table + sizeof(struct acpi_subtable_header) < table_end) { sub_table = (struct acpi_subtable_header *)table; if (sub_table->type == ACPI_SRAT_TYPE_MEMORY_AFFINITY) { - struct acpi_srat_mem_affinity *ma; - 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++; - } + subtable_parse(sub_table, &num); if (num >= MAX_NUMNODES*2) { debug_putstr("Too many immovable memory regions, aborting.\n"); -- 2.20.1