diff options
author | Jes Sorensen <Jes.Sorensen@redhat.com> | 2010-09-01 05:42:04 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-10-24 04:51:55 -0400 |
commit | 84e0cefa8ddd5d5018d3b582e1e90585ed551757 (patch) | |
tree | 4faa04c04b8fc555584cc806acd7e31c4d879d42 | |
parent | 9ed049c3b6230b68985da31f8243d4bec95e0b3a (diff) |
KVM: Fix guest kernel crash on MSR_K7_CLK_CTL
MSR_K7_CLK_CTL is a no longer documented MSR, which is only relevant
on said old AMD CPU models. This change returns the expected value,
which the Linux kernel is expecting to avoid writing back the MSR,
plus it ignores all writes to the MSR.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/x86/kvm/x86.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 1c972382e5d4..f47db2588a41 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1449,6 +1449,16 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) | |||
1449 | pr_unimpl(vcpu, "unimplemented perfctr wrmsr: " | 1449 | pr_unimpl(vcpu, "unimplemented perfctr wrmsr: " |
1450 | "0x%x data 0x%llx\n", msr, data); | 1450 | "0x%x data 0x%llx\n", msr, data); |
1451 | break; | 1451 | break; |
1452 | case MSR_K7_CLK_CTL: | ||
1453 | /* | ||
1454 | * Ignore all writes to this no longer documented MSR. | ||
1455 | * Writes are only relevant for old K7 processors, | ||
1456 | * all pre-dating SVM, but a recommended workaround from | ||
1457 | * AMD for these chips. It is possible to speicify the | ||
1458 | * affected processor models on the command line, hence | ||
1459 | * the need to ignore the workaround. | ||
1460 | */ | ||
1461 | break; | ||
1452 | case HV_X64_MSR_GUEST_OS_ID ... HV_X64_MSR_SINT15: | 1462 | case HV_X64_MSR_GUEST_OS_ID ... HV_X64_MSR_SINT15: |
1453 | if (kvm_hv_msr_partition_wide(msr)) { | 1463 | if (kvm_hv_msr_partition_wide(msr)) { |
1454 | int r; | 1464 | int r; |
@@ -1674,6 +1684,18 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) | |||
1674 | case MSR_IA32_MCG_STATUS: | 1684 | case MSR_IA32_MCG_STATUS: |
1675 | case MSR_IA32_MC0_CTL ... MSR_IA32_MC0_CTL + 4 * KVM_MAX_MCE_BANKS - 1: | 1685 | case MSR_IA32_MC0_CTL ... MSR_IA32_MC0_CTL + 4 * KVM_MAX_MCE_BANKS - 1: |
1676 | return get_msr_mce(vcpu, msr, pdata); | 1686 | return get_msr_mce(vcpu, msr, pdata); |
1687 | case MSR_K7_CLK_CTL: | ||
1688 | /* | ||
1689 | * Provide expected ramp-up count for K7. All other | ||
1690 | * are set to zero, indicating minimum divisors for | ||
1691 | * every field. | ||
1692 | * | ||
1693 | * This prevents guest kernels on AMD host with CPU | ||
1694 | * type 6, model 8 and higher from exploding due to | ||
1695 | * the rdmsr failing. | ||
1696 | */ | ||
1697 | data = 0x20000000; | ||
1698 | break; | ||
1677 | case HV_X64_MSR_GUEST_OS_ID ... HV_X64_MSR_SINT15: | 1699 | case HV_X64_MSR_GUEST_OS_ID ... HV_X64_MSR_SINT15: |
1678 | if (kvm_hv_msr_partition_wide(msr)) { | 1700 | if (kvm_hv_msr_partition_wide(msr)) { |
1679 | int r; | 1701 | int r; |