From a6714dabc7277855aeada5ca842522b32a32e814 Mon Sep 17 00:00:00 2001 From: Dr-Noob Date: Fri, 30 Apr 2021 22:57:15 +0200 Subject: [PATCH 1/2] [0.97] Do not count "L4" cache when computing the max cache level --- src/x86/apic.c | 1 + src/x86/cpuid.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/x86/apic.c b/src/x86/apic.c index 12c4a62..186b236 100644 --- a/src/x86/apic.c +++ b/src/x86/apic.c @@ -232,6 +232,7 @@ bool build_topo_from_apic(uint32_t* apic_pkg, uint32_t* apic_smt, uint32_t** cac if(apic_id[c] > 0) num_caches++; } + printf("[i=%d]: %p\n", i, (void *) topo->cach->cach_arr[i]); topo->cach->cach_arr[i]->num_caches = num_caches; } diff --git a/src/x86/cpuid.c b/src/x86/cpuid.c index e2ba364..cc16cb3 100644 --- a/src/x86/cpuid.c +++ b/src/x86/cpuid.c @@ -581,6 +581,7 @@ struct cache* get_cache_info_general(struct cache* cach, uint32_t level) { } else { printWarn("Found unknown unified cache at level %d (size is %d bytes)", cache_level, cache_total_size); + cach->max_cache_level--; } break; From a426f231c6ed4668557ec0ffae6fd1fce0c7f239 Mon Sep 17 00:00:00 2001 From: Dr-Noob Date: Sun, 31 Oct 2021 20:19:37 +0100 Subject: [PATCH 2/2] [v1.00] Add preeliminary support for Phytium chip --- src/arm/uarch.c | 8 +++++++- src/common/cpu.h | 1 + src/common/global.c | 2 +- src/x86/apic.c | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/arm/uarch.c b/src/arm/uarch.c index 7fda404..44a2464 100644 --- a/src/arm/uarch.c +++ b/src/arm/uarch.c @@ -103,7 +103,9 @@ enum { UARCH_BRAHMA_B15, UARCH_BRAHMA_B53, UARCH_XGENE, // Applied Micro X-Gene. - UARCH_TAISHAN_V110 // HiSilicon TaiShan v110 (Huawei Kunpeng 920 series processors). + UARCH_TAISHAN_V110, // HiSilicon TaiShan v110 (Huawei Kunpeng 920 series processors). + // PHYTIUM + UARCH_XIAOMI, // Not to be confused with Xiaomi Inc }; static const ISA isas_uarch[] = { @@ -156,6 +158,7 @@ static const ISA isas_uarch[] = { [UARCH_ICESTORM] = ISA_ARMv8_4_A, [UARCH_FIRESTORM] = ISA_ARMv8_4_A, [UARCH_PJ4] = ISA_ARMv7_A, + [UARCH_XIAOMI] = ISA_ARMv8_A, }; static char* isas_string[] = { @@ -289,6 +292,9 @@ struct uarch* get_uarch_from_midr(uint32_t midr, struct cpuInfo* cpu) { CHECK_UARCH(arch, cpu, 'S', 0x003, 1, NA, "Exynos M4", UARCH_EXYNOS_M4, CPU_VENDOR_SAMSUNG) // Exynos 9820 CHECK_UARCH(arch, cpu, 'S', 0x004, 1, NA, "Exynos M5", UARCH_EXYNOS_M5, CPU_VENDOR_SAMSUNG) // Exynos 9820 (this one looks wrong at uarch.c ...) + CHECK_UARCH(arch, cpu, 'p', 0x663, 1, NA, "Xiaomi", UARCH_XIAOMI, CPU_VENDOR_PHYTIUM) // From a fellow contributor (https://github.com/Dr-Noob/cpufetch/issues/125) + // Also interesting: https://en.wikipedia.org/wiki/FeiTeng_(processor) + CHECK_UARCH(arch, cpu, 'a', 0x022, NA, NA, "Icestorm", UARCH_ICESTORM, CPU_VENDOR_APPLE) CHECK_UARCH(arch, cpu, 'a', 0x023, NA, NA, "Firestorm", UARCH_FIRESTORM, CPU_VENDOR_APPLE) diff --git a/src/common/cpu.h b/src/common/cpu.h index 8da5998..0a9e3bd 100644 --- a/src/common/cpu.h +++ b/src/common/cpu.h @@ -19,6 +19,7 @@ enum { CPU_VENDOR_HUAWUEI, CPU_VENDOR_SAMSUNG, CPU_VENDOR_MARVELL, + CPU_VENDOR_PHYTIUM, // OTHERS CPU_VENDOR_UNKNOWN, CPU_VENDOR_INVALID diff --git a/src/common/global.c b/src/common/global.c index 47d4752..5c2db91 100644 --- a/src/common/global.c +++ b/src/common/global.c @@ -60,7 +60,7 @@ void printBug(const char *fmt, ...) { #if defined(ARCH_X86) || defined(ARCH_PPC) fprintf(stderr, "Please, create a new issue with this error message, the output of 'cpufetch' and 'cpufetch --debug' on https://github.com/Dr-Noob/cpufetch/issues\n"); #elif ARCH_ARM - fprintf(stderr, "Please, create a new issue with this error message, your smartphone/computer model, the output of 'cpufetch' and 'cpufetch --debug' on https://github.com/Dr-Noob/cpufetch/issues\n"); + fprintf(stderr, "Please, create a new issue with this error message, your smartphone/computer model, the output of 'cpufetch --verbose' and 'cpufetch --debug' on https://github.com/Dr-Noob/cpufetch/issues\n"); #endif } diff --git a/src/x86/apic.c b/src/x86/apic.c index 9a3871f..e777601 100644 --- a/src/x86/apic.c +++ b/src/x86/apic.c @@ -244,6 +244,7 @@ bool build_topo_from_apic(uint32_t* apic_pkg, uint32_t* apic_smt, uint32_t** cac for(uint32_t c=0; c < size; c++) { if(apic_id[c] > 0) num_caches++; } + topo->cach->cach_arr[i]->num_caches = num_caches; }