Re: [PATCH 03/15] mshyperv: Introduce numa_node_to_proximity_domain_info
From: Wei Liu <wei.liu@kernel.org>
Date: 2023-08-02 23:48:01
Also in:
linux-arch, linux-arm-kernel, lkml
On Thu, Jul 27, 2023 at 12:54:38PM -0700, Nuno Das Neves wrote:
Factor out logic for converting numa node to proximity domain info into a helper function, and export it. Signed-off-by: Nuno Das Neves <redacted>
Reviewed-by: Wei Liu <wei.liu@kernel.org>
--- arch/x86/hyperv/hv_proc.c | 8 ++------ drivers/acpi/numa/srat.c | 1 + include/asm-generic/mshyperv.h | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 6 deletions(-)
[...]
quoted hunk ↗ jump to hunk
diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index 1f4fc5f8a819..0cf9f0574495 100644 --- a/drivers/acpi/numa/srat.c +++ b/drivers/acpi/numa/srat.c@@ -48,6 +48,7 @@ int node_to_pxm(int node) return PXM_INVAL; return node_to_pxm_map[node]; } +EXPORT_SYMBOL(node_to_pxm);
Rafael and Len, I would like to get an ACK from you on this one line change. I see a lot of other functions in that file are already exported, so I hope this is okay, too. It's user is the function below numa_node_to_proximity_domain_info. Thanks, Wei.
quoted hunk ↗ jump to hunk
static void __acpi_map_pxm_to_node(int pxm, int node) {diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h index 233c976344e5..447e7ebe67ee 100644 --- a/include/asm-generic/mshyperv.h +++ b/include/asm-generic/mshyperv.h@@ -21,6 +21,7 @@ #include <linux/types.h> #include <linux/atomic.h> #include <linux/bitops.h> +#include <acpi/acpi_numa.h> #include <linux/cpumask.h> #include <linux/nmi.h> #include <asm/ptrace.h>@@ -28,6 +29,23 @@ #define VTPM_BASE_ADDRESS 0xfed40000 +static inline union hv_proximity_domain_info +numa_node_to_proximity_domain_info(int node) +{ + union hv_proximity_domain_info proximity_domain_info; + + if (node != NUMA_NO_NODE) { + proximity_domain_info.domain_id = node_to_pxm(node); + proximity_domain_info.flags.reserved = 0; + proximity_domain_info.flags.proximity_info_valid = 1; + proximity_domain_info.flags.proximity_preferred = 1; + } else { + proximity_domain_info.as_uint64 = 0; + } + + return proximity_domain_info; +} + struct ms_hyperv_info { u32 features; u32 priv_high;-- 2.25.1