From: Alexander Graf <agraf@suse.de>
To: kvm@vger.kernel.org
Cc: avi@redhat.com
Subject: [PATCH 2/2] Add FFXSR support to KVM
Date: Wed, 28 Jan 2009 10:22:13 +0100 [thread overview]
Message-ID: <1233134533-3255-3-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1233134533-3255-2-git-send-email-agraf@suse.de>
AMD K10 CPUs implement the FFXSR feature that gets enabled using
EFER. Let's check if the virtual CPU description includes that
CPUID feature bit and allow enabling it then.
This is required for Windows Server 2008 in Hyper-V mode.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/x86/kvm/svm.c | 3 +++
arch/x86/kvm/x86.c | 11 +++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index db5021b..1c4a018 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -417,6 +417,9 @@ static __init int svm_hardware_setup(void)
if (boot_cpu_has(X86_FEATURE_NX))
kvm_enable_efer_bits(EFER_NX);
+ if (boot_cpu_has(X86_FEATURE_FXSR_OPT))
+ kvm_enable_efer_bits(EFER_FFXSR);
+
if (nested) {
printk(KERN_INFO "kvm: Nested Virtualization enabled\n");
kvm_enable_efer_bits(EFER_SVME);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e96edda..cb3529d 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -490,6 +490,17 @@ static void set_efer(struct kvm_vcpu *vcpu, u64 efer)
return;
}
+ if (efer & EFER_FFXSR) {
+ struct kvm_cpuid_entry2 *feat;
+
+ feat = kvm_find_cpuid_entry(vcpu, 0x80000001, 0);
+ if (!feat || !(feat->edx & bit(X86_FEATURE_FXSR_OPT))) {
+ printk(KERN_DEBUG "set_efer: #GP, enable FFXSR w/o CPUID capability\n");
+ kvm_inject_gp(vcpu, 0);
+ return;
+ }
+ }
+
if (efer & EFER_SVME) {
struct kvm_cpuid_entry2 *feat;
--
1.6.0.2
next prev parent reply other threads:[~2009-01-28 9:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-28 9:22 [PATCH 0/2] Add support for FFXSR Alexander Graf
2009-01-28 9:22 ` [PATCH 1/2] Add EFER descriptions " Alexander Graf
2009-01-28 9:22 ` Alexander Graf [this message]
2009-02-02 14:14 ` [PATCH 2/2] Add FFXSR support to KVM 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=1233134533-3255-3-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=avi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox