Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1259607ybl; Fri, 30 Aug 2019 14:49:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCr7VBE/Yh0Sd7rDX3qsVlCu1S7HAk7EgjaKJT3y51GsoRbGCDUt9atww1QWqXZe0G4EYG X-Received: by 2002:aa7:90c1:: with SMTP id k1mr20039219pfk.46.1567201791656; Fri, 30 Aug 2019 14:49:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567201791; cv=none; d=google.com; s=arc-20160816; b=NL8npeZMrc9+WtNGsxG0dbDrfslPF5zV1p8nKzy0gef2mjjPefB6VLEL10IjWz9+c4 or2WfyX2jltEyWm3iekew/sRAeR+hYZqgTm3gtrI082m6u/ZDQH1H4yZ9qctYyPgWWGE UZVcZdXMVll5DlHsQvexPspss3gxwMsyAfPivu7hQ8s2XYt9L2ILCdpIKUG2U4K/7cn+ keKxJbbpECDIsV4nIf1XSDGiH9IIAH3dPL+Y2sFCzFFZ8f6Bv14/+Ku5wr3yMqOZstdg nBFFWv0OOqzCGNWP4YmvBU31Sf3QTNskS6yugw9CD90qh5AZnr4+EhKgIvGW9SuamYXi gojQ== 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=gdRSBCutQVNtWSzAzPyx1octfk+39c+uxWTd5tKxUbY=; b=0nNMUpzq6H7tHuXQnLk+aUhSZzHHA+0GvhszUbEc80rix1Bl8DY4h2pq1xB3imUBIl Eji4go/GaBjZ1qAQrNy010cyqbrsi8ZzTdbiZC/czp2IW4pMvjN7SzrM3ees5nza4UW0 LMRshTbvUzHpBsyPeFQjukHeLs6SAiyAOD7WS2PvxezjvqgHBltbxq4OaZrrrb62LHJ2 Zh/DrdqutNUQPETHRDYVX3ru7WOkBvOSuVLkQvkmImaenyFYXlskJRfkm8TLcIMu3+03 oW+A3fc8EZ/1sW5mWSLqn53L5Yqf0VF8bcwYQ6MKG8d7IsiC4Vsz9OHXlEMkARnLP+xF c3rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jKz8xGKF; 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 d13si6877983pfo.33.2019.08.30.14.49.36; Fri, 30 Aug 2019 14:49:51 -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=jKz8xGKF; 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 S1728256AbfH3VsE (ORCPT + 99 others); Fri, 30 Aug 2019 17:48:04 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:37237 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728122AbfH3VsB (ORCPT ); Fri, 30 Aug 2019 17:48:01 -0400 Received: by mail-qt1-f194.google.com with SMTP id y26so9289714qto.4 for ; Fri, 30 Aug 2019 14:48:00 -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=gdRSBCutQVNtWSzAzPyx1octfk+39c+uxWTd5tKxUbY=; b=jKz8xGKFpu+c8nYrAc35wyY7pPoBrGP5xK7ltVDmwY6lBDr8W3PV2fyZpvhtuVrLdw EAkWttd27Uh4QFgvLt7qELObeTcwXL96A8pL+NwzzGtaZn/1a4iI1aUEoBh/Dc5lzXfb jgzARfKEilEgTU/CMZi4CJB6HJkJ60brtwTX0cgq3WbWGiNl/HCvN2dyh0ePbyrKCnas J2EaWMhbke6MU0lLrYfUnTkzKpl/ANGJzTMZgUaWNqamTbSScPAh4NPtZ4rBaM7aw9ZC JzLCmHYS1XA0OO31Qnl9T3P7XfvvNRN1gYdkT0TsZ83TaQJDOPkUzraHjussXaNqM8np VycQ== 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=gdRSBCutQVNtWSzAzPyx1octfk+39c+uxWTd5tKxUbY=; b=HqWc7tLBRzZCb5MhFYT7D3Ear2U2jTUAsUwEWT4VlYkNGLpiY9EdBpdgkisQrJMMC8 bTDYzYD4/xhayORZsrkAfpann+9eXFyVExXuanjIjiD0xK4M0mDZOAnu2QsYlISHAPXL p9mqRPgZS+jzQ27kMP315+MXSMsHzP8Bm4D36X9icslhCC4lwlnYFEQ2gIgoZsdfVDku j9C93/DUxe25YiPwnmtA7SVgTyPUWCU8vgim7kG5qNSD8621Yf+4PtVwfk5c3ZWjbg12 O/W0csV4Uj4CqupcKGl+YmBcZf/d1VdUUVDz5ANkF87u1grZgdnCPuCVJkQcwkz76zC6 vIqA== X-Gm-Message-State: APjAAAUtVJpCjwtTuNgiW5gofF5H2dqRDRbP+zRoxfZUNCVRRs5f1Qpr ByPQ3Q38bUyR8Ic09oHTS/S1F8E= X-Received: by 2002:a05:6214:1086:: with SMTP id o6mr11695709qvr.107.1567201680533; Fri, 30 Aug 2019 14:48:00 -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.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2019 14:48:00 -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 1/5] x86/boot: Wrap up the SRAT traversing code into subtable_parse() Date: Fri, 30 Aug 2019 17:47:03 -0400 Message-Id: <20190830214707.1201-2-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 Wrap up the SRAT traversing code into subtable_parse(). 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 149795c36..908a1bfab 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.18.1