From patchwork Thu Jun 13 08:54:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xu, Haibo1" X-Patchwork-Id: 13696369 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F0A6C27C4F for ; Thu, 13 Jun 2024 08:36:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wxGSBw+oZLxJ2NV31UQu1qqLkfchx9O0mARHQT33IU4=; b=E/LFjnttboPzAx XXZDIRw+cIKbrIVpFWvfo1IKQBieY9EEtGzLDKNOHausg+1LFPedH/ChLVDOwJSO5O4MN6Qjn1mjF pBLJ/+frHzTav8geD7r1zil1t9VaLJsHnNzzuvk+HDQWyzlBBT0bbbjXrbNmJ0whqohLcrcUY6mMS 7pi3nUMwamkDXccCEFHWEupc5fNlNncbZAYWE1m5NrMjkUbXmsqQqf4ABdgACX4pWpP6mVeE3IhOB tPDwGfrU2Mxf9O+WdvYKQzSz8A+GGOkikJ6AeBajjYdbRKUkJVHop0uGBgDjdZMpppHs2NqytLU0s 5VJXlBPP94gUyhXsi/ig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHfx0-0000000FirF-3kiK; Thu, 13 Jun 2024 08:36:54 +0000 Received: from mgamail.intel.com ([198.175.65.21]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHfww-0000000FipC-3VX2; Thu, 13 Jun 2024 08:36:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718267811; x=1749803811; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MdSsdR+nCk+lUET3GoDI+x2qw9fyMSMCpII1FEoUKIU=; b=h5hp5aq9eB4+aC3BxmgPnbq4le+4zaNkfp4rTojCHiH6mllisVBQ3upd bQl4bV1BaCeXPzeFIlHq70qbB1GBb1YInhmDo5FYbpSkciQzI6QizNyev 2WbOHGTC+aG2S0nz6+6PgmeLYPxLDeXF5lhLI1q09/0vOR8EN3hHpzrz4 N3aawaefPgXOtjPVOJlf26rSA52HgKK0od9Vw+/8JjFzbpbYU3i8Da81O c01xZFYUMAwPHz6+jxH52gnezBIqgSngdqjNibrQaUZiBFAJEMQHUKPYY 7Hj58Jua0fJYDJjS/Mxwcxh7K9K0uqI1FGplvfdKo9makGQrowC9aMUKs g==; X-CSE-ConnectionGUID: wnJ10Zn4SRmIirAM9BdO4g== X-CSE-MsgGUID: eKC+vl+OR5ueOeLZN4wiUQ== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="15037795" X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="15037795" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2024 01:36:50 -0700 X-CSE-ConnectionGUID: /6kYW/xnTOybf+evepdIFg== X-CSE-MsgGUID: mtQyswmUSkiWSqE2erBdeQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="40033671" Received: from unknown (HELO haibo-OptiPlex-7090.sh.intel.com) ([10.239.159.132]) by fmviesa008.fm.intel.com with ESMTP; 13 Jun 2024 01:36:40 -0700 From: Haibo Xu To: sunilvl@ventanamicro.com, arnd@arndb.de Cc: xiaobo55x@gmail.com, ajones@ventanamicro.com, Haibo Xu , Catalin Marinas , Will Deacon , Huacai Chen , WANG Xuerui , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Conor Dooley , Andrew Morton , Anup Patel , Charlie Jenkins , Baoquan He , Samuel Holland , Sami Tolvanen , Zong Li , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Alexandre Ghiti , Chen Jiahao , "Russell King (Oracle)" , James Morse , Evan Green , Zhao Ke , Thomas Gleixner , Andy Chiu , Marc Zyngier , Tony Luck , Ard Biesheuvel , Alison Schofield , Dan Williams , Jonathan Cameron , Robert Richter , Yuntao Wang , Dave Jiang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org Subject: [PATCH v4 1/4] ACPI: RISCV: Add NUMA support based on SRAT and SLIT Date: Thu, 13 Jun 2024 16:54:33 +0800 Message-Id: <65dbad1fda08a32922c44886e4581e49b4a2fecc.1718268003.git.haibo1.xu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_013650_953599_7E45EADF X-CRM114-Status: GOOD ( 26.30 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add acpi_numa.c file to enable parse NUMA information from ACPI SRAT and SLIT tables. SRAT table provide CPUs(Hart) and memory nodes to proximity domain mapping, while SLIT table provide the distance metrics between proximity domains. Signed-off-by: Haibo Xu Reviewed-by: Sunil V L --- arch/riscv/include/asm/acpi.h | 15 +++- arch/riscv/kernel/Makefile | 1 + arch/riscv/kernel/acpi.c | 5 -- arch/riscv/kernel/acpi_numa.c | 131 ++++++++++++++++++++++++++++++++++ arch/riscv/kernel/setup.c | 4 +- arch/riscv/kernel/smpboot.c | 2 - include/linux/acpi.h | 6 ++ 7 files changed, 154 insertions(+), 10 deletions(-) create mode 100644 arch/riscv/kernel/acpi_numa.c diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h index 7dad0cf9d701..e0a1f84404f3 100644 --- a/arch/riscv/include/asm/acpi.h +++ b/arch/riscv/include/asm/acpi.h @@ -61,11 +61,14 @@ static inline void arch_fix_phys_package_id(int num, u32 slot) { } void acpi_init_rintc_map(void); struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu); -u32 get_acpi_id_for_cpu(int cpu); +static inline u32 get_acpi_id_for_cpu(int cpu) +{ + return acpi_cpu_get_madt_rintc(cpu)->uid; +} + int acpi_get_riscv_isa(struct acpi_table_header *table, unsigned int cpu, const char **isa); -static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; } void acpi_get_cbo_block_size(struct acpi_table_header *table, u32 *cbom_size, u32 *cboz_size, u32 *cbop_size); #else @@ -87,4 +90,12 @@ static inline void acpi_get_cbo_block_size(struct acpi_table_header *table, #endif /* CONFIG_ACPI */ +#ifdef CONFIG_ACPI_NUMA +int acpi_numa_get_nid(unsigned int cpu); +void acpi_map_cpus_to_nodes(void); +#else +static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; } +static inline void acpi_map_cpus_to_nodes(void) { } +#endif /* CONFIG_ACPI_NUMA */ + #endif /*_ASM_ACPI_H*/ diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile index 5b243d46f4b1..1e2afec141b5 100644 --- a/arch/riscv/kernel/Makefile +++ b/arch/riscv/kernel/Makefile @@ -110,3 +110,4 @@ obj-$(CONFIG_COMPAT) += compat_vdso/ obj-$(CONFIG_64BIT) += pi/ obj-$(CONFIG_ACPI) += acpi.o +obj-$(CONFIG_ACPI_NUMA) += acpi_numa.o diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c index e619edc8b0cc..040bdbfea2b4 100644 --- a/arch/riscv/kernel/acpi.c +++ b/arch/riscv/kernel/acpi.c @@ -191,11 +191,6 @@ struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu) return &cpu_madt_rintc[cpu]; } -u32 get_acpi_id_for_cpu(int cpu) -{ - return acpi_cpu_get_madt_rintc(cpu)->uid; -} - /* * __acpi_map_table() will be called before paging_init(), so early_ioremap() * or early_memremap() should be called here to for ACPI table mapping. diff --git a/arch/riscv/kernel/acpi_numa.c b/arch/riscv/kernel/acpi_numa.c new file mode 100644 index 000000000000..0231482d6946 --- /dev/null +++ b/arch/riscv/kernel/acpi_numa.c @@ -0,0 +1,131 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * ACPI 6.6 based NUMA setup for RISCV + * Lots of code was borrowed from arch/arm64/kernel/acpi_numa.c + * + * Copyright 2004 Andi Kleen, SuSE Labs. + * Copyright (C) 2013-2016, Linaro Ltd. + * Author: Hanjun Guo + * Copyright (C) 2024 Intel Corporation. + * + * Reads the ACPI SRAT table to figure out what memory belongs to which CPUs. + * + * Called from acpi_numa_init while reading the SRAT and SLIT tables. + * Assumes all memory regions belonging to a single proximity domain + * are in one chunk. Holes between them will be included in the node. + */ + +#define pr_fmt(fmt) "ACPI: NUMA: " fmt + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +static int acpi_early_node_map[NR_CPUS] __initdata = { NUMA_NO_NODE }; + +int __init acpi_numa_get_nid(unsigned int cpu) +{ + return acpi_early_node_map[cpu]; +} + +static inline int get_cpu_for_acpi_id(u32 uid) +{ + int cpu; + + for (cpu = 0; cpu < nr_cpu_ids; cpu++) + if (uid == get_acpi_id_for_cpu(cpu)) + return cpu; + + return -EINVAL; +} + +static int __init acpi_parse_rintc_pxm(union acpi_subtable_headers *header, + const unsigned long end) +{ + struct acpi_srat_rintc_affinity *pa; + int cpu, pxm, node; + + if (srat_disabled()) + return -EINVAL; + + pa = (struct acpi_srat_rintc_affinity *)header; + if (!pa) + return -EINVAL; + + if (!(pa->flags & ACPI_SRAT_RINTC_ENABLED)) + return 0; + + pxm = pa->proximity_domain; + node = pxm_to_node(pxm); + + /* + * If we can't map the UID to a logical cpu this + * means that the UID is not part of possible cpus + * so we do not need a NUMA mapping for it, skip + * the SRAT entry and keep parsing. + */ + cpu = get_cpu_for_acpi_id(pa->acpi_processor_uid); + if (cpu < 0) + return 0; + + acpi_early_node_map[cpu] = node; + pr_info("SRAT: PXM %d -> HARTID 0x%lx -> Node %d\n", pxm, + cpuid_to_hartid_map(cpu), node); + + return 0; +} + +void __init acpi_map_cpus_to_nodes(void) +{ + int i; + + /* + * In ACPI, SMP and CPU NUMA information is provided in separate + * static tables, namely the MADT and the SRAT. + * + * Thus, it is simpler to first create the cpu logical map through + * an MADT walk and then map the logical cpus to their node ids + * as separate steps. + */ + acpi_table_parse_entries(ACPI_SIG_SRAT, sizeof(struct acpi_table_srat), + ACPI_SRAT_TYPE_RINTC_AFFINITY, acpi_parse_rintc_pxm, 0); + + for (i = 0; i < nr_cpu_ids; i++) + early_map_cpu_to_node(i, acpi_numa_get_nid(i)); +} + +/* Callback for Proximity Domain -> logical node ID mapping */ +void __init acpi_numa_rintc_affinity_init(struct acpi_srat_rintc_affinity *pa) +{ + int pxm, node; + + if (srat_disabled()) + return; + + if (pa->header.length < sizeof(struct acpi_srat_rintc_affinity)) { + pr_err("SRAT: Invalid SRAT header length: %d\n", pa->header.length); + bad_srat(); + return; + } + + if (!(pa->flags & ACPI_SRAT_RINTC_ENABLED)) + return; + + pxm = pa->proximity_domain; + node = acpi_map_pxm_to_node(pxm); + + if (node == NUMA_NO_NODE) { + pr_err("SRAT: Too many proximity domains %d\n", pxm); + bad_srat(); + return; + } + + node_set(node, numa_nodes_parsed); +} diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 4f73c0ae44b2..a2cde65b69e9 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -281,8 +281,10 @@ void __init setup_arch(char **cmdline_p) setup_smp(); #endif - if (!acpi_disabled) + if (!acpi_disabled) { acpi_init_rintc_map(); + acpi_map_cpus_to_nodes(); + } riscv_init_cbo_blocksizes(); riscv_fill_hwcap(); diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index 19baf0d574d3..0f8f1c95ac38 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -96,7 +96,6 @@ static int __init acpi_parse_rintc(union acpi_subtable_headers *header, const un if (hart == cpuid_to_hartid_map(0)) { BUG_ON(found_boot_cpu); found_boot_cpu = true; - early_map_cpu_to_node(0, acpi_numa_get_nid(cpu_count)); return 0; } @@ -106,7 +105,6 @@ static int __init acpi_parse_rintc(union acpi_subtable_headers *header, const un } cpuid_to_hartid_map(cpu_count) = hart; - early_map_cpu_to_node(cpu_count, acpi_numa_get_nid(cpu_count)); cpu_count++; return 0; diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 28c3fb2bef0d..5a2b620ccd58 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -264,6 +264,12 @@ static inline void acpi_numa_gicc_affinity_init(struct acpi_srat_gicc_affinity *pa) { } #endif +#ifdef CONFIG_RISCV +void acpi_numa_rintc_affinity_init(struct acpi_srat_rintc_affinity *pa); +#else +static inline void acpi_numa_rintc_affinity_init(struct acpi_srat_rintc_affinity *pa) { } +#endif + #ifndef PHYS_CPUID_INVALID typedef u32 phys_cpuid_t; #define PHYS_CPUID_INVALID (phys_cpuid_t)(-1) From patchwork Thu Jun 13 08:54:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xu, Haibo1" X-Patchwork-Id: 13696370 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D1517C27C4F for ; Thu, 13 Jun 2024 08:37:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uBLzKjKc8XH/Us9fl3QnxRusk5ZrpffPW3QqfOh5sD4=; b=eI2uYRbbiWeCMZ vIj7TwARop4HpG+f4SvdemT67jOrt9b5LgL89kPo22rM7S0c0pz2gAniS5OZxWghGsQ5qFhL91pPr AAe/18ZSNoyn2Tbf+sb4seZL6rZ6L6NbEqIZA3TLN2pNsDi+AIwrZCK8ZFzAF69DadUeeC9bHmMAJ Jmti5z+lU3QOStNgBxqNOGSwPVHPNx4EqBmlcKj3qtZkdFrkQmUszWTOkkyCX3nqIK7QChNrraNzq khTlC4HksdabwmKQZWHHDAUdqOC5X4N+P7/kzm6BhA4amy/21eFu7yBEcUN6J8XRRnEldbMDe1KJI vE5mZ2ZZcgF2V4LbjRIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHfxW-0000000Fj6j-26g0; Thu, 13 Jun 2024 08:37:26 +0000 Received: from mgamail.intel.com ([192.198.163.9]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHfxT-0000000Fj4N-1BAX; Thu, 13 Jun 2024 08:37:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718267843; x=1749803843; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SaRkpFjoaclCx1YKomHNzFUcpLG013FKO00vTLvw6fg=; b=UwqUJRPR4Mhj9h4ca+1W5+c09Pd+gEnoi4xQ90Qlz2qNQppaYMBYcMLA mq56uodW2kMOvima5Z+TIkV8J1pAibo0+qr18Do3suS1LVgi9ql6z0Gc8 zBQWNedZSejvigIAqZsLD81CEr39wt6n6o2Q6u3jpDS7FDRKeh83M8bq3 QllMLLrvL2GrRq5dgHiwzEfvNII/97isvI6Uttfg89A6oDr7rT1zumMOA jdSFOzJVlA+byMpeMk4pCdxV4nSZ11vwZeu/65PFHXShebs348o72D+mN S899cO8h565cMM2lnqd9Css4HhLbXhRHUaC27yMoVHJLEwsFpTr65wjjO w==; X-CSE-ConnectionGUID: LTP3NtCpShSzzPl8K06KbQ== X-CSE-MsgGUID: pqoSfN6vSHCMkGyl727arQ== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="25749157" X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="25749157" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2024 01:37:10 -0700 X-CSE-ConnectionGUID: pGAZOKfuR1K929rsczf0QA== X-CSE-MsgGUID: wl+rYQFQQuqkHmvs9SoygA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="40033730" Received: from unknown (HELO haibo-OptiPlex-7090.sh.intel.com) ([10.239.159.132]) by fmviesa008.fm.intel.com with ESMTP; 13 Jun 2024 01:36:59 -0700 From: Haibo Xu To: sunilvl@ventanamicro.com, arnd@arndb.de Cc: xiaobo55x@gmail.com, ajones@ventanamicro.com, Haibo Xu , Catalin Marinas , Will Deacon , Huacai Chen , WANG Xuerui , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Conor Dooley , Andrew Morton , Charlie Jenkins , Baoquan He , Sami Tolvanen , Greentime Hu , Zong Li , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Samuel Holland , Chen Jiahao , "Russell King (Oracle)" , James Morse , Alexandre Ghiti , Evan Green , Zhao Ke , Andy Chiu , Marc Zyngier , Thomas Gleixner , Tony Luck , Ard Biesheuvel , Alison Schofield , Dan Williams , Jonathan Cameron , Robert Richter , Yuntao Wang , Dave Jiang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org Subject: [PATCH v4 2/4] ACPI: NUMA: Add handler for SRAT RINTC affinity structure Date: Thu, 13 Jun 2024 16:54:34 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_013723_426140_A68E71D7 X-CRM114-Status: GOOD ( 12.29 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add RINTC affinity structure handler during parsing SRAT table. Signed-off-by: Haibo Xu Reviewed-by: Sunil V L --- drivers/acpi/numa/srat.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index e3f26e71637a..44f91f2c6c5d 100644 --- a/drivers/acpi/numa/srat.c +++ b/drivers/acpi/numa/srat.c @@ -167,6 +167,19 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header) } } break; + + case ACPI_SRAT_TYPE_RINTC_AFFINITY: + { + struct acpi_srat_rintc_affinity *p = + (struct acpi_srat_rintc_affinity *)header; + pr_debug("SRAT Processor (acpi id[0x%04x]) in proximity domain %d %s\n", + p->acpi_processor_uid, + p->proximity_domain, + (p->flags & ACPI_SRAT_RINTC_ENABLED) ? + "enabled" : "disabled"); + } + break; + default: pr_warn("Found unsupported SRAT entry (type = 0x%x)\n", header->type); @@ -450,6 +463,21 @@ acpi_parse_gi_affinity(union acpi_subtable_headers *header, } #endif /* defined(CONFIG_X86) || defined (CONFIG_ARM64) */ +static int __init +acpi_parse_rintc_affinity(union acpi_subtable_headers *header, + const unsigned long end) +{ + struct acpi_srat_rintc_affinity *rintc_affinity; + + rintc_affinity = (struct acpi_srat_rintc_affinity *)header; + acpi_table_print_srat_entry(&header->common); + + /* let architecture-dependent part to do it */ + acpi_numa_rintc_affinity_init(rintc_affinity); + + return 0; +} + static int __init acpi_parse_srat(struct acpi_table_header *table) { struct acpi_table_srat *srat = (struct acpi_table_srat *)table; @@ -485,7 +513,7 @@ int __init acpi_numa_init(void) /* SRAT: System Resource Affinity Table */ if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { - struct acpi_subtable_proc srat_proc[4]; + struct acpi_subtable_proc srat_proc[5]; memset(srat_proc, 0, sizeof(srat_proc)); srat_proc[0].id = ACPI_SRAT_TYPE_CPU_AFFINITY; @@ -496,6 +524,8 @@ int __init acpi_numa_init(void) srat_proc[2].handler = acpi_parse_gicc_affinity; srat_proc[3].id = ACPI_SRAT_TYPE_GENERIC_AFFINITY; srat_proc[3].handler = acpi_parse_gi_affinity; + srat_proc[4].id = ACPI_SRAT_TYPE_RINTC_AFFINITY; + srat_proc[4].handler = acpi_parse_rintc_affinity; acpi_table_parse_entries_array(ACPI_SIG_SRAT, sizeof(struct acpi_table_srat), From patchwork Thu Jun 13 08:54:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xu, Haibo1" X-Patchwork-Id: 13696371 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D8C54C27C75 for ; Thu, 13 Jun 2024 08:37:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Bz0eNhKraS1YHjTdxyAdGUDmLYFibVqUihb9qfNXrRU=; b=QwNnr7HkYYJfag 5bSRZENEhBjYeFVXt3qS+2bhSV/epYucYK5FY+ygN0XqStefrx2PYhjsOBx3vKEyPL74undHrVE1M cjsJLWfU+PkfulVuclGkkLHAgn3EWtYyc/cAPW3UKoSMEfaCVdjFu0y9FFNJdk8L3o57ixDOmqW92 cH9NSID952eatiqA3w3ZyuN79UGmFQLzdhHqOnVkDJdRKcWG1Z7NY3dcWfYt/MQ35lCa6IoOAeFjN IDlYiNZGvtKCJYV5zvQHVrQiqPTEjVXZ93jltNacyFoZkaUT2W9xAfuuIrIjDVgObJ0qU3dl9/D7R bBVF5mb7upcN9MF0yaDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHfxd-0000000FjBN-2vRg; Thu, 13 Jun 2024 08:37:33 +0000 Received: from mgamail.intel.com ([192.198.163.9]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHfxY-0000000Fj4N-3deS; Thu, 13 Jun 2024 08:37:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718267849; x=1749803849; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=N5aRoQ5a+tTTGwEUeHzYzKK2fG6O4xqUyQUF3EVDF0I=; b=XFvJjgQZEn0WAGQUZEl3wAWq19eZrw82Xeyco5Ko7Xmlgk/mziNma532 0lkDetP/MnCbo+EBsNSWHQ98OdRYYmZf3ew/TYqzcyFtqxkRjt4rIf870 rWOtCGTsisBLQnYme25uJTIPEMiO8GT1LOPvvjC3oJUY/SVKG6jfPp2O4 CzwhW5RVgLtLc3+RIwEAB3FCTAlK7Uk+22sjQ2+H8L8qWA3TAzTPZnFhG VencKV9qyn7QapxGc6DXJN6B7EPw7JZQYMzGc1976freHR7vFGxG1Dy2t /ohd0B2O5j/wY+JLZtDA4THiPlQvtJrWTaL+hcbJwTRQyk3Edn+qXuhek w==; X-CSE-ConnectionGUID: VcsSSECvTnais6xyIKE5xA== X-CSE-MsgGUID: KOXQBXPWSFqGZxZ/+vrqyw== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="25749238" X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="25749238" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2024 01:37:28 -0700 X-CSE-ConnectionGUID: xEtIyw0CTh+EBzaSslP7dg== X-CSE-MsgGUID: puLY93RPS1CngwiVDwzSwA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="40033803" Received: from unknown (HELO haibo-OptiPlex-7090.sh.intel.com) ([10.239.159.132]) by fmviesa008.fm.intel.com with ESMTP; 13 Jun 2024 01:37:19 -0700 From: Haibo Xu To: sunilvl@ventanamicro.com, arnd@arndb.de Cc: xiaobo55x@gmail.com, ajones@ventanamicro.com, Haibo Xu , Catalin Marinas , Will Deacon , Huacai Chen , WANG Xuerui , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Conor Dooley , Andrew Morton , Baoquan He , Charlie Jenkins , Evan Green , Sami Tolvanen , Zong Li , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Alexandre Ghiti , Samuel Holland , Chen Jiahao , James Morse , "Russell King (Oracle)" , Zhao Ke , Andy Chiu , Marc Zyngier , Thomas Gleixner , Tony Luck , Ard Biesheuvel , Dan Williams , Alison Schofield , Jonathan Cameron , Robert Richter , Yuntao Wang , Dave Jiang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org Subject: [PATCH v4 3/4] ACPI: NUMA: change the ACPI_NUMA to a hidden option Date: Thu, 13 Jun 2024 16:54:35 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_013728_953142_50BEE13F X-CRM114-Status: GOOD ( 12.40 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org x86/arm64/loongarch would select ACPI_NUMA by default and riscv would do the same thing, so change it to a hidden option and the select statements except for the X86_64_ACPI_NUMA can also go away. Suggested-by: Arnd Bergmann Suggested-by: Sunil V L Signed-off-by: Haibo Xu Reviewed-by: Sunil V L Acked-by: Will Deacon Acked-by: Huacai Chen --- arch/arm64/Kconfig | 1 - arch/loongarch/Kconfig | 1 - drivers/acpi/numa/Kconfig | 5 +---- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 5d91259ee7b5..5079ad4e21a5 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1484,7 +1484,6 @@ config HOTPLUG_CPU config NUMA bool "NUMA Memory Allocation and Scheduler Support" select GENERIC_ARCH_NUMA - select ACPI_NUMA if ACPI select OF_NUMA select HAVE_SETUP_PER_CPU_AREA select NEED_PER_CPU_EMBED_FIRST_CHUNK diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index e38139c576ee..8d9e06e4ad84 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -470,7 +470,6 @@ config NR_CPUS config NUMA bool "NUMA Support" select SMP - select ACPI_NUMA if ACPI help Say Y to compile the kernel with NUMA (Non-Uniform Memory Access) support. This option improves performance on systems with more diff --git a/drivers/acpi/numa/Kconfig b/drivers/acpi/numa/Kconfig index 849c2bd820b9..f33194d1e43f 100644 --- a/drivers/acpi/numa/Kconfig +++ b/drivers/acpi/numa/Kconfig @@ -1,9 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 config ACPI_NUMA - bool "NUMA support" - depends on NUMA - depends on (X86 || ARM64 || LOONGARCH) - default y if ARM64 + def_bool NUMA && !X86 config ACPI_HMAT bool "ACPI Heterogeneous Memory Attribute Table Support" From patchwork Thu Jun 13 08:54:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xu, Haibo1" X-Patchwork-Id: 13696372 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 734C0C27C75 for ; Thu, 13 Jun 2024 08:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Vl6WK+geQFfhcvogwL6Hiaslv7DRc0mbyagF9fCLgos=; b=TUkFddab/uviXO 7U0WVy4R/idxTOCo0xWkkP/7FUJs6YjeG+MzN1fRdQsQVMJfQUZcS5ewdI+akFq7vJx9SmtgxxRba 9k4FxuPyzCQzVYu1FZQ9cGrDyYJN0CsfLJ+UCkUyc4BivqonCz2ejm0EOc1cV1E9DFHGUPy/dm+m8 DsW65ecxsLgyL81IzTMv7VcxbpEZMnujdydPkXvm2muxMD85ARwlI6rLRT9ktaiFWK5eE+kQRzZl4 FrDqVyU3s0Dm3l5erdJEPmcoF/z2ZvayoXXUY1ykVgB5EpIV4pkbEMPT43PGGIsRvXGZiVeaFDc0I BqM2Lt+k0f3Uu0Z7Bm1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHfxv-0000000FjMZ-01gX; Thu, 13 Jun 2024 08:37:51 +0000 Received: from mgamail.intel.com ([192.198.163.9]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sHfxr-0000000FjKG-2Nps; Thu, 13 Jun 2024 08:37:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718267868; x=1749803868; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ex1BfUqwBKGcn6bmqOhnx0hqarbIcWjP42s/m1fBXKk=; b=F6Mcol+Mf98mG1lU3NY66ovG0avOWsIf+PchjUeipeuKGvLy4QpZoFXA US4AqVBct/15sXjrp8QH8nqXcFac5/vo/38rU+GonHo9X+K5kfZ8P+hfT pgMB0Rto70FzmFAFNnkmlRDVsn0qDJ2RXAd1lEqm8hBUYbI9KN/DbGu59 7k4JLWgsL4nmGws7ybiSE9InDAm2IaafWYWFF069oI8HdzCRvV1j8iIxp TzN1DLT7H/qj3/keqiOIUundjyBm0fw8u7QkqlyGJM9fd4Wgq4kY1NZdK rxQAFuAzzTk56drDRSoJKQUrj/6CWi0sBwpfJu6ivffHMDfA3FSgBKLNM g==; X-CSE-ConnectionGUID: V00rd+K9QYeubd+gryg/AA== X-CSE-MsgGUID: HrGrY9jAQSG3sTZX/1TruQ== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="25749303" X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="25749303" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jun 2024 01:37:47 -0700 X-CSE-ConnectionGUID: 1gvnnVjqQ6yZUNEZ9djjdQ== X-CSE-MsgGUID: sHA/Q8m2T2yX18P2Q81yoQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="40033851" Received: from unknown (HELO haibo-OptiPlex-7090.sh.intel.com) ([10.239.159.132]) by fmviesa008.fm.intel.com with ESMTP; 13 Jun 2024 01:37:38 -0700 From: Haibo Xu To: sunilvl@ventanamicro.com, arnd@arndb.de Cc: xiaobo55x@gmail.com, ajones@ventanamicro.com, Haibo Xu , Catalin Marinas , Will Deacon , Huacai Chen , WANG Xuerui , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Conor Dooley , Andrew Morton , Charlie Jenkins , Baoquan He , Sami Tolvanen , Zong Li , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Alexandre Ghiti , Chen Jiahao , Samuel Holland , James Morse , "Russell King (Oracle)" , Evan Green , Andy Chiu , Yang Li , Marc Zyngier , Thomas Gleixner , Ard Biesheuvel , Tony Luck , Dan Williams , Alison Schofield , Jonathan Cameron , Robert Richter , Yuntao Wang , Dave Jiang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, linux-acpi@vger.kernel.org Subject: [PATCH v4 4/4] ACPI: NUMA: replace pr_info with pr_debug in arch_acpi_numa_init Date: Thu, 13 Jun 2024 16:54:36 +0800 Message-Id: <109354315a02cd22145d2effa4a8c571b69d3e56.1718268003.git.haibo1.xu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240613_013747_767691_476DE4A5 X-CRM114-Status: GOOD ( 12.08 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org There are lots of ACPI enabled systems that aren't NUMA and If the firmware didn't provide the SRAT/SLIT, then there will be a message "Failed to initialise from firmware" from arch_acpi_numa_init() which adding noise to the boot on all of those kind of systems. Replace the pr_info with pr_debug in arch_acpi_numa_init() to avoid it. Suggested-by: Sunil V L Signed-off-by: Haibo Xu Reviewed-by: Sunil V L --- drivers/base/arch_numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c index 5b59d133b6af..555aee3ee8e7 100644 --- a/drivers/base/arch_numa.c +++ b/drivers/base/arch_numa.c @@ -445,7 +445,7 @@ static int __init arch_acpi_numa_init(void) ret = acpi_numa_init(); if (ret) { - pr_info("Failed to initialise from firmware\n"); + pr_debug("Failed to initialise from firmware\n"); return ret; }