Skip to content

Commit d3d87e0

Browse files
author
Jiri Denemark
committed
hostcpu: Implement virHostCPUGetSignature for s390
Signed-off-by: Jiri Denemark <[email protected]> Reviewed-by: Ján Tomko <[email protected]> Reviewed-by: Boris Fiuczynski <[email protected]>
1 parent 2a68cea commit d3d87e0

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Diff for: src/util/virhostcpu.c

+20-1
Original file line numberDiff line numberDiff line change
@@ -1430,8 +1430,10 @@ virHostCPUReadSignature(virArch arch,
14301430
g_autofree char *model = NULL;
14311431
g_autofree char *stepping = NULL;
14321432
g_autofree char *revision = NULL;
1433+
g_autofree char *proc = NULL;
1434+
g_autofree char *facilities = NULL;
14331435

1434-
if (!ARCH_IS_X86(arch) && !ARCH_IS_PPC64(arch))
1436+
if (!ARCH_IS_X86(arch) && !ARCH_IS_PPC64(arch) && !ARCH_IS_S390(arch))
14351437
return 0;
14361438

14371439
while (fgets(line, lineLen, cpuinfo)) {
@@ -1479,6 +1481,23 @@ virHostCPUReadSignature(virArch arch,
14791481
*signature = g_strdup_printf("%s, rev %s", name, revision);
14801482
return 0;
14811483
}
1484+
} else if (ARCH_IS_S390(arch)) {
1485+
if (STREQ(parts[0], "vendor_id")) {
1486+
if (!vendor)
1487+
vendor = g_steal_pointer(&parts[1]);
1488+
} else if (STREQ(parts[0], "processor 0")) {
1489+
if (!proc)
1490+
proc = g_steal_pointer(&parts[1]);
1491+
} else if (STREQ(parts[0], "facilities")) {
1492+
if (!facilities)
1493+
facilities = g_steal_pointer(&parts[1]);
1494+
}
1495+
1496+
if (vendor && proc && facilities) {
1497+
*signature = g_strdup_printf("%s, %s, facilities: %s",
1498+
vendor, proc, facilities);
1499+
return 0;
1500+
}
14821501
}
14831502
}
14841503

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
IBM/S390, version = 00, identification = 145F07, machine = 2964, facilities: 0 1 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 30 31 32 33 34 35 36 37 40 41 42 43 44 45 46 47 48 49 50 51 52 53 55 57 64 65 66 67 68 69 70 71 72 73 75 76 77 78 80 128 129 131 132 142 143

0 commit comments

Comments
 (0)