|
From: GitLab M. <git...@ke...> - 2025-10-22 03:10:38
|
amdgpu/amdgpu_asic_id.c | 43 ++++++++++++++++++++++++++++++-------------
1 file changed, 30 insertions(+), 13 deletions(-)
New commits:
commit 871e326ac799ae28ee4d98da9025028050c085cd
Author: Mario Limonciello <mar...@am...>
Date: Thu Oct 16 10:53:01 2025 -0500
amdgpu: Only read /proc/cpuinfo as a fallback
Some older Vega APUs don't provide a very useful string. If we have
a string in amdgpu.ids use that, but fallback to /proc/cpuinfo.
Reviewed-by: Alex Deucher <ale...@am...>
Signed-off-by: Mario Limonciello <mar...@am...>
diff --git a/amdgpu/amdgpu_asic_id.c b/amdgpu/amdgpu_asic_id.c
index 2eeca0ec..2e52666c 100644
--- a/amdgpu/amdgpu_asic_id.c
+++ b/amdgpu/amdgpu_asic_id.c
@@ -169,17 +169,11 @@ void amdgpu_parse_asic_ids(struct amdgpu_device *dev)
int line_num = 1;
int r = 0;
- if (dev->info.ids_flags & AMDGPU_IDS_FLAGS_FUSION) {
- amdgpu_parse_proc_cpuinfo(dev);
- if (dev->marketing_name != NULL)
- return;
- }
-
fp = fopen(AMDGPU_ASIC_ID_TABLE, "r");
if (!fp) {
fprintf(stderr, "%s: %s\n", AMDGPU_ASIC_ID_TABLE,
strerror(errno));
- return;
+ goto get_cpu;
}
/* 1st valid line is file version */
@@ -220,4 +214,10 @@ void amdgpu_parse_asic_ids(struct amdgpu_device *dev)
free(line);
fclose(fp);
+
+get_cpu:
+ if (dev->info.ids_flags & AMDGPU_IDS_FLAGS_FUSION &&
+ dev->marketing_name == NULL) {
+ amdgpu_parse_proc_cpuinfo(dev);
+ }
}
commit 90656fc8e4150fc175ddadb788912674b2c4a705
Author: Mario Limonciello (AMD) <su...@ke...>
Date: Thu Oct 16 10:01:42 2025 -0500
amdgpu: Slice and dice the string for APUs
The string will generally have a CPU and GPU component, so if both
are found split it up. Make sure that it starts with AMD to be
consistent.
Reviewed-by: Alex Deucher <ale...@am...>
Signed-off-by: Mario Limonciello (AMD) <su...@ke...>
diff --git a/amdgpu/amdgpu_asic_id.c b/amdgpu/amdgpu_asic_id.c
index 7bdb2b67..2eeca0ec 100644
--- a/amdgpu/amdgpu_asic_id.c
+++ b/amdgpu/amdgpu_asic_id.c
@@ -107,6 +107,7 @@ out:
static void amdgpu_parse_proc_cpuinfo(struct amdgpu_device *dev)
{
const char *search_key = "model name";
+ const char *radeon_key = "Radeon";
char *line = NULL;
size_t len = 0;
FILE *fp;
@@ -124,18 +125,34 @@ static void amdgpu_parse_proc_cpuinfo(struct amdgpu_device *dev)
if (strncmp(line, search_key, strlen(search_key)))
continue;
- /* get content after colon and strip whitespace */
- value = strtok_r(line, ":", &saveptr);
- value = strtok_r(NULL, ":", &saveptr);
- if (value == NULL)
- continue;
+ /* check for parts that have both CPU and GPU information */
+ value = strstr(line, radeon_key);
+
+ /* get content after the first colon */
+ if (value == NULL) {
+ value = strstr(line, ":");
+ if (value == NULL)
+ continue;
+ value++;
+ }
+
+ /* strip whitespace */
while (*value == ' ' || *value == '\t')
value++;
saveptr = strchr(value, '\n');
if (saveptr)
*saveptr = '\0';
- dev->marketing_name = strdup(value);
+ /* Add AMD to the new string if it's missing from slicing/dicing */
+ if (strncmp(value, "AMD", 3) != 0) {
+ char *tmp = malloc(strlen(value) + 5);
+
+ if (!tmp)
+ break;
+ sprintf(tmp, "AMD %s", value);
+ dev->marketing_name = tmp;
+ } else
+ dev->marketing_name = strdup(value);
break;
}
|