All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zachary Amsden <zamsden@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>, kvm <kvm@vger.kernel.org>
Subject: [PATCH]  Work around xstate_size export for kvm-kmod
Date: Thu, 19 Aug 2010 21:25:37 -1000	[thread overview]
Message-ID: <4C6E2DF1.5080301@redhat.com> (raw)

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

Here's another fix I discovered porting work to upstream today.

Cheers,

Zach

[-- Attachment #2: 0001-Give-KVM-module-xstate_size.patch --]
[-- Type: text/plain, Size: 1783 bytes --]

>From 84b75d80718e4e4af2d153250a77a5f50cffc152 Mon Sep 17 00:00:00 2001
From: Zachary Amsden <zamsden@redhat.com>
Date: Thu, 19 Aug 2010 21:20:50 -1000
Subject: [PATCH] Give KVM module xstate_size

This was just recently exported, but now KVM depends on it.

Signed-off-by: Zachary Amsden <zamsden@redhat.com>
---
 sync                         |    1 +
 x86/external-module-compat.h |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/sync b/sync
index c124fc7..b644f4d 100755
--- a/sync
+++ b/sync
@@ -45,6 +45,7 @@ def hack_content(data):
         'set_desc_base set_desc_limit pvclock_vcpu_time_info tboot_enabled '
         'i387_fxsave_struct native_write_msr_safe xsave_struct '
         'fpu_alloc fpu_free fpu_restore_checking fpu_save_init fpu_finit '
+	'xstate_size '
         )
     kvm_init = kvm_exit = False
     mce = False
diff --git a/x86/external-module-compat.h b/x86/external-module-compat.h
index ead5b5a..464d6a8 100644
--- a/x86/external-module-compat.h
+++ b/x86/external-module-compat.h
@@ -883,6 +883,18 @@ union kvm_thread_xstate {
 	struct kvm_xsave_struct xsave;
 };
 
+static inline unsigned int kvm_xstate_size_cache(void)
+{
+	static unsigned int xstate_size = 0;
+	if (!xstate_size) {
+		unsigned int eax, ebx, ecx, edx;
+		cpuid_count(0xd, 0, &eax, &ebx, &ecx, &edx);
+        	xstate_size = ebx;
+	}
+	return xstate_size;
+}
+#define kvm_xstate_size kvm_xstate_size_cache()
+
 #else /* >= 2.6.35 */
 
 #define kvm_i387_fxsave_struct	i387_fxsave_struct
@@ -956,6 +968,8 @@ static inline void kvm_fpu_save_init(struct kvm_compat_fpu *fpu)
 #define kvm_fpu_save_init		fpu_save_init
 #define kvm_fpu_finit			fpu_finit
 
+#define kvm_xstate_size			xstate_size
+
 #endif /* >= 2.6.36 */
 
 #ifndef XSTATE_FP
-- 
1.7.1


             reply	other threads:[~2010-08-20  7:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20  7:25 Zachary Amsden [this message]
2010-08-20  8:36 ` [PATCH] Work around xstate_size export for kvm-kmod Jan Kiszka

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=4C6E2DF1.5080301@redhat.com \
    --to=zamsden@redhat.com \
    --cc=jan.kiszka@web.de \
    --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.