All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Lalancette <clalance@redhat.com>
To: kvm@vger.kernel.org
Subject: [PATCH] [REPOST]: Fake emulate Intel perfctr MSRs
Date: Thu, 19 Jun 2008 09:14:58 +0200	[thread overview]
Message-ID: <485A0772.1050606@redhat.com> (raw)

[-- 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) {

             reply	other threads:[~2008-06-19  7:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-19  7:14 Chris Lalancette [this message]
2008-06-19 11:37 ` [PATCH] [REPOST]: Fake emulate Intel perfctr MSRs Yang, Sheng
2008-06-20  7:39   ` Chris Lalancette
  -- strict thread matches above, loose matches on Subject: below --
2008-06-20  7:51 [PATCH][REPOST]: " Chris Lalancette
2008-06-29  9:24 ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=485A0772.1050606@redhat.com \
    --to=clalance@redhat.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.