From: Lijun Fang fanglijun3@huawei.com
ascend inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JMLR CVE: NA ---------------------
When the kernel boot, we need to determine DDR or HBM, and add them to nodes by parse cmdline, instead of memory hotplug.
Signed-off-by: Lijun Fang fanglijun3@huawei.com Reviewed-by: Weilong Chen chenweilong@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- .../admin-guide/kernel-parameters.txt | 6 ++++++ arch/arm64/include/asm/numa.h | 3 +++ arch/arm64/mm/numa.c | 20 +++++++++++++++++++ 3 files changed, 29 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 8eca743da732..d4b9d4a05b7d 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -493,6 +493,12 @@ ccw_timeout_log [S390] See Documentation/s390/common_io.rst for details.
+ cdm-nodes= [KNL] + Format: hexadecimal expression + One bit express one node, if the node is HBM, set the + bit to 1. Then transform Binary to hexadecimal. + Example: node1, node2 is HBM, cdm-nodes=0x06. + cgroup_disable= [KNL] Disable a particular controller Format: {name of the controller(s) to disable} The effects of cgroup_disable=foo are: diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h index e0c51519e71b..43bfff72a32f 100644 --- a/arch/arm64/include/asm/numa.h +++ b/arch/arm64/include/asm/numa.h @@ -19,6 +19,9 @@ extern bool numa_off; extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES]; void numa_clear_node(unsigned int cpu);
+#ifdef CONFIG_COHERENT_DEVICE +extern nodemask_t cdmmask; +#endif #ifdef CONFIG_DEBUG_PER_CPU_MAPS const struct cpumask *cpumask_of_node(int node); #else diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index dae7179ba609..b2260bb53691 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -26,10 +26,30 @@ static u8 *numa_distance; bool numa_off;
#ifdef CONFIG_COHERENT_DEVICE +nodemask_t cdmmask; + inline int arch_check_node_cdm(int nid) { + return node_isset(nid, cdmmask); +} + +static int __init cdm_nodes_setup(char *s) +{ + int nid; + unsigned long tmpmask; + int err; + + err = kstrtoul(s, 0, &tmpmask); + if (err) + return err; + + for (nid = 0; nid < MAX_NUMNODES; nid++) { + if ((tmpmask >> nid) & 1) + node_set(nid, cdmmask); + } return 0; } +early_param("cdm-nodes", cdm_nodes_setup); #endif
static __init int numa_parse_early_param(char *opt)