aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2015-11-23 05:12:23 -0500
committerIngo Molnar <mingo@kernel.org>2015-11-24 03:15:54 -0500
commitae8b787543d872cf89a7f9ef8aa302f3ef9bcbd7 (patch)
treee385a3324e8154df6679922ab7e53f1e7ffa9407
parent91713faf386be6d7e6556b656436813f8c4ee552 (diff)
x86/cpu/amd, kvm: Satisfy guest kernel reads of IC_CFG MSR
The kernel accesses IC_CFG MSR (0xc0011021) on AMD because it checks whether the way access filter is enabled on some F15h models, and, if so, disables it. kvm doesn't handle that MSR access and complains about it, which can get really noisy in dmesg when one starts kvm guests all the time for testing. And it is useless anyway - guest kernel shouldn't be doing such changes anyway so tell it that that filter is disabled. Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1448273546-2567-4-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/include/asm/msr-index.h1
-rw-r--r--arch/x86/kernel/cpu/amd.c4
-rw-r--r--arch/x86/kvm/svm.c17
3 files changed, 20 insertions, 2 deletions
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index 690b4027e17c..b05402ef3b84 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -321,6 +321,7 @@
321#define MSR_F15H_PERF_CTR 0xc0010201 321#define MSR_F15H_PERF_CTR 0xc0010201
322#define MSR_F15H_NB_PERF_CTL 0xc0010240 322#define MSR_F15H_NB_PERF_CTL 0xc0010240
323#define MSR_F15H_NB_PERF_CTR 0xc0010241 323#define MSR_F15H_NB_PERF_CTR 0xc0010241
324#define MSR_F15H_IC_CFG 0xc0011021
324 325
325/* Fam 10h MSRs */ 326/* Fam 10h MSRs */
326#define MSR_FAM10H_MMIO_CONF_BASE 0xc0010058 327#define MSR_FAM10H_MMIO_CONF_BASE 0xc0010058
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index a8816b325162..e229640c19ab 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -678,9 +678,9 @@ static void init_amd_bd(struct cpuinfo_x86 *c)
678 * Disable it on the affected CPUs. 678 * Disable it on the affected CPUs.
679 */ 679 */
680 if ((c->x86_model >= 0x02) && (c->x86_model < 0x20)) { 680 if ((c->x86_model >= 0x02) && (c->x86_model < 0x20)) {
681 if (!rdmsrl_safe(0xc0011021, &value) && !(value & 0x1E)) { 681 if (!rdmsrl_safe(MSR_F15H_IC_CFG, &value) && !(value & 0x1E)) {
682 value |= 0x1E; 682 value |= 0x1E;
683 wrmsrl_safe(0xc0011021, value); 683 wrmsrl_safe(MSR_F15H_IC_CFG, value);
684 } 684 }
685 } 685 }
686} 686}
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 83a1c643f9a5..58b64c17c4a8 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -3053,6 +3053,23 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
3053 case MSR_IA32_UCODE_REV: 3053 case MSR_IA32_UCODE_REV:
3054 msr_info->data = 0x01000065; 3054 msr_info->data = 0x01000065;
3055 break; 3055 break;
3056 case MSR_F15H_IC_CFG: {
3057
3058 int family, model;
3059
3060 family = guest_cpuid_family(vcpu);
3061 model = guest_cpuid_model(vcpu);
3062
3063 if (family < 0 || model < 0)
3064 return kvm_get_msr_common(vcpu, msr_info);
3065
3066 msr_info->data = 0;
3067
3068 if (family == 0x15 &&
3069 (model >= 0x2 && model < 0x20))
3070 msr_info->data = 0x1E;
3071 }
3072 break;
3056 default: 3073 default:
3057 return kvm_get_msr_common(vcpu, msr_info); 3074 return kvm_get_msr_common(vcpu, msr_info);
3058 } 3075 }