05bba0
From 9f6b8fe31ea92570c4e43d35abcadafea9576d89 Mon Sep 17 00:00:00 2001
05bba0
From: Alex Williamson <alex.williamson@redhat.com>
05bba0
Date: Fri, 10 Apr 2015 16:45:47 +0200
05bba0
Subject: [PATCH 11/14] x86: Use common variable range MTRR counts
05bba0
05bba0
Message-id: <20150410164547.16166.20530.stgit@gimli.home>
05bba0
Patchwork-id: 64797
05bba0
O-Subject: [RHEL7.2 qemu-kvm PATCH 1/3] x86: Use common variable range MTRR counts
05bba0
Bugzilla: 1210510
05bba0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
05bba0
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
05bba0
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
05bba0
05bba0
Upstream: d8b5c67b05420d966664664ff287af05b884bdd1
05bba0
05bba0
We currently define the number of variable range MTRR registers as 8
05bba0
in the CPUX86State structure and vmstate, but use MSR_MTRRcap_VCNT
05bba0
(also 8) to report to guests the number available.  Change this to
05bba0
use MSR_MTRRcap_VCNT consistently.
05bba0
05bba0
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
05bba0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
05bba0
Cc: qemu-stable@nongnu.org
05bba0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
05bba0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
05bba0
---
05bba0
 target-i386/cpu.h     | 2 +-
05bba0
 target-i386/machine.c | 2 +-
05bba0
 2 files changed, 2 insertions(+), 2 deletions(-)
05bba0
05bba0
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
05bba0
index 207645c..763fbf2 100644
05bba0
--- a/target-i386/cpu.h
05bba0
+++ b/target-i386/cpu.h
05bba0
@@ -886,7 +886,7 @@ typedef struct CPUX86State {
05bba0
     /* MTRRs */
05bba0
     uint64_t mtrr_fixed[11];
05bba0
     uint64_t mtrr_deftype;
05bba0
-    MTRRVar mtrr_var[8];
05bba0
+    MTRRVar mtrr_var[MSR_MTRRcap_VCNT];
05bba0
 
05bba0
     /* For KVM */
05bba0
     uint32_t mp_state;
05bba0
diff --git a/target-i386/machine.c b/target-i386/machine.c
05bba0
index 87fd496..4c1ead4 100644
05bba0
--- a/target-i386/machine.c
05bba0
+++ b/target-i386/machine.c
05bba0
@@ -647,7 +647,7 @@ const VMStateDescription vmstate_x86_cpu = {
05bba0
         /* MTRRs */
05bba0
         VMSTATE_UINT64_ARRAY_V(env.mtrr_fixed, X86CPU, 11, 8),
05bba0
         VMSTATE_UINT64_V(env.mtrr_deftype, X86CPU, 8),
05bba0
-        VMSTATE_MTRR_VARS(env.mtrr_var, X86CPU, 8, 8),
05bba0
+        VMSTATE_MTRR_VARS(env.mtrr_var, X86CPU, MSR_MTRRcap_VCNT, 8),
05bba0
         /* KVM-related states */
05bba0
         VMSTATE_INT32_V(env.interrupt_injected, X86CPU, 9),
05bba0
         VMSTATE_UINT32_V(env.mp_state, X86CPU, 9),
05bba0
-- 
05bba0
1.8.3.1
05bba0