From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Lalancette Subject: [PATCH] [REPOST]: Fake emulate Intel perfctr MSRs Date: Thu, 19 Jun 2008 09:14:58 +0200 Message-ID: <485A0772.1050606@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030707060803080209000808" To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([66.187.233.31]:41011 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751651AbYFSHPa (ORCPT ); Thu, 19 Jun 2008 03:15:30 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m5J7FTn5026467 for ; Thu, 19 Jun 2008 03:15:29 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m5J7FTGN013652 for ; Thu, 19 Jun 2008 03:15:29 -0400 Received: from localhost.localdomain (vpn-14-74.rdu.redhat.com [10.11.14.74]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m5J7FSGx008523 for ; Thu, 19 Jun 2008 03:15:29 -0400 Sender: kvm-owner@vger.kernel.org List-ID: This is a multi-part message in MIME format. --------------030707060803080209000808 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Attached is a patch for fake emulating Intel perfctr MSRs, similar to the recent patch to fake emulate the AMD perfctr MSRs. This is needed for a reason similar for the previous patch; older linux guests (in this case, 2.6.9) can attempt to access the MSR's without a fixup section, and injecting a GPF kills the guest. Tested by me on RHEL-4 i386 and x86_64 guests, as well as F-9 guests. Signed-off-by: Chris Lalancette --------------030707060803080209000808 Content-Type: text/x-patch; name="kvm-intel-wrmsr-emulate.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="kvm-intel-wrmsr-emulate.patch" diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index aaa99ed..f28789e 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -29,6 +29,7 @@ #include #include +#include #define __ex(x) __kvm_handle_fault_on_reboot(x) @@ -916,6 +917,18 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) case MSR_IA32_TIME_STAMP_COUNTER: guest_write_tsc(data); break; + case MSR_ARCH_PERFMON_EVENTSEL0: + case MSR_ARCH_PERFMON_EVENTSEL1: + case MSR_ARCH_PERFMON_PERFCTR0: + case MSR_ARCH_PERFMON_PERFCTR1: + /* + * Just discard all writes to the performance counters; this + * should keep both older linux and windows 64-bit guests + * happy + */ + pr_unimpl(vcpu, "unimplemented perfctr wrmsr: 0x%x data 0x%llx\n", msr_index, data); + + break; default: msr = find_msr_entry(vmx, msr_index); if (msr) { --------------030707060803080209000808--