Blob Blame History Raw
From 6bd31dbbc477571124ea1ce9e64217c898f05f22 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Mon, 17 Feb 2020 16:23:23 -0500
Subject: [PATCH 08/12] target/i386: enable monitor and ucode revision with
 -cpu max
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

RH-Author: Paolo Bonzini <pbonzini@redhat.com>
Message-id: <20200217162323.2572-7-pbonzini@redhat.com>
Patchwork-id: 93905
O-Subject: [RHEL7.9 qemu-kvm-rhev PATCH 6/6] target/i386: enable monitor and ucode revision with -cpu max
Bugzilla: 1791653
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

These two features were incorrectly tied to host_cpuid_required rather than
cpu->max_features.  As a result, -cpu max was not enabling either MONITOR
features or ucode revision.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit be02cda3afde60d219786e23c3f8edb53aec8e17)

[RHEL7: only affects microcode revision; plus, upstream uses g_autofree]

Signed-off-by: Jon Maloy <jmaloy.redhat.com>
---
 target/i386/cpu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 3579bd53c5..88af0f4348 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -4943,7 +4943,9 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
             g_free(name);
             goto out;
         }
+    }
 
+    if (cpu->max_features && accel_uses_host_cpuid()) {
         if (kvm_enabled() && cpu->ucode_rev == 0) {
             cpu->ucode_rev = kvm_arch_get_supported_msr_feature(kvm_state,
                                                                 MSR_IA32_UCODE_REV);
-- 
2.18.2