lkml.org 
[lkml]   [2007]   [Dec]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 13/52] KVM: Portability: Move struct kvm_x86_ops definition to x86.h
    Date
    From: Zhang Xiantao <xiantao.zhang@intel.com>

    Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
    Signed-off-by: Avi Kivity <avi@qumranet.com>
    ---
    drivers/kvm/kvm.h | 69 -----------------------------------------------------
    drivers/kvm/x86.h | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++
    2 files changed, 67 insertions(+), 69 deletions(-)

    diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
    index aceecf4..e4e1ff7 100644
    --- a/drivers/kvm/kvm.h
    +++ b/drivers/kvm/kvm.h
    @@ -386,75 +386,6 @@ struct descriptor_table {
    unsigned long base;
    } __attribute__((packed));

    -struct kvm_x86_ops {
    - int (*cpu_has_kvm_support)(void); /* __init */
    - int (*disabled_by_bios)(void); /* __init */
    - void (*hardware_enable)(void *dummy); /* __init */
    - void (*hardware_disable)(void *dummy);
    - void (*check_processor_compatibility)(void *rtn);
    - int (*hardware_setup)(void); /* __init */
    - void (*hardware_unsetup)(void); /* __exit */
    -
    - /* Create, but do not attach this VCPU */
    - struct kvm_vcpu *(*vcpu_create)(struct kvm *kvm, unsigned id);
    - void (*vcpu_free)(struct kvm_vcpu *vcpu);
    - int (*vcpu_reset)(struct kvm_vcpu *vcpu);
    -
    - void (*prepare_guest_switch)(struct kvm_vcpu *vcpu);
    - void (*vcpu_load)(struct kvm_vcpu *vcpu, int cpu);
    - void (*vcpu_put)(struct kvm_vcpu *vcpu);
    - void (*vcpu_decache)(struct kvm_vcpu *vcpu);
    -
    - int (*set_guest_debug)(struct kvm_vcpu *vcpu,
    - struct kvm_debug_guest *dbg);
    - void (*guest_debug_pre)(struct kvm_vcpu *vcpu);
    - int (*get_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata);
    - int (*set_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 data);
    - u64 (*get_segment_base)(struct kvm_vcpu *vcpu, int seg);
    - void (*get_segment)(struct kvm_vcpu *vcpu,
    - struct kvm_segment *var, int seg);
    - void (*set_segment)(struct kvm_vcpu *vcpu,
    - struct kvm_segment *var, int seg);
    - void (*get_cs_db_l_bits)(struct kvm_vcpu *vcpu, int *db, int *l);
    - void (*decache_cr4_guest_bits)(struct kvm_vcpu *vcpu);
    - void (*set_cr0)(struct kvm_vcpu *vcpu, unsigned long cr0);
    - void (*set_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3);
    - void (*set_cr4)(struct kvm_vcpu *vcpu, unsigned long cr4);
    - void (*set_efer)(struct kvm_vcpu *vcpu, u64 efer);
    - void (*get_idt)(struct kvm_vcpu *vcpu, struct descriptor_table *dt);
    - void (*set_idt)(struct kvm_vcpu *vcpu, struct descriptor_table *dt);
    - void (*get_gdt)(struct kvm_vcpu *vcpu, struct descriptor_table *dt);
    - void (*set_gdt)(struct kvm_vcpu *vcpu, struct descriptor_table *dt);
    - unsigned long (*get_dr)(struct kvm_vcpu *vcpu, int dr);
    - void (*set_dr)(struct kvm_vcpu *vcpu, int dr, unsigned long value,
    - int *exception);
    - void (*cache_regs)(struct kvm_vcpu *vcpu);
    - void (*decache_regs)(struct kvm_vcpu *vcpu);
    - unsigned long (*get_rflags)(struct kvm_vcpu *vcpu);
    - void (*set_rflags)(struct kvm_vcpu *vcpu, unsigned long rflags);
    -
    - void (*tlb_flush)(struct kvm_vcpu *vcpu);
    - void (*inject_page_fault)(struct kvm_vcpu *vcpu,
    - unsigned long addr, u32 err_code);
    -
    - void (*inject_gp)(struct kvm_vcpu *vcpu, unsigned err_code);
    -
    - void (*run)(struct kvm_vcpu *vcpu, struct kvm_run *run);
    - int (*handle_exit)(struct kvm_run *run, struct kvm_vcpu *vcpu);
    - void (*skip_emulated_instruction)(struct kvm_vcpu *vcpu);
    - void (*patch_hypercall)(struct kvm_vcpu *vcpu,
    - unsigned char *hypercall_addr);
    - int (*get_irq)(struct kvm_vcpu *vcpu);
    - void (*set_irq)(struct kvm_vcpu *vcpu, int vec);
    - void (*inject_pending_irq)(struct kvm_vcpu *vcpu);
    - void (*inject_pending_vectors)(struct kvm_vcpu *vcpu,
    - struct kvm_run *run);
    -
    - int (*set_tss_addr)(struct kvm *kvm, unsigned int addr);
    -};
    -
    -extern struct kvm_x86_ops *kvm_x86_ops;
    -
    /* The guest did something we don't support. */
    #define pr_unimpl(vcpu, fmt, ...) \
    do { \
    diff --git a/drivers/kvm/x86.h b/drivers/kvm/x86.h
    index ec1d669..77b4092 100644
    --- a/drivers/kvm/x86.h
    +++ b/drivers/kvm/x86.h
    @@ -121,6 +121,73 @@ struct kvm_vcpu {
    struct x86_emulate_ctxt emulate_ctxt;
    };

    +struct kvm_x86_ops {
    + int (*cpu_has_kvm_support)(void); /* __init */
    + int (*disabled_by_bios)(void); /* __init */
    + void (*hardware_enable)(void *dummy); /* __init */
    + void (*hardware_disable)(void *dummy);
    + void (*check_processor_compatibility)(void *rtn);
    + int (*hardware_setup)(void); /* __init */
    + void (*hardware_unsetup)(void); /* __exit */
    +
    + /* Create, but do not attach this VCPU */
    + struct kvm_vcpu *(*vcpu_create)(struct kvm *kvm, unsigned id);
    + void (*vcpu_free)(struct kvm_vcpu *vcpu);
    + int (*vcpu_reset)(struct kvm_vcpu *vcpu);
    +
    + void (*prepare_guest_switch)(struct kvm_vcpu *vcpu);
    + void (*vcpu_load)(struct kvm_vcpu *vcpu, int cpu);
    + void (*vcpu_put)(struct kvm_vcpu *vcpu);
    + void (*vcpu_decache)(struct kvm_vcpu *vcpu);
    +
    + int (*set_guest_debug)(struct kvm_vcpu *vcpu,
    + struct kvm_debug_guest *dbg);
    + void (*guest_debug_pre)(struct kvm_vcpu *vcpu);
    + int (*get_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata);
    + int (*set_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 data);
    + u64 (*get_segment_base)(struct kvm_vcpu *vcpu, int seg);
    + void (*get_segment)(struct kvm_vcpu *vcpu,
    + struct kvm_segment *var, int seg);
    + void (*set_segment)(struct kvm_vcpu *vcpu,
    + struct kvm_segment *var, int seg);
    + void (*get_cs_db_l_bits)(struct kvm_vcpu *vcpu, int *db, int *l);
    + void (*decache_cr4_guest_bits)(struct kvm_vcpu *vcpu);
    + void (*set_cr0)(struct kvm_vcpu *vcpu, unsigned long cr0);
    + void (*set_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3);
    + void (*set_cr4)(struct kvm_vcpu *vcpu, unsigned long cr4);
    + void (*set_efer)(struct kvm_vcpu *vcpu, u64 efer);
    + void (*get_idt)(struct kvm_vcpu *vcpu, struct descriptor_table *dt);
    + void (*set_idt)(struct kvm_vcpu *vcpu, struct descriptor_table *dt);
    + void (*get_gdt)(struct kvm_vcpu *vcpu, struct descriptor_table *dt);
    + void (*set_gdt)(struct kvm_vcpu *vcpu, struct descriptor_table *dt);
    + unsigned long (*get_dr)(struct kvm_vcpu *vcpu, int dr);
    + void (*set_dr)(struct kvm_vcpu *vcpu, int dr, unsigned long value,
    + int *exception);
    + void (*cache_regs)(struct kvm_vcpu *vcpu);
    + void (*decache_regs)(struct kvm_vcpu *vcpu);
    + unsigned long (*get_rflags)(struct kvm_vcpu *vcpu);
    + void (*set_rflags)(struct kvm_vcpu *vcpu, unsigned long rflags);
    +
    + void (*tlb_flush)(struct kvm_vcpu *vcpu);
    + void (*inject_page_fault)(struct kvm_vcpu *vcpu,
    + unsigned long addr, u32 err_code);
    +
    + void (*inject_gp)(struct kvm_vcpu *vcpu, unsigned err_code);
    +
    + void (*run)(struct kvm_vcpu *vcpu, struct kvm_run *run);
    + int (*handle_exit)(struct kvm_run *run, struct kvm_vcpu *vcpu);
    + void (*skip_emulated_instruction)(struct kvm_vcpu *vcpu);
    + void (*patch_hypercall)(struct kvm_vcpu *vcpu,
    + unsigned char *hypercall_addr);
    + int (*get_irq)(struct kvm_vcpu *vcpu);
    + void (*set_irq)(struct kvm_vcpu *vcpu, int vec);
    + void (*inject_pending_irq)(struct kvm_vcpu *vcpu);
    + void (*inject_pending_vectors)(struct kvm_vcpu *vcpu,
    + struct kvm_run *run);
    +
    + int (*set_tss_addr)(struct kvm *kvm, unsigned int addr);
    +};
    +
    extern struct kvm_x86_ops *kvm_x86_ops;

    int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code);
    --
    1.5.3.7


    \
     
     \ /
      Last update: 2007-12-30 08:19    [W:0.035 / U:1.056 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site