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