hostcpu: Implement virHostCPUGetSignature for s390

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
This commit is contained in:
Jiri Denemark 2020-04-20 15:48:13 +02:00
parent 2a68ceaa6e
commit d3d87e0cef
2 changed files with 21 additions and 1 deletions

View File

@ -1430,8 +1430,10 @@ virHostCPUReadSignature(virArch arch,
g_autofree char *model = NULL;
g_autofree char *stepping = NULL;
g_autofree char *revision = NULL;
g_autofree char *proc = NULL;
g_autofree char *facilities = NULL;
if (!ARCH_IS_X86(arch) && !ARCH_IS_PPC64(arch))
if (!ARCH_IS_X86(arch) && !ARCH_IS_PPC64(arch) && !ARCH_IS_S390(arch))
return 0;
while (fgets(line, lineLen, cpuinfo)) {
@ -1479,6 +1481,23 @@ virHostCPUReadSignature(virArch arch,
*signature = g_strdup_printf("%s, rev %s", name, revision);
return 0;
}
} else if (ARCH_IS_S390(arch)) {
if (STREQ(parts[0], "vendor_id")) {
if (!vendor)
vendor = g_steal_pointer(&parts[1]);
} else if (STREQ(parts[0], "processor 0")) {
if (!proc)
proc = g_steal_pointer(&parts[1]);
} else if (STREQ(parts[0], "facilities")) {
if (!facilities)
facilities = g_steal_pointer(&parts[1]);
}
if (vendor && proc && facilities) {
*signature = g_strdup_printf("%s, %s, facilities: %s",
vendor, proc, facilities);
return 0;
}
}
}

View File

@ -0,0 +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