ddf19c
From 3d16f05359e6277da1f970f71aa9f76337d655dc Mon Sep 17 00:00:00 2001
ddf19c
From: Paolo Bonzini <pbonzini@redhat.com>
ddf19c
Date: Mon, 17 Feb 2020 16:23:14 +0000
ddf19c
Subject: [PATCH 4/9] target/i386: fix TCG UCODE_REV access
ddf19c
MIME-Version: 1.0
ddf19c
Content-Type: text/plain; charset=UTF-8
ddf19c
Content-Transfer-Encoding: 8bit
ddf19c
ddf19c
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
ddf19c
Message-id: <20200217162316.2464-5-pbonzini@redhat.com>
ddf19c
Patchwork-id: 93904
ddf19c
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 4/6] target/i386: fix TCG UCODE_REV access
ddf19c
Bugzilla: 1791648
ddf19c
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ddf19c
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
ddf19c
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
ddf19c
ddf19c
This was a very interesting semantic conflict that caused git to move
ddf19c
the MSR_IA32_UCODE_REV read to helper_wrmsr.  Not a big deal, but
ddf19c
still should be fixed...
ddf19c
ddf19c
Fixes: 4e45aff398 ("target/i386: add a ucode-rev property", 2020-01-24)
ddf19c
Message-id: <20200206171022.9289-1-pbonzini@redhat.com>
ddf19c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ddf19c
(cherry picked from commit 9028c75c9d08be303ccc425bfe3d3b23d8f4cac7)
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 target/i386/misc_helper.c | 8 ++++----
ddf19c
 1 file changed, 4 insertions(+), 4 deletions(-)
ddf19c
ddf19c
diff --git a/target/i386/misc_helper.c b/target/i386/misc_helper.c
ddf19c
index aed16fe..7d61221 100644
ddf19c
--- a/target/i386/misc_helper.c
ddf19c
+++ b/target/i386/misc_helper.c
ddf19c
@@ -229,7 +229,6 @@ void helper_rdmsr(CPUX86State *env)
ddf19c
 #else
ddf19c
 void helper_wrmsr(CPUX86State *env)
ddf19c
 {
ddf19c
-    X86CPU *x86_cpu = env_archcpu(env);
ddf19c
     uint64_t val;
ddf19c
 
ddf19c
     cpu_svm_check_intercept_param(env, SVM_EXIT_MSR, 1, GETPC());
ddf19c
@@ -372,9 +371,6 @@ void helper_wrmsr(CPUX86State *env)
ddf19c
         env->msr_bndcfgs = val;
ddf19c
         cpu_sync_bndcs_hflags(env);
ddf19c
         break;
ddf19c
-     case MSR_IA32_UCODE_REV:
ddf19c
-        val = x86_cpu->ucode_rev;
ddf19c
-        break;
ddf19c
     default:
ddf19c
         if ((uint32_t)env->regs[R_ECX] >= MSR_MC0_CTL
ddf19c
             && (uint32_t)env->regs[R_ECX] < MSR_MC0_CTL +
ddf19c
@@ -393,6 +389,7 @@ void helper_wrmsr(CPUX86State *env)
ddf19c
 
ddf19c
 void helper_rdmsr(CPUX86State *env)
ddf19c
 {
ddf19c
+    X86CPU *x86_cpu = env_archcpu(env);
ddf19c
     uint64_t val;
ddf19c
 
ddf19c
     cpu_svm_check_intercept_param(env, SVM_EXIT_MSR, 0, GETPC());
ddf19c
@@ -526,6 +523,9 @@ void helper_rdmsr(CPUX86State *env)
ddf19c
     case MSR_IA32_BNDCFGS:
ddf19c
         val = env->msr_bndcfgs;
ddf19c
         break;
ddf19c
+     case MSR_IA32_UCODE_REV:
ddf19c
+        val = x86_cpu->ucode_rev;
ddf19c
+        break;
ddf19c
     default:
ddf19c
         if ((uint32_t)env->regs[R_ECX] >= MSR_MC0_CTL
ddf19c
             && (uint32_t)env->regs[R_ECX] < MSR_MC0_CTL +
ddf19c
-- 
ddf19c
1.8.3.1
ddf19c