public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>
To: Anthony Liguori <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: QEMU/KVM: report paravirt features on cpuid
Date: Wed, 30 Jan 2008 20:37:14 -0200	[thread overview]
Message-ID: <20080130223714.GA26479@dmt> (raw)


And the corresponding QEMU support to report parafeatures on cpuid.

Signed-off-by: Marcelo Tosatti <mtosatti-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Index: kvm-userspace/libkvm/libkvm.c
===================================================================
--- kvm-userspace.orig/libkvm/libkvm.c
+++ kvm-userspace/libkvm/libkvm.c
@@ -210,6 +210,19 @@ int kvm_dirty_pages_log_reset(kvm_contex
 	return kvm_dirty_pages_log_change_all(kvm, 0);
 }
 
+__u32 kvm_get_para_features(kvm_context_t kvm)
+{
+	int r;
+	__u32 para_features;
+#ifdef KVM_CAP_PARA_FEATURES
+	r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_PARA_FEATURES);
+	if (r > 0)
+		r = ioctl(kvm->fd, KVM_GET_PARA_FEATURES, &para_features);
+			if (r == 0)
+				return para_features;
+#endif
+	return 0;
+}
 
 kvm_context_t kvm_init(struct kvm_callbacks *callbacks,
 		       void *opaque)
Index: kvm-userspace/libkvm/libkvm.h
===================================================================
--- kvm-userspace.orig/libkvm/libkvm.h
+++ kvm-userspace/libkvm/libkvm.h
@@ -359,6 +359,8 @@ void kvm_set_cr8(kvm_context_t kvm, int 
 __u64 kvm_get_cr8(kvm_context_t kvm, int vcpu);
 #endif
 
+__u32 kvm_get_para_features(kvm_context_t kvm);
+
 /*!
  * \brief Set a vcpu's signal mask for guest mode
  *
Index: kvm-userspace/qemu/qemu-kvm-x86.c
===================================================================
--- kvm-userspace.orig/qemu/qemu-kvm-x86.c
+++ kvm-userspace/qemu/qemu-kvm-x86.c
@@ -14,6 +14,7 @@ extern int kvm_irqchip;
 #include <libkvm.h>
 #include <pthread.h>
 #include <sys/utsname.h>
+#include <linux/kvm_para.h>
 
 #define MSR_IA32_TSC		0x10
 
@@ -533,7 +534,7 @@ int kvm_arch_qemu_init_env(CPUState *cen
     pv_ent = &cpuid_ent[cpuid_nent++];
     memset(pv_ent, 0, sizeof(*pv_ent));
     pv_ent->function = KVM_CPUID_FEATURES;
-    pv_ent->eax = 0;
+    pv_ent->eax = kvm_get_para_features(kvm_context);
 #endif
 
     copy.regs[R_EAX] = 0;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

                 reply	other threads:[~2008-01-30 22:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20080130223714.GA26479@dmt \
    --to=marcelo-bw31mazkks3ytjvyw6ydsg@public.gmane.org \
    --cc=aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox