* [PATCH 0/2] Add support for FFXSR
@ 2009-01-28 9:22 Alexander Graf
2009-01-28 9:22 ` [PATCH 1/2] Add EFER descriptions " Alexander Graf
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2009-01-28 9:22 UTC (permalink / raw)
To: kvm; +Cc: avi
AMD k10 includes support for the FFXSR feature, which leaves out
XMM registers on FXSAVE/FXSAVE when the EFER_FFXSR bit is set in
EFER.
This patchset enables support for the FFXSR feature in KVM, allowing
the VM to set the bit in EFER when the physical CPU and the guest's
CPUID allow it.
Alexander Graf (2):
Add EFER descriptions for FFXSR
Add FFXSR support to KVM
arch/x86/include/asm/msr-index.h | 2 ++
arch/x86/kvm/svm.c | 3 +++
arch/x86/kvm/x86.c | 11 +++++++++++
3 files changed, 16 insertions(+), 0 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] Add EFER descriptions for FFXSR
2009-01-28 9:22 [PATCH 0/2] Add support for FFXSR Alexander Graf
@ 2009-01-28 9:22 ` Alexander Graf
2009-01-28 9:22 ` [PATCH 2/2] Add FFXSR support to KVM Alexander Graf
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2009-01-28 9:22 UTC (permalink / raw)
To: kvm; +Cc: avi, Joerg Roedel
AMD k10 includes support for the FFXSR feature, which leaves out
XMM registers on FXSAVE/FXSAVE when the EFER_FFXSR bit is set in
EFER.
The CPUID feature bit exists already, but the EFER bit is missing
currently, so this patch adds it to the list of known EFER bits.
Signed-off-by: Alexander Graf <agraf@suse.de>
CC: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/include/asm/msr-index.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index 1890032..42378af 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -19,12 +19,14 @@
#define _EFER_LMA 10 /* Long mode active (read-only) */
#define _EFER_NX 11 /* No execute enable */
#define _EFER_SVME 12 /* Enable virtualization */
+#define _EFER_FFXSR 14 /* Enable Fast FXSAVE/FXRSTOR */
#define EFER_SCE (1<<_EFER_SCE)
#define EFER_LME (1<<_EFER_LME)
#define EFER_LMA (1<<_EFER_LMA)
#define EFER_NX (1<<_EFER_NX)
#define EFER_SVME (1<<_EFER_SVME)
+#define EFER_FFXSR (1<<_EFER_FFXSR)
/* Intel MSRs. Some also available on other CPUs */
#define MSR_IA32_PERFCTR0 0x000000c1
--
1.6.0.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] Add FFXSR support to KVM
2009-01-28 9:22 ` [PATCH 1/2] Add EFER descriptions " Alexander Graf
@ 2009-01-28 9:22 ` Alexander Graf
2009-02-02 14:14 ` Avi Kivity
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2009-01-28 9:22 UTC (permalink / raw)
To: kvm; +Cc: avi
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] Add FFXSR support to KVM
2009-01-28 9:22 ` [PATCH 2/2] Add FFXSR support to KVM Alexander Graf
@ 2009-02-02 14:14 ` Avi Kivity
0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2009-02-02 14:14 UTC (permalink / raw)
To: Alexander Graf; +Cc: kvm
Alexander Graf wrote:
> 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.
>
>
Need to advertise this in KVM_GET_SUPPORTED_CPUID. Otherwise, looks good.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-02 14:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 2/2] Add FFXSR support to KVM Alexander Graf
2009-02-02 14:14 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox