KVM: SVM: Only allow setting of EFER_SVME when CPUID SVM is set
commitd80174745ba3938bc6abb8f95ed670ac0631a182
authorAlexander Graf <agraf@suse.de>
Tue, 25 Nov 2008 19:17:11 +0000 (25 20:17 +0100)
committerAvi Kivity <avi@redhat.com>
Tue, 24 Mar 2009 09:02:48 +0000 (24 11:02 +0200)
tree3f6c3ca1f06f4737dea4857f33e9182d9988d57c
parent236de05553a7ef8f6940de8686ae9bf1272cd2cf
KVM: SVM: Only allow setting of EFER_SVME when CPUID SVM is set

Userspace has to tell the kernel module somehow that nested SVM should be used.
The easiest way that doesn't break anything I could think of is to implement

if (cpuid & svm)
    allow write to efer
else
    deny write to efer

Old userspaces mask the SVM capability bit, so they don't break.
In order to find out that the SVM capability is set, I had to split the
kvm_emulate_cpuid into a finding and an emulating part.

(introduced in v6)

Acked-by: Joerg Roedel <joro@8bytes.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/x86.c