From: Andrew Jones <ajones@ventanamicro.com>
To: Haibo Xu <haibo1.xu@intel.com>
Cc: sunilvl@ventanamicro.com, arnd@arndb.de, xiaobo55x@gmail.com,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>,
"Huacai Chen" <chenhuacai@kernel.org>,
"WANG Xuerui" <kernel@xen0n.name>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Len Brown" <lenb@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Conor Dooley" <conor.dooley@microchip.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Anup Patel" <anup@brainfault.org>,
"Charlie Jenkins" <charlie@rivosinc.com>,
"Baoquan He" <bhe@redhat.com>,
"Samuel Holland" <samuel.holland@sifive.com>,
"Sami Tolvanen" <samitolvanen@google.com>,
"Zong Li" <zong.li@sifive.com>,
"Clément Léger" <cleger@rivosinc.com>,
"Alexandre Ghiti" <alexghiti@rivosinc.com>,
"Chen Jiahao" <chenjiahao16@huawei.com>,
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
"James Morse" <james.morse@arm.com>,
"Evan Green" <evan@rivosinc.com>,
"Zhao Ke" <ke.zhao@shingroup.cn>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Andy Chiu" <andy.chiu@sifive.com>,
"Marc Zyngier" <maz@kernel.org>,
"Tony Luck" <tony.luck@intel.com>,
"Ard Biesheuvel" <ardb@kernel.org>,
"Alison Schofield" <alison.schofield@intel.com>,
"Dan Williams" <dan.j.williams@intel.com>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
"Robert Richter" <rrichter@amd.com>,
"Yuntao Wang" <ytcoode@gmail.com>,
"Dave Jiang" <dave.jiang@intel.com>,
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: Re: [PATCH v4 1/4] ACPI: RISCV: Add NUMA support based on SRAT and SLIT
Date: Tue, 23 Jul 2024 08:29:57 -0500 [thread overview]
Message-ID: <20240723-23811cc47f7863d12b6a78e8@orel> (raw)
In-Reply-To: <65dbad1fda08a32922c44886e4581e49b4a2fecc.1718268003.git.haibo1.xu@intel.com>
On Thu, Jun 13, 2024 at 04:54:33PM GMT, Haibo Xu wrote:
> 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 <haibo1.xu@intel.com>
> Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
> ---
> 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 <hanjun.guo@linaro.org>
> + * 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 <linux/acpi.h>
> +#include <linux/bitmap.h>
> +#include <linux/kernel.h>
> +#include <linux/mm.h>
> +#include <linux/memblock.h>
> +#include <linux/mmzone.h>
> +#include <linux/module.h>
> +#include <linux/topology.h>
> +
> +#include <asm/numa.h>
> +
> +static int acpi_early_node_map[NR_CPUS] __initdata = { NUMA_NO_NODE };
This only sets acpi_early_node_map[0] to NUMA_NO_NODE. Assuming we want
to ensure all of them are initialized to NUMA_NO_NODE, then we need
static int acpi_early_node_map[NR_CPUS] __initdata = { [0 ... NR_CPUS - 1] = NUMA_NO_NODE };
Thanks,
drew
next prev parent reply other threads:[~2024-07-23 13:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-13 8:54 [PATCH v4 0/4] Add ACPI NUMA support for RISC-V Haibo Xu
2024-06-13 8:54 ` [PATCH v4 1/4] ACPI: RISCV: Add NUMA support based on SRAT and SLIT Haibo Xu
2024-07-23 13:29 ` Andrew Jones [this message]
2024-07-23 14:21 ` Haibo Xu
2024-07-23 14:50 ` Anup Patel
2024-07-23 14:53 ` Haibo Xu
2024-06-13 8:54 ` [PATCH v4 2/4] ACPI: NUMA: Add handler for SRAT RINTC affinity structure Haibo Xu
2024-06-13 8:54 ` [PATCH v4 3/4] ACPI: NUMA: change the ACPI_NUMA to a hidden option Haibo Xu
2024-06-17 13:34 ` Haibo Xu
2024-06-18 15:18 ` Will Deacon
2024-06-19 1:17 ` Haibo Xu
2024-06-19 2:24 ` Huacai Chen
2024-06-13 8:54 ` [PATCH v4 4/4] ACPI: NUMA: replace pr_info with pr_debug in arch_acpi_numa_init Haibo Xu
2024-06-24 2:26 ` [PATCH v4 0/4] Add ACPI NUMA support for RISC-V Hanjun Guo
2024-07-01 5:52 ` Sunil V L
2024-07-23 12:58 ` patchwork-bot+linux-riscv
2024-07-24 14:50 ` Palmer Dabbelt
2024-07-24 14:56 ` Haibo Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240723-23811cc47f7863d12b6a78e8@orel \
--to=ajones@ventanamicro.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=alexghiti@rivosinc.com \
--cc=alison.schofield@intel.com \
--cc=andy.chiu@sifive.com \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=bhe@redhat.com \
--cc=catalin.marinas@arm.com \
--cc=charlie@rivosinc.com \
--cc=chenhuacai@kernel.org \
--cc=chenjiahao16@huawei.com \
--cc=cleger@rivosinc.com \
--cc=conor.dooley@microchip.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=evan@rivosinc.com \
--cc=gregkh@linuxfoundation.org \
--cc=haibo1.xu@intel.com \
--cc=james.morse@arm.com \
--cc=ke.zhao@shingroup.cn \
--cc=kernel@xen0n.name \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=loongarch@lists.linux.dev \
--cc=maz@kernel.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=rafael@kernel.org \
--cc=rmk+kernel@armlinux.org.uk \
--cc=rrichter@amd.com \
--cc=samitolvanen@google.com \
--cc=samuel.holland@sifive.com \
--cc=sunilvl@ventanamicro.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=will@kernel.org \
--cc=xiaobo55x@gmail.com \
--cc=ytcoode@gmail.com \
--cc=zong.li@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox