Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68361
b: refs/heads/master
c: a2fa3e9
h: refs/heads/master
i:
  68359: 97b3eef
v: v3
  • Loading branch information
Gregory Haskins authored and Avi Kivity committed Oct 13, 2007
1 parent dd428a6 commit 1988024
Show file tree
Hide file tree
Showing 6 changed files with 398 additions and 307 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c820c2aa27bb5b6069aa708b0a0b44b59a16bfa7
refs/heads/master: a2fa3e9f52d875f7d4ca98434603b8756be71ba8
31 changes: 2 additions & 29 deletions trunk/drivers/kvm/kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <linux/mm.h>
#include <asm/signal.h>

#include "vmx.h"
#include <linux/kvm.h>
#include <linux/kvm_para.h>

Expand Down Expand Up @@ -140,14 +139,6 @@ struct kvm_mmu_page {
};
};

struct vmcs {
u32 revision_id;
u32 abort;
char data[0];
};

#define vmx_msr_entry kvm_msr_entry

struct kvm_vcpu;

/*
Expand Down Expand Up @@ -309,15 +300,12 @@ void kvm_io_bus_register_dev(struct kvm_io_bus *bus,
struct kvm_io_device *dev);

struct kvm_vcpu {
int valid;
struct kvm *kvm;
int vcpu_id;
union {
struct vmcs *vmcs;
struct vcpu_svm *svm;
};
void *_priv;
struct mutex mutex;
int cpu;
int launched;
u64 host_tsc;
struct kvm_run *run;
int interrupt_window_open;
Expand All @@ -340,14 +328,6 @@ struct kvm_vcpu {
u64 shadow_efer;
u64 apic_base;
u64 ia32_misc_enable_msr;
int nmsrs;
int save_nmsrs;
int msr_offset_efer;
#ifdef CONFIG_X86_64
int msr_offset_kernel_gs_base;
#endif
struct vmx_msr_entry *guest_msrs;
struct vmx_msr_entry *host_msrs;

struct kvm_mmu mmu;

Expand All @@ -366,11 +346,6 @@ struct kvm_vcpu {
char *guest_fx_image;
int fpu_active;
int guest_fpu_loaded;
struct vmx_host_state {
int loaded;
u16 fs_sel, gs_sel, ldt_sel;
int fs_gs_ldt_reload_needed;
} vmx_host_state;

int mmio_needed;
int mmio_read_completed;
Expand Down Expand Up @@ -579,8 +554,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data);

void fx_init(struct kvm_vcpu *vcpu);

void load_msrs(struct vmx_msr_entry *e, int n);
void save_msrs(struct vmx_msr_entry *e, int n);
void kvm_resched(struct kvm_vcpu *vcpu);
void kvm_load_guest_fpu(struct kvm_vcpu *vcpu);
void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
Expand Down
26 changes: 5 additions & 21 deletions trunk/drivers/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/kvm/kvm_svm.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ static const u32 host_save_user_msrs[] = {
#define NR_HOST_SAVE_USER_MSRS ARRAY_SIZE(host_save_user_msrs)
#define NUM_DB_REGS 4

struct kvm_vcpu;

struct vcpu_svm {
struct kvm_vcpu *vcpu;
struct vmcb *vmcb;
unsigned long vmcb_pa;
struct svm_cpu_data *svm_data;
Expand Down
Loading

0 comments on commit 1988024

Please sign in to comment.