File libvirt-cpu_x86-Copy-CPU-signature-from-ancestor.patch of Package libvirt.11695

From cb4adcbde18303dd51d003a219aeb66975355402 Mon Sep 17 00:00:00 2001
Message-Id: <cb4adcbde18303dd51d003a219aeb66975355402@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Fri, 5 Jan 2018 17:43:03 +0100
Subject: [PATCH] cpu_x86: Copy CPU signature from ancestor

When specifying a new CPU model in cpu_map.xml as an extension to an
existing model, we forgot to copy the signature (family + model) from
the original CPU model.

We don't use this way of specifying CPU models, but it's still supported
and it becomes useful when someone wants to quickly hack up a CPU model
for testing or when creating additional variants of existing models to
help with fixing some spectral issues.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit b427cf4831d0ea7aac9dd1a3aa7682478356a483)

https://bugzilla.redhat.com/show_bug.cgi?id=1533415

The new -IBRS and -IBPB CPU models were defined via inheritance from
their original models in RHEL. Thus when the host CPU matches the
signature of the original model from cpu_map.xml, libvirt will detect
the host CPU as the original model + the new feature rather than
reporting it as the -IBRS/-IBPB variant.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/cpu/cpu_x86.c | 1 +
 1 file changed, 1 insertion(+)

Index: libvirt-1.2.5/src/cpu/cpu_x86.c
===================================================================
--- libvirt-1.2.5.orig/src/cpu/cpu_x86.c
+++ libvirt-1.2.5/src/cpu/cpu_x86.c
@@ -1075,6 +1075,7 @@ x86ModelLoad(xmlXPathContextPtr ctxt,
         VIR_FREE(name);
 
         model->vendor = ancestor->vendor;
+        model->signature = ancestor->signature;
         virCPUx86DataFree(model->data);
         if (!(model->data = x86DataCopy(ancestor->data)))
             goto error;