From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754797AbdC1ISN (ORCPT ); Tue, 28 Mar 2017 04:18:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50684 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754563AbdC1ISL (ORCPT ); Tue, 28 Mar 2017 04:18:11 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 001BE4E4C6 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pbonzini@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 001BE4E4C6 Subject: Re: [PATCH] kvm/svm: Setup MCG_CAP on AMD properly To: Borislav Petkov , KVM References: <20170326215124.27237-1-bp@alien8.de> Cc: LKML , Joerg Roedel , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= From: Paolo Bonzini Message-ID: Date: Tue, 28 Mar 2017 10:17:41 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170326215124.27237-1-bp@alien8.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 28 Mar 2017 08:17:46 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/03/2017 23:51, Borislav Petkov wrote: > From: Borislav Petkov > > MCG_CAP[63:9] bits are reserved on AMD. However, on an AMD guest, this > MSR returns 0x100010a. More specifically, bit 24 is set, which is simply > wrong. That bit is MCG_SER_P and is present only on Intel. Thus, clean > up the reserved bits in order not to confuse guests. > > Signed-off-by: Borislav Petkov > Cc: Joerg Roedel > Cc: Paolo Bonzini > Cc: "Radim Krčmář" > --- > arch/x86/kvm/svm.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > index c02b9af2056a..aba6100ebb8d 100644 > --- a/arch/x86/kvm/svm.c > +++ b/arch/x86/kvm/svm.c > @@ -5251,6 +5251,12 @@ static inline void avic_post_state_restore(struct kvm_vcpu *vcpu) > avic_handle_ldr_update(vcpu); > } > > +static void svm_setup_mce(struct kvm_vcpu *vcpu) > +{ > + /* [63:9] are reserved. */ > + vcpu->arch.mcg_cap &= 0x1ff; > +} > + > static struct kvm_x86_ops svm_x86_ops __ro_after_init = { > .cpu_has_kvm_support = has_svm, > .disabled_by_bios = is_disabled, > @@ -5362,6 +5368,7 @@ static struct kvm_x86_ops svm_x86_ops __ro_after_init = { > .pmu_ops = &amd_pmu_ops, > .deliver_posted_interrupt = svm_deliver_avic_intr, > .update_pi_irte = svm_update_pi_irte, > + .setup_mce = svm_setup_mce, > }; > > static int __init svm_init(void) > Queued for 4.12, thanks. Paolo