KVM: Remove arch specific components from the general code
struct kvm_vcpu has vmx-specific members; remove them to a private structure. Signed-off-by: Gregory Haskins <ghaskins@novell.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Avi Kivity <avi@qumranet.com>
This commit is contained in:

committed by
Avi Kivity

parent
c820c2aa27
commit
a2fa3e9f52
@@ -367,7 +367,7 @@ static void free_pio_guest_pages(struct kvm_vcpu *vcpu)
|
||||
|
||||
static void kvm_unload_vcpu_mmu(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
if (!vcpu->vmcs)
|
||||
if (!vcpu->valid)
|
||||
return;
|
||||
|
||||
vcpu_load(vcpu);
|
||||
@@ -377,7 +377,7 @@ static void kvm_unload_vcpu_mmu(struct kvm_vcpu *vcpu)
|
||||
|
||||
static void kvm_free_vcpu(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
if (!vcpu->vmcs)
|
||||
if (!vcpu->valid)
|
||||
return;
|
||||
|
||||
vcpu_load(vcpu);
|
||||
@@ -1645,24 +1645,6 @@ void kvm_resched(struct kvm_vcpu *vcpu)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kvm_resched);
|
||||
|
||||
void load_msrs(struct vmx_msr_entry *e, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; ++i)
|
||||
wrmsrl(e[i].index, e[i].data);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(load_msrs);
|
||||
|
||||
void save_msrs(struct vmx_msr_entry *e, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; ++i)
|
||||
rdmsrl(e[i].index, e[i].data);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(save_msrs);
|
||||
|
||||
void kvm_emulate_cpuid(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
int i;
|
||||
@@ -2401,7 +2383,7 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, int n)
|
||||
|
||||
mutex_lock(&vcpu->mutex);
|
||||
|
||||
if (vcpu->vmcs) {
|
||||
if (vcpu->valid) {
|
||||
mutex_unlock(&vcpu->mutex);
|
||||
return -EEXIST;
|
||||
}
|
||||
@@ -2449,6 +2431,8 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, int n)
|
||||
kvm->nvcpus = n + 1;
|
||||
spin_unlock(&kvm_lock);
|
||||
|
||||
vcpu->valid = 1;
|
||||
|
||||
return r;
|
||||
|
||||
out_free_vcpus:
|
||||
|
Reference in New Issue
Block a user