Re: [libvirt PATCH 5/6] hostcpu: Implement virHostCPUGetSignature for s390

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/18/20 2:56 PM, Jiri Denemark wrote:
Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
  src/util/virhostcpu.c                            | 16 +++++++++++++++-
  .../linux-s390x-with-frequency.signature         |  1 +
  2 files changed, 16 insertions(+), 1 deletion(-)
  create mode 100644 tests/virhostcpudata/linux-s390x-with-frequency.signature

diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 0ce895cb39..0caf7959ef 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -1430,8 +1430,9 @@ virHostCPUReadSignature(virArch arch,
      g_autofree char *model = NULL;
      g_autofree char *stepping = NULL;
      g_autofree char *revision = NULL;
+    g_autofree char *proc = 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 +1480,19 @@ 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]);
+            }

To catch scenarios of moving from LPAR to nested kvm or the other way around facilties must be added here as well.


+
+            if (vendor && proc) {
+                *signature = g_strdup_printf("%s, %s", vendor, proc);
+                return 0;
+            }
          }
      }
diff --git a/tests/virhostcpudata/linux-s390x-with-frequency.signature b/tests/virhostcpudata/linux-s390x-with-frequency.signature
new file mode 100644
index 0000000000..6369870682
--- /dev/null
+++ b/tests/virhostcpudata/linux-s390x-with-frequency.signature
@@ -0,0 +1 @@
+IBM/S390, version = 00,  identification = 145F07,  machine = 2964
\ No newline at end of file



--
Mit freundlichen Grüßen/Kind regards
   Boris Fiuczynski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux