In some configuration, there is CPU-only (no memory) numa node. Don't create crat memory sub-table for such node. Signed-off-by: Oak Zeng <Oak.Zeng@xxxxxxx> --- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c index 56e6dff..dd7772c 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c @@ -1583,7 +1583,8 @@ static int kfd_fill_cu_for_cpu(int numa_node_id, int *avail_size, * @avail_size: Available size in the memory * @sub_type_hdr: Memory into which compute info will be filled in * - * Return 0 if successful else return -ve value + * Return memory size in bytes if successful else return -ve value + * Returning 0 means this numa node has no memory */ static int kfd_fill_mem_info_for_cpu(int numa_node_id, int *avail_size, int proximity_domain, @@ -1619,7 +1620,7 @@ static int kfd_fill_mem_info_for_cpu(int numa_node_id, int *avail_size, sub_type_hdr->length_high = upper_32_bits(mem_in_bytes); sub_type_hdr->proximity_domain = proximity_domain; - return 0; + return mem_in_bytes; } #ifdef CONFIG_X86_64 @@ -1746,11 +1747,15 @@ static int kfd_create_vcrat_image_cpu(void *pcrat_image, size_t *size) pr_err("fill mem for cpu failed\n"); return ret; } - crat_table->length += sub_type_hdr->length; - crat_table->total_entries++; - sub_type_hdr = (typeof(sub_type_hdr))((char *)sub_type_hdr + - sub_type_hdr->length); + /* ret == 0: this node has no memory */ + if (ret > 0) { + crat_table->length += sub_type_hdr->length; + crat_table->total_entries++; + + sub_type_hdr = (typeof(sub_type_hdr))((char *)sub_type_hdr + + sub_type_hdr->length); + } if (kfd_numa_node_to_apic_id(numa_node_id) != -1) { /* Fill in Subtype: IO Link */ -- 2.7.4 _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx