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