public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: Fake emulate Intel perfctr MSRs
@ 2008-05-29  9:44 Chris Lalancette
  2008-06-10 13:27 ` Chris Lalancette
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Lalancette @ 2008-05-29  9:44 UTC (permalink / raw)
  To: kvm

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

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 <clalance@redhat.com>

[-- Attachment #2: kvm-intel-wrmsr-emulate.patch --]
[-- Type: text/x-patch, Size: 905 bytes --]

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 <asm/io.h>
 #include <asm/desc.h>
+#include <asm/intel_arch_perfmon.h>
 
 #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) {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH]: Fake emulate Intel perfctr MSRs
  2008-05-29  9:44 [PATCH]: Fake emulate Intel perfctr MSRs Chris Lalancette
@ 2008-06-10 13:27 ` Chris Lalancette
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Lalancette @ 2008-06-10 13:27 UTC (permalink / raw)
  To: kvm

Chris Lalancette wrote:
> 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 <clalance@redhat.com>
> 

Avi,
     You were probably traveling while I sent this, so ping?

Chris Lalancette

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-10 13:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-29  9:44 [PATCH]: Fake emulate Intel perfctr MSRs Chris Lalancette
2008-06-10 13:27 ` Chris Lalancette

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox