Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp959212ybl; Fri, 6 Dec 2019 08:58:46 -0800 (PST) X-Google-Smtp-Source: APXvYqzkQ5bdIsL4GEZ1DxSIaQDoGse6HZTVbT1ZegHNUDTelPpsoQU4iAnSHDh10m7pVM+6RRN5 X-Received: by 2002:aca:52c4:: with SMTP id g187mr13221032oib.76.1575651525871; Fri, 06 Dec 2019 08:58:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575651525; cv=none; d=google.com; s=arc-20160816; b=S5PzyGVsF+SqLJqTGahaJSB95qEo5Htupq4BEr2t23WQVg3sfRQHJaPP3wAO2ULhkW ek9fXZ6re9aBJzClm2HeSbGoYDhgLx9JB/GYS6THP42I5vi37ICg43pRTOAi+Bo25XuH hM5rs7duvP8d7jCjP1kf26pxXTKTPCiu1iPhbhuu+NVbYe7ar0bKIB+QNlhPLxj4eO3j pe3m18PSYKePJJZg36nNpbPH0FOXkPkVj+8ba32IHQUd/NljSJfKxpQrDLkDmvYmVsr1 oyog9pAl1O6KjXjyiTbLLltto7K2XPL54Z4vtDLHnLEeOrywCV0EeWqAcG5m36VyByDm pyVQ== 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=/kvBFKQi677ga7uy55gslQEdaVWu0/AqECgiCr1RRo4=; b=jwZ5aGUV56lu0O6ST0sPm5hl1FrP7xkGvno5bDD6VTZLQ/K6EZFR8z/q/yH3of3c64 X3ThE6EIQ9ZOkYJbFSYHDv/AOpPD1TpUkCFz1LGCiAJ1RO4+abWK50HI+TxjOFgjHXWT G5STEvRmv5S/tj46v5x1r0vvKTTgu8iW+PV82Pmj8jo4HPEHyoKxfDQzgqrqYh4UjyN3 DOPhCZeOasn7o5ct1mnnDYRAC/nhn/xwHbALuuc6Rn3D0SMgpdpd4akRK14Pd7aMB82A WcEkoekjPQiKMTj6XWVFfmW4snn89ON2gRXFSh2jJ6J5NjLZ90sk78E0OGI5PxFjcsK4 ew0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=m6zOpJSM; 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 v92si1126367otb.140.2019.12.06.08.58.33; Fri, 06 Dec 2019 08:58:45 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=m6zOpJSM; 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 S1726465AbfLFQ5b (ORCPT + 99 others); Fri, 6 Dec 2019 11:57:31 -0500 Received: from mail-qv1-f65.google.com ([209.85.219.65]:35902 "EHLO mail-qv1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726261AbfLFQ53 (ORCPT ); Fri, 6 Dec 2019 11:57:29 -0500 Received: by mail-qv1-f65.google.com with SMTP id b18so150514qvy.3 for ; Fri, 06 Dec 2019 08:57:28 -0800 (PST) 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=/kvBFKQi677ga7uy55gslQEdaVWu0/AqECgiCr1RRo4=; b=m6zOpJSM8yCyfTXahxG+OL8+V57Vx6gFwau0g6LXxOvALmUvIKTagAfW39yvzxqGNL TjBpm72RRL0Ww/yzjWMdK+uaaDnUQ2dzuQsAoe/6NUn1VxI95Vz2lWvFaz+FUZrP+/Uc OkmXYG0LcAYv+WXfe0XjiVrC0SelB+kkZMXLf+Oo2z9ICorZWiIRWt4HqCtB8dj/VDUB 87+VYt1PYSsRRI+3T5tdBtXY+Aa03P2l7wb4/IAQZnS74bzthN0pYWCSdelJFTbuIpoW BtET0oFC9qi50hjPdLYYAs3Rg0GBGwmmgqyM5cglL0wnGPyeQQ7g2wU9YNco6WcOnhv0 BwWA== 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=/kvBFKQi677ga7uy55gslQEdaVWu0/AqECgiCr1RRo4=; b=Tk8lRsNvKXG6ivHwdnd2gw/HonS6I4uC+5wxtwznAY6CzJmyS8bBNirS8++j26v1UP r8YVHwFATKjS7B0WyWYXBu6059i1sTBfIXLoBGQDJVWDjM0NrN5L6/r4rQ4UM9Y6JXFt gsWChkm+tnafK/KgQZaMQMu/qxvXCvwlFs0OXBd67rvFNvWNhFUwQqmEj+dyFuL0Yq/j h24Y3wZaSiQfeVsWRtiSL/+3kuGjxWxHWQeDIuNz0XB2hQJr4nfBj5P19YoO7n80B/ZV +hK3PtCu4mwrsrXyXvbMExI6FdHIUR/sF94TKKckcYzptKjoPRa5jGJVfCIDeqXeGGi8 TSrg== X-Gm-Message-State: APjAAAXLTZnJCygo2G8wnbxmOmSmCSf12jXYqoQgcH/WbdXDg9UMCqrq g/sDYvU+TmsxUaiA2gi9ziYC6RI= X-Received: by 2002:ad4:478b:: with SMTP id z11mr13422754qvy.185.1575651448568; Fri, 06 Dec 2019 08:57:28 -0800 (PST) Received: from gabell.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id y28sm6531373qtk.65.2019.12.06.08.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2019 08:57:28 -0800 (PST) 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 v6 1/4] x86/boot: Wrap up the SRAT traversing code into subtable_parse() Date: Fri, 6 Dec 2019 11:57:04 -0500 Message-Id: <20191206165707.20806-2-msys.mizuma@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191206165707.20806-1-msys.mizuma@gmail.com> References: <20191206165707.20806-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 25019d42ae93..a0f81438a0fd 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