[v1.05][X86] Try fetching topology from udev even when cpuid is not able to do so

This commit is contained in:
Dr-Noob
2024-07-12 08:32:27 +01:00
parent 8fca4cb250
commit 21dddc63ff

View File

@@ -706,13 +706,19 @@ struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach, int
switch(cpu->cpu_vendor) { switch(cpu->cpu_vendor) {
case CPU_VENDOR_INTEL: case CPU_VENDOR_INTEL:
bool toporet = false;
if (cpu->maxLevels >= 0x00000004) { if (cpu->maxLevels >= 0x00000004) {
bool toporet = get_topology_from_apic(cpu, topo); toporet = get_topology_from_apic(cpu, topo);
}
else {
printWarn("Can't read topology information from cpuid (needed level is 0x%.8X, max is 0x%.8X)", 0x00000004, cpu->maxLevels);
}
if(!toporet) { if(!toporet) {
#ifdef __linux__ #ifdef __linux__
printWarn("Failed to retrieve topology from APIC, using udev...\n"); printWarn("Failed to retrieve topology from APIC, using udev...\n");
get_topology_from_udev(topo); get_topology_from_udev(topo);
#else #else
if (cpu->maxLevels >= 0x00000004)
printErr("Failed to retrieve topology from APIC, assumming default values...\n"); printErr("Failed to retrieve topology from APIC, assumming default values...\n");
topo->logical_cores = UNKNOWN_DATA; topo->logical_cores = UNKNOWN_DATA;
topo->physical_cores = UNKNOWN_DATA; topo->physical_cores = UNKNOWN_DATA;
@@ -720,14 +726,6 @@ struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach, int
topo->smt_supported = 1; topo->smt_supported = 1;
#endif #endif
} }
}
else {
printWarn("Can't read topology information from cpuid (needed level is 0x%.8X, max is 0x%.8X)", 0x00000001, cpu->maxLevels);
topo->physical_cores = UNKNOWN_DATA;
topo->logical_cores = UNKNOWN_DATA;
topo->smt_available = 1;
topo->smt_supported = 1;
}
break; break;
case CPU_VENDOR_AMD: case CPU_VENDOR_AMD:
case CPU_VENDOR_HYGON: case CPU_VENDOR_HYGON: