public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* QEMU/KVM: report paravirt features on cpuid
@ 2008-01-30 22:37 Marcelo Tosatti
  0 siblings, 0 replies; only message in thread
From: Marcelo Tosatti @ 2008-01-30 22:37 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: kvm-devel


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/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-01-30 22:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-30 22:37 QEMU/KVM: report paravirt features on cpuid Marcelo Tosatti

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