]> git.ipfire.org Git - thirdparty/qemu.git/commit
x86: kvm: Add MTRR support for kvm_get|put_msrs()
authorAlex Williamson <alex.williamson@redhat.com>
Thu, 14 Aug 2014 21:39:33 +0000 (15:39 -0600)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 10 Sep 2014 14:30:57 +0000 (09:30 -0500)
commitba8576f338554004138a5a90d6563707336eb548
tree5d7b2b284e7485c22f83cbad999968971f2003d6
parent07f8c97f84a4cf4ac84f4374682194156525ede9
x86: kvm: Add MTRR support for kvm_get|put_msrs()

The MTRR state in KVM currently runs completely independent of the
QEMU state in CPUX86State.mtrr_*.  This means that on migration, the
target loses MTRR state from the source.  Generally that's ok though
because KVM ignores it and maps everything as write-back anyway.  The
exception to this rule is when we have an assigned device and an IOMMU
that doesn't promote NoSnoop transactions from that device to be cache
coherent.  In that case KVM trusts the guest mapping of memory as
configured in the MTRR.

This patch updates kvm_get|put_msrs() so that we retrieve the actual
vCPU MTRR settings and therefore keep CPUX86State synchronized for
migration.  kvm_put_msrs() is also used on vCPU reset and therefore
allows future modificaitons of MTRR state at reset to be realized.

Note that the entries array used by both functions was already
slightly undersized for holding every possible MSR, so this patch
increases it beyond the 28 new entries necessary for MTRR state.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit d1ae67f626c5ed5729e1d8212834291b409d26df)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
target-i386/cpu.h
target-i386/kvm.c