Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3258102imu; Mon, 17 Dec 2018 16:35:44 -0800 (PST) X-Google-Smtp-Source: AFSGD/UcvpvAbxycEBTq8o8P9KaArsKHm/p0ZXn3sXNmy+Riya3GzoOdzw7hJPRm3bK8W3O83Y8a X-Received: by 2002:a63:6cc:: with SMTP id 195mr14054405pgg.401.1545093344271; Mon, 17 Dec 2018 16:35:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545093344; cv=none; d=google.com; s=arc-20160816; b=oXdcKODcLVNJ7bFPbB2541NIsqkNKNdlTJa1Th+DaeL6hv9RCIEEO13UvYStZ763VY 1FwqJNLFU+us9TbsGWY/cY8Q/GhcAGZYVXaGOW7AGvLZoFv6D3X65ZDmLJT3cxg6J5bE +HrdFS16d3Bzw7sPTD1O7o9oMRXvS3nxM8Iz83zK25LWl9vkVR/zkdfxhP6eBPPyth2v 0NKq5KvbCIe+K+h9Btkf6XvFFJg01pAY4fMig3NxNpofg8Ju8dL+div+pV0DT+wXBrFa HD3nFsq6RnIvpY5Ktbn/rghfJ8AL5fhkKVKd/d3mjA314eI5zdjxLny/EdOSgd2HZ4MK koKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=HSB5agT90rT+SlNUkaIYIOp9/1yWGjSYeLgqelVx3G4=; b=buLPFafWxjVtPFLQL7gBV++g6Brj7N58SGiS+T27KNW33rT0ivbytHKqw+JlPDMjdP n/v80S3Q2vi5QHtc/SWlVYgNSDMzTIN+Dg9bmoS5IoxIsi4uHESmaMCSVWCkkMSLY4ls YH8qOQCk+irvJpDLchsvyXdLcyPyceNYywLKhUbTMGpxrRgOjMD9zAIF80kjQMlYf2zg 11/n/tI4oNBMM7bdnSmkJD6gEstRzA3fUS2QfghL6arqDlBiHOqibraE8fsA7MUQkPGm /Yb7LNxVp8Es3A5CLaS+H2f+O/P+Af0eyXxypMfYsGL2XVoXVSI4Ssqpx325pGumtySA J6Vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q24si11765085pls.325.2018.12.17.16.35.26; Mon, 17 Dec 2018 16:35:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726341AbeLRAeU (ORCPT + 99 others); Mon, 17 Dec 2018 19:34:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42566 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726271AbeLRAeU (ORCPT ); Mon, 17 Dec 2018 19:34:20 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 07439E86E; Tue, 18 Dec 2018 00:34:20 +0000 (UTC) Received: from localhost (ovpn-116-63.gru2.redhat.com [10.97.116.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82A00608C2; Tue, 18 Dec 2018 00:34:19 +0000 (UTC) From: Eduardo Habkost To: kvm@vger.kernel.org Cc: Brijesh Singh , Paolo Bonzini , Tom Lendacky , Babu Moger , linux-kernel@vger.kernel.org, =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PATCH] kvm: x86: Add AMD's EX_CFG to the list of ignored MSRs Date: Mon, 17 Dec 2018 22:34:18 -0200 Message-Id: <20181218003418.30144-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 18 Dec 2018 00:34:20 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some guests OSes (including Windows 10) write to MSR 0xc001102c on some cases (possibly while trying to apply a CPU errata). Make KVM ignore reads and writes to that MSR, so the guest won't crash. The MSR is documented as "Execution Unit Configuration (EX_CFG)", at AMD's "BIOS and Kernel Developer's Guide (BKDG) for AMD Family 15h Models 00h-0Fh Processors". Signed-off-by: Eduardo Habkost --- arch/x86/include/asm/msr-index.h | 1 + arch/x86/kvm/x86.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index c8f73efb4ece..9e39cc8bd989 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -390,6 +390,7 @@ #define MSR_F15H_NB_PERF_CTR 0xc0010241 #define MSR_F15H_PTSC 0xc0010280 #define MSR_F15H_IC_CFG 0xc0011021 +#define MSR_F15H_EX_CFG 0xc001102c /* Fam 10h MSRs */ #define MSR_FAM10H_MMIO_CONF_BASE 0xc0010058 diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 9cbce3ec84ec..69f822165fe2 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2429,6 +2429,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) case MSR_AMD64_PATCH_LOADER: case MSR_AMD64_BU_CFG2: case MSR_AMD64_DC_CFG: + case MSR_F15H_EX_CFG: break; case MSR_IA32_UCODE_REV: @@ -2724,6 +2725,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) case MSR_AMD64_BU_CFG2: case MSR_IA32_PERF_CTL: case MSR_AMD64_DC_CFG: + case MSR_F15H_EX_CFG: msr_info->data = 0; break; case MSR_F15H_PERF_CTL0 ... MSR_F15H_PERF_CTR5: -- 2.18.0.rc1.1.g3f1ff2140