Skip to content

Commit 263d290

Browse files
committed
CPU (Linux): add cpu name detection for s390x
1 parent 292fa06 commit 263d290

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/detection/cpu/cpu_linux.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ static const char* parseCpuInfo(
313313
#elif __riscv__ || __riscv
314314
(cpuIsa->length == 0 && ffParsePropLine(line, "isa :", cpuIsa)) ||
315315
(cpuUarch->length == 0 && ffParsePropLine(line, "uarch :", cpuUarch)) ||
316+
#elif __s390x__
317+
(cpu->name.length == 0 && ffParsePropLine(line, "processor 0:", &cpu->name)) ||
318+
(cpu->vendor.length == 0 && ffParsePropLine(line, "vendor_id :", &cpu->vendor)) ||
319+
(cpuMHz->length == 0 && ffParsePropLine(line, "cpu MHz static :", cpuMHz)) || // This one cannot be detected because of early return
316320
#else
317321
(cpu->name.length == 0 && ffParsePropLine(line, "model name :", &cpu->name)) ||
318322
#endif
@@ -651,6 +655,9 @@ FF_MAYBE_UNUSED static const char* detectCPUOthers(const FFCPUOptions* options,
651655
cpu->packages = getLoongarchPropCount(&cpuinfo, "\npackage\t\t\t:");
652656
cpu->coresPhysical = getLoongarchPropCount(&cpuinfo, "\ncore\t\t\t:");
653657
if (cpu->packages > 1) cpu->coresPhysical *= cpu->packages;
658+
#elif __s390x__
659+
if (ffStrbufSubstrAfterFirstS(&cpu->name, "machine = "))
660+
ffStrbufPrependS(&cpu->name, "Machine ");
654661
#endif
655662
}
656663

0 commit comments

Comments
 (0)