提交 0e797399 编写于 作者: W Wang ShaoBo 提交者: Zheng Zengkai

ACPI/MPAM: Use acpi_map_pxm_to_node() to get node id for memory node

hulk inclusion
category: feature
bugzilla: 34278, https://gitee.com/openeuler/kernel/issues/I4K27D
CVE: NA

-------------------------------------------------

Proximity domain of Memory MSC node cannot be treated as node id for
components' index, we should use acpi_map_pxm_to_node() to get the exact
node id anyway, for instance, after DIE interleaving, we can only use
node id instead, for pxm is discontinuous at this time.
Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
Reviewed-by: NCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 e163ff16
...@@ -71,42 +71,17 @@ acpi_mpam_label_cache_component_id(struct acpi_table_header *table_hdr, ...@@ -71,42 +71,17 @@ acpi_mpam_label_cache_component_id(struct acpi_table_header *table_hdr,
return 0; return 0;
} }
/**
* acpi_mpam_label_memory_component_id() - Use proximity_domain id to
* label mpam memory node, which be signed by @component_id.
* @proximity_domain: proximity_domain of ACPI MPAM memory node
* @component_id: The id labels the structure mpam_node memory
*/
static int acpi_mpam_label_memory_component_id(u8 proximity_domain,
u32 *component_id)
{
u32 nid = (u32)proximity_domain;
if (nid >= nr_online_nodes) {
pr_err_once("Invalid proximity domain\n");
return -EINVAL;
}
*component_id = nid;
return 0;
}
static int __init acpi_mpam_parse_memory(struct acpi_mpam_header *h) static int __init acpi_mpam_parse_memory(struct acpi_mpam_header *h)
{ {
int ret;
u32 component_id; u32 component_id;
struct mpam_device *dev; struct mpam_device *dev;
struct acpi_mpam_node_memory *node = (struct acpi_mpam_node_memory *)h; struct acpi_mpam_node_memory *node = (struct acpi_mpam_node_memory *)h;
ret = acpi_mpam_label_memory_component_id(node->proximity_domain, component_id = acpi_map_pxm_to_node(node->proximity_domain);
&component_id); if (component_id == NUMA_NO_NODE)
if (ret) { component_id = 0;
pr_err("Failed to label memory component id\n");
return -EINVAL;
}
dev = mpam_device_create_memory(component_id, dev = mpam_device_create_memory(component_id, node->header.base_address);
node->header.base_address);
if (IS_ERR(dev)) { if (IS_ERR(dev)) {
pr_err("Failed to create memory node\n"); pr_err("Failed to create memory node\n");
return -EINVAL; return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册