From patchwork Wed Feb 13 11:42:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 2135401 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 9C4B0DFE75 for ; Wed, 13 Feb 2013 11:43:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933877Ab3BMLmv (ORCPT ); Wed, 13 Feb 2013 06:42:51 -0500 Received: from mail.skyhub.de ([78.46.96.112]:60986 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754611Ab3BMLmu (ORCPT ); Wed, 13 Feb 2013 06:42:50 -0500 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1360755769; bh=H/loWXFYcqmAIyk9HmlxBwoduu6xoYcIl5RhgVlHsqc=; h=From:To:Cc:Subject:Date:Message-Id; b=KmTNksqlzHZQcgeNPU2uZnPQubQ SmH3h8j580e85U9dj854FTEZBBZmYmptFwfClNBOl7oKNBT99ItbWeOlD0lvWf/ptjY fSGuDXmFyUTtx4WFAkdl6d+Lf9r0ztzkRq60EvDdKq3woiy8UNXQZU7wIqkUWGhMfjk JAEkanGHvw= Received: from mail.skyhub.de ([127.0.0.1]) by localhost (door.skyhub.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id V3hpkj6LTvhE; Wed, 13 Feb 2013 12:42:48 +0100 (CET) Received: from liondog.tnic (p4FF1DE46.dip.t-dialin.net [79.241.222.70]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 81CB61DA107; Wed, 13 Feb 2013 12:42:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alien8.de; s=alien8; t=1360755768; bh=H/loWXFYcqmAIyk9HmlxBwoduu6xoYcIl5RhgVlHsqc=; h=From:To:Cc:Subject:Date:Message-Id; b=Co4QX0EmH3r6VvozHDQ5QK9xhbO J5zXpKes/vpn73sSBWnc5CQ064OfiWTxKrw4na3ARV35mIKa33EanMHtDymkmLv2Kta NTX0G4WFzoGGqJ+CqZOPkYw6yClLd1kb2jsBEEbdTNJJseirtrVKUjIuuBBtUZY3t5i Pl4ZaxqGII= Received: by liondog.tnic (Postfix, from userid 1000) id 39EE710106D; Wed, 13 Feb 2013 12:42:42 +0100 (CET) From: Borislav Petkov To: kvm@vger.kernel.org Cc: LKML , X86 ML , Borislav Petkov , Boris Ostrovsky , Andre Przywara , Marcelo Tosatti , Gleb Natapov Subject: [PATCH] x86, kvm: Add MSR_AMD64_BU_CFG2 to the list of ignored MSRs Date: Wed, 13 Feb 2013 12:42:41 +0100 Message-Id: <1360755761-725-1-git-send-email-bp@alien8.de> X-Mailer: git-send-email 1.8.1.3.535.ga923c31 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Borislav Petkov The "x86, AMD: Enable WC+ memory type on family 10 processors" patch currently in -tip added a workaround for AMD F10h CPUs which #GPs my guest when booted in kvm. This is because it accesses MSR_AMD64_BU_CFG2 which is not currently ignored by kvm. Do that because this MSR is only baremetal-relevant anyway. While at it, move the ignored MSRs at the beginning of kvm_set_msr_common so that we exit then and there. Signed-off-by: Borislav Petkov Cc: Boris Ostrovsky Cc: Andre Przywara Cc: Marcelo Tosatti Cc: Gleb Natapov Acked-by: Gleb Natapov --- arch/x86/kvm/x86.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index c243b81e3c74..37040079cd6b 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1881,6 +1881,14 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) u64 data = msr_info->data; switch (msr) { + case MSR_AMD64_NB_CFG: + case MSR_IA32_UCODE_REV: + case MSR_IA32_UCODE_WRITE: + case MSR_VM_HSAVE_PA: + case MSR_AMD64_PATCH_LOADER: + case MSR_AMD64_BU_CFG2: + break; + case MSR_EFER: return set_efer(vcpu, data); case MSR_K7_HWCR: @@ -1900,8 +1908,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) return 1; } break; - case MSR_AMD64_NB_CFG: - break; case MSR_IA32_DEBUGCTLMSR: if (!data) { /* We support the non-activated case already */ @@ -1914,11 +1920,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) vcpu_unimpl(vcpu, "%s: MSR_IA32_DEBUGCTLMSR 0x%llx, nop\n", __func__, data); break; - case MSR_IA32_UCODE_REV: - case MSR_IA32_UCODE_WRITE: - case MSR_VM_HSAVE_PA: - case MSR_AMD64_PATCH_LOADER: - break; case 0x200 ... 0x2ff: return set_msr_mtrr(vcpu, msr, data); case MSR_IA32_APICBASE: @@ -2253,6 +2254,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) case MSR_K8_INT_PENDING_MSG: case MSR_AMD64_NB_CFG: case MSR_FAM10H_MMIO_CONF_BASE: + case MSR_AMD64_BU_CFG2: data = 0; break; case MSR_P6_PERFCTR0: