[PATCH 4/7] drm/amdgpu: Parse NUMA affinity entries from VCRAT
Donet Tom <[email protected]> Tue, 4 Aug 2026 15:22:33 +0530
| Newsgroups | org.freedesktop.lists.amd-gfx |
|---|---|
| Message-ID | <515a19459d4059cadde46e65137aa3ca3961d94c.1785833981.git.donettom@linux.ibm.com> |
Parse the NUMA affinity entries from the VCRAT and populate the corresponding NUMA node information in the topology device. Signed-off-by: Donet Tom <[email protected]> --- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 23 +++++++++++++++++++++++ drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 1 + 2 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c index 5613eb69423d..079bce6d904d 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c @@ -1299,6 +1299,23 @@ static int kfd_parse_subtype_iolink(struct crat_subtype_iolink *iolink, return 0; } +static int kfd_parse_subtype_numa(struct crat_subtype_numa *numa, + struct list_head *device_list) +{ + struct kfd_topology_device *dev; + + pr_debug("Found NUMA entry in CRAT table with proximity_domain=%u numa node=%u\n", + numa->proximity_domain, numa->numa_node); + list_for_each_entry(dev, device_list, list) { + if (numa->proximity_domain == dev->proximity_domain) { + dev->numa_node = numa->numa_node; + break; + } + } + + return 0; +} + /* kfd_parse_subtype - parse subtypes and attach it to correct topology device * present in the device_list * @sub_type_hdr - subtype section of crat_image @@ -1311,6 +1328,7 @@ static int kfd_parse_subtype(struct crat_subtype_generic *sub_type_hdr, struct crat_subtype_memory *mem; struct crat_subtype_cache *cache; struct crat_subtype_iolink *iolink; + struct crat_subtype_numa *numa; int ret = 0; switch (sub_type_hdr->type) { @@ -1342,6 +1360,10 @@ static int kfd_parse_subtype(struct crat_subtype_generic *sub_type_hdr, iolink = (struct crat_subtype_iolink *)sub_type_hdr; ret = kfd_parse_subtype_iolink(iolink, device_list); break; + case CRAT_SUBTYPE_NUMA_AFFINITY: + numa = (struct crat_subtype_numa *)sub_type_hdr; + ret = kfd_parse_subtype_numa(numa, device_list); + break; default: pr_warn("Unknown subtype %d in CRAT\n", sub_type_hdr->type); @@ -1389,6 +1411,7 @@ int kfd_parse_crat_table(void *crat_image, struct list_head *device_list, if (!top_dev) break; top_dev->proximity_domain = proximity_domain++; + top_dev->numa_node = -1; } if (!top_dev) { diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h index ad63ba67b577..f5e00f5df922 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h @@ -144,6 +144,7 @@ struct kfd_perf_properties { struct kfd_topology_device { struct list_head list; uint32_t gpu_id; + uint32_t numa_node; uint32_t proximity_domain; struct kfd_node_properties node_props; struct list_head mem_props; -- 2.54.0