Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp17320448rwd; Tue, 27 Jun 2023 01:02:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7TdeaUInBgI/DVXlVTA/uwIs/eWgqzyWLcc3gn8PTjQLt5dPjvJcih32cgfVO0faxjnWMz X-Received: by 2002:a17:902:ce8a:b0:1b6:8f1f:fc8d with SMTP id f10-20020a170902ce8a00b001b68f1ffc8dmr8043481plg.0.1687852958272; Tue, 27 Jun 2023 01:02:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687852958; cv=none; d=google.com; s=arc-20160816; b=TdrVPOIpFtda2E969+El/ORbG8VfCxntFph9pWdtFTD+mD1ezeGgdNkMwQ2UAm/MbW u50M9pBsHdMUqHhskyM/rnMaMQ1bvIu0A9yzWWXppCZ6O053+6O19cwAjieokMWSlirz PZLasL/ikAHb+gJ1XFlBAMIkI9OOXcmNWHTv8gquoV1nKpDT2d01QcqNPgI/yiOL0yKh Os9a3YgwC6qMj/mAtTU9rTTvnsrqfZqfNSwMPwWHTFCzaAdjvApr4EHOhNsOt5aU4PSC zLhbVl5B2rJk38J30f6lXsiPa24Vl657hBQ2zoydSgfvMw6/y4xGdHsyqLkZ2h40oTzN mc3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=rDEzAo1VXiqZ899g34kuC/RyTIU/6VEVuMbphol/K90=; fh=KEM/azUR2tNW38L92oFZFKEPapJ2JA4LqVnmR1mb/18=; b=b1qvuGEgkEPVQxN/vlETZYZ3UGCnH2rAEKTS2f17wXxp+DlzCJwWz1zzCrPn/1uUl7 YGIeHZY23RhRmhwhptw8APkItvseDCPsacxzLKqNYRxUKkSpKo0kYH8UX6eB8104pg7Y 8BVpUXBpmVQmZIvGJ2VcKqKR591QxOPwuuKZKs7s02mpIWKINmsByKr0PjirdqEDPSp9 D+P692JJNy2EMJIULvC5FKirYX3NuEXQoensSsHd/KGhE1ynJjyZ8Krb+uS+uqS8SwlE nC5/Yk5ZpL9N/HdIsxBhCbUsYuD0Wk+5ErG+vQQAtG0CY90WwqT1TKtTGEhBqbJh1YMw Ci2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=eHqDSHga; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc2-20020a170902930200b001adc5bc4d8asi6291917plb.572.2023.06.27.01.02.23; Tue, 27 Jun 2023 01:02:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=eHqDSHga; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230350AbjF0H3M (ORCPT + 99 others); Tue, 27 Jun 2023 03:29:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231292AbjF0H25 (ORCPT ); Tue, 27 Jun 2023 03:28:57 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6A99B30EC for ; Tue, 27 Jun 2023 00:28:19 -0700 (PDT) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id A3F4520C08E6; Tue, 27 Jun 2023 00:28:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A3F4520C08E6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1687850898; bh=rDEzAo1VXiqZ899g34kuC/RyTIU/6VEVuMbphol/K90=; h=From:To:Cc:Subject:Date:From; b=eHqDSHgaNLW4PuVGscrgqX+BPFfVXaaTGgU2mhwcXz5xx+XneMb8R44FzIk7m6nW2 IPAz2VRxb/eIIHw3XspUTYo6kHx0rn6uyO8kHhejcIqP6vOSITUtfFl+d1L7tTWwD7 tAy6Dc20gvpk19edsnxxn0iRTShJZFvoCsgFJwe4= From: Saurabh Sengar To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, luto@kernel.org, peterz@infradead.org, mikelley@microsoft.com, linux-kernel@vger.kernel.org Cc: ssengar@linux.microsoft.com Subject: [PATCH] x86/numa: Add Devicetree support Date: Tue, 27 Jun 2023 00:28:02 -0700 Message-Id: <1687850882-22554-1-git-send-email-ssengar@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hyper-V has usecases where it need to fetch NUMA information from Devicetree. Currently, it is not possible to extract the NUMA information from Devicetree for x86 arch. Add support for Devicetree in the x86_numa_init function, allowing the retrieval of NUMA node information from the Devicetree. Additionally, relocate the x86_dtb_init function before initmem_init to ensure the Devicetree initialization prior to its utilization in x86_numa_init. Signed-off-by: Saurabh Sengar --- arch/x86/Kconfig | 1 + arch/x86/kernel/setup.c | 2 +- arch/x86/mm/numa.c | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index c531b16ee0bf..a2ada193b2d8 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1567,6 +1567,7 @@ config NUMA depends on X86_64 || (X86_32 && HIGHMEM64G && X86_BIGSMP) default y if X86_BIGSMP select USE_PERCPU_NUMA_NODE_ID + select OF_NUMA if OF help Enable NUMA (Non-Uniform Memory Access) support. diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index fd975a4a5200..940c92a6a5e9 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -1220,6 +1220,7 @@ void __init setup_arch(char **cmdline_p) early_acpi_boot_init(); + x86_dtb_init(); initmem_init(); dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT); @@ -1261,7 +1262,6 @@ void __init setup_arch(char **cmdline_p) * Read APIC and some other early information from ACPI tables. */ acpi_boot_init(); - x86_dtb_init(); /* * get boot-time SMP configuration: diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 2aadb2019b4f..a6d3d331fda2 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -733,6 +734,8 @@ void __init x86_numa_init(void) if (!numa_init(amd_numa_init)) return; #endif + if (acpi_disabled && !numa_init(of_numa_init)) + return; } numa_init(dummy_numa_init); -- 2.34.1