diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-06-11 14:04:36 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-06-11 14:04:36 +0100 |
commit | e96784240ea85c4c6aba1cbd5d8e8c3c815c74fd (patch) | |
tree | 3c60e52c94fa4f7a9e902f3d216db4c70a99ade2 | |
parent | 577ca3dbb04acc6fcf33607b78b50d3402c28574 (diff) | |
download | xen-e96784240ea85c4c6aba1cbd5d8e8c3c815c74fd.tar.gz xen-e96784240ea85c4c6aba1cbd5d8e8c3c815c74fd.tar.bz2 xen-e96784240ea85c4c6aba1cbd5d8e8c3c815c74fd.zip |
svm: use msr safe for erratum 383
Make erratum 383 use msr safe variants to work on top of KVM.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
xen-unstable changeset: 21602:f086edac7f92
xen-unstable date: Fri Jun 11 13:57:52 2010 +0100
-rw-r--r-- | xen/arch/x86/hvm/svm/svm.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 8d008a6d70..d7576bc8a8 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -823,16 +823,20 @@ static int svm_cpu_prepare(unsigned int cpu) static void svm_init_erratum_383(struct cpuinfo_x86 *c) { - uint64_t msr_content; + uint32_t l, h; /* only family 10h is affected */ if ( c->x86 != 0x10 ) return; - rdmsrl(MSR_AMD64_DC_CFG, msr_content); - wrmsrl(MSR_AMD64_DC_CFG, msr_content | (1ULL << 47)); - - amd_erratum383_found = 1; + /* use safe methods to be compatible with nested virtualization */ + if (rdmsr_safe(MSR_AMD64_DC_CFG, l, h) == 0 && + wrmsr_safe(MSR_AMD64_DC_CFG, l, h | (1UL << 15)) == 0) + { + amd_erratum383_found = 1; + } else { + printk("Failed to enable erratum 383\n"); + } } static int svm_cpu_up(struct cpuinfo_x86 *c) |