HV:treewide:rename vcpu data structure

For data structure types "struct vcpu", its name is identical
with variable name in the same scope. This is a MISRA C  violation.

Naming convention rule:If the data structure type is used by multi
modules, its corresponding logic resource is exposed to external
components (such as SOS, UOS), and its name meaning is simplistic
(such as vcpu, vm), its name needs prefix "acrn_".

The following udpates are made:
struct vcpu *vcpu-->struct acrn_vcpu *vcpu

Tracked-On: #861

Signed-off-by: Xiangyang Wu <xiangyang.wu@linux.intel.com>
This commit is contained in:
Xiangyang Wu
2018-11-05 13:25:25 +08:00
committed by lijinxia
parent 969f7cf071
commit fa26a16645
49 changed files with 355 additions and 355 deletions

View File

@@ -112,9 +112,9 @@ enum vm_paging_mode {
*/
uint64_t vcpumask2pcpumask(struct vm *vm, uint64_t vdmask);
int gva2gpa(struct vcpu *vcpu, uint64_t gva, uint64_t *gpa, uint32_t *err_code);
int gva2gpa(struct acrn_vcpu *vcpu, uint64_t gva, uint64_t *gpa, uint32_t *err_code);
enum vm_paging_mode get_vcpu_paging_mode(struct vcpu *vcpu);
enum vm_paging_mode get_vcpu_paging_mode(struct acrn_vcpu *vcpu);
void init_e820(void);
void obtain_e820_mem_info(void);
@@ -135,9 +135,9 @@ extern const struct e820_entry e820_default_entries[NUM_E820_ENTRIES];
extern uint32_t boot_regs[2];
extern struct e820_mem_params e820_mem;
int rdmsr_vmexit_handler(struct vcpu *vcpu);
int wrmsr_vmexit_handler(struct vcpu *vcpu);
void init_msr_emulation(struct vcpu *vcpu);
int rdmsr_vmexit_handler(struct acrn_vcpu *vcpu);
int wrmsr_vmexit_handler(struct acrn_vcpu *vcpu);
void init_msr_emulation(struct acrn_vcpu *vcpu);
struct run_context;
int vmx_vmrun(struct run_context *context, int ops, int ibrs);
@@ -203,7 +203,7 @@ int copy_to_gpa(struct vm *vm, void *h_ptr, uint64_t gpa, uint32_t size);
* @param[out] err_code The page fault flags
* @param[out] fault_addr The GVA address that causes a page fault
*/
int copy_from_gva(struct vcpu *vcpu, void *h_ptr, uint64_t gva,
int copy_from_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva,
uint32_t size, uint32_t *err_code, uint64_t *fault_addr);
/**
* @brief Copy data from HV address space to VM GVA space
@@ -218,7 +218,7 @@ int copy_from_gva(struct vcpu *vcpu, void *h_ptr, uint64_t gva,
* @param[out] err_code The page fault flags
* @param[out] fault_addr The GVA address that causes a page fault
*/
int copy_to_gva(struct vcpu *vcpu, void *h_ptr, uint64_t gva,
int copy_to_gva(struct acrn_vcpu *vcpu, void *h_ptr, uint64_t gva,
uint32_t size, uint32_t *err_code, uint64_t *fault_addr);
extern struct acrn_vcpu_regs vm0_boot_context;
/**

View File

@@ -20,7 +20,7 @@ struct ucode_header {
uint32_t reserved[3];
};
void acrn_update_ucode(struct vcpu *vcpu, uint64_t v);
void acrn_update_ucode(struct acrn_vcpu *vcpu, uint64_t v);
uint64_t get_microcode_version(void);
#endif /* UCODE_H */

View File

@@ -220,7 +220,7 @@ struct vcpu_arch {
} __aligned(CPU_PAGE_SIZE);
struct vm;
struct vcpu {
struct acrn_vcpu {
/* Architecture specific definitions for this VCPU */
struct vcpu_arch arch_vcpu;
uint16_t pcpu_id; /* Physical CPU ID of this VCPU */
@@ -259,24 +259,24 @@ struct vcpu {
} __aligned(CPU_PAGE_SIZE);
struct vcpu_dump {
struct vcpu *vcpu;
struct acrn_vcpu *vcpu;
char *str;
uint32_t str_max;
};
static inline bool is_vcpu_bsp(const struct vcpu *vcpu)
static inline bool is_vcpu_bsp(const struct acrn_vcpu *vcpu)
{
return (vcpu->vcpu_id == BOOT_CPU_ID);
}
/* do not update Guest RIP for next VM Enter */
static inline void vcpu_retain_rip(struct vcpu *vcpu)
static inline void vcpu_retain_rip(struct acrn_vcpu *vcpu)
{
(vcpu)->arch_vcpu.inst_len = 0U;
}
static inline struct acrn_vlapic *
vcpu_vlapic(struct vcpu *vcpu)
vcpu_vlapic(struct acrn_vcpu *vcpu)
{
return &(vcpu->arch_vcpu.vlapic);
}
@@ -293,7 +293,7 @@ vcpu_vlapic(struct vcpu *vcpu)
*
* @return the value of the register.
*/
uint64_t vcpu_get_gpreg(const struct vcpu *vcpu, uint32_t reg);
uint64_t vcpu_get_gpreg(const struct acrn_vcpu *vcpu, uint32_t reg);
/**
* @brief set vcpu register value
@@ -304,7 +304,7 @@ uint64_t vcpu_get_gpreg(const struct vcpu *vcpu, uint32_t reg);
* @param[in] reg register of the vcpu
* @param[in] val the value set the register of the vcpu
*/
void vcpu_set_gpreg(struct vcpu *vcpu, uint32_t reg, uint64_t val);
void vcpu_set_gpreg(struct acrn_vcpu *vcpu, uint32_t reg, uint64_t val);
/**
* @brief get vcpu RIP value
@@ -315,7 +315,7 @@ void vcpu_set_gpreg(struct vcpu *vcpu, uint32_t reg, uint64_t val);
*
* @return the value of RIP.
*/
uint64_t vcpu_get_rip(struct vcpu *vcpu);
uint64_t vcpu_get_rip(struct acrn_vcpu *vcpu);
/**
* @brief set vcpu RIP value
@@ -325,7 +325,7 @@ uint64_t vcpu_get_rip(struct vcpu *vcpu);
* @param[inout] vcpu pointer to vcpu data structure
* @param[in] val the value set RIP
*/
void vcpu_set_rip(struct vcpu *vcpu, uint64_t val);
void vcpu_set_rip(struct acrn_vcpu *vcpu, uint64_t val);
/**
* @brief get vcpu RSP value
@@ -336,7 +336,7 @@ void vcpu_set_rip(struct vcpu *vcpu, uint64_t val);
*
* @return the value of RSP.
*/
uint64_t vcpu_get_rsp(struct vcpu *vcpu);
uint64_t vcpu_get_rsp(struct acrn_vcpu *vcpu);
/**
* @brief set vcpu RSP value
@@ -346,7 +346,7 @@ uint64_t vcpu_get_rsp(struct vcpu *vcpu);
* @param[inout] vcpu pointer to vcpu data structure
* @param[in] val the value set RSP
*/
void vcpu_set_rsp(struct vcpu *vcpu, uint64_t val);
void vcpu_set_rsp(struct acrn_vcpu *vcpu, uint64_t val);
/**
* @brief get vcpu EFER value
@@ -357,7 +357,7 @@ void vcpu_set_rsp(struct vcpu *vcpu, uint64_t val);
*
* @return the value of EFER.
*/
uint64_t vcpu_get_efer(struct vcpu *vcpu);
uint64_t vcpu_get_efer(struct acrn_vcpu *vcpu);
/**
* @brief set vcpu EFER value
@@ -367,7 +367,7 @@ uint64_t vcpu_get_efer(struct vcpu *vcpu);
* @param[inout] vcpu pointer to vcpu data structure
* @param[in] val the value set EFER
*/
void vcpu_set_efer(struct vcpu *vcpu, uint64_t val);
void vcpu_set_efer(struct acrn_vcpu *vcpu, uint64_t val);
/**
* @brief get vcpu RFLAG value
@@ -378,7 +378,7 @@ void vcpu_set_efer(struct vcpu *vcpu, uint64_t val);
*
* @return the value of RFLAGS.
*/
uint64_t vcpu_get_rflags(struct vcpu *vcpu);
uint64_t vcpu_get_rflags(struct acrn_vcpu *vcpu);
/**
* @brief set vcpu RFLAGS value
@@ -388,7 +388,7 @@ uint64_t vcpu_get_rflags(struct vcpu *vcpu);
* @param[inout] vcpu pointer to vcpu data structure
* @param[in] val the value set RFLAGS
*/
void vcpu_set_rflags(struct vcpu *vcpu, uint64_t val);
void vcpu_set_rflags(struct acrn_vcpu *vcpu, uint64_t val);
/**
* @brief get vcpu CR0 value
@@ -399,7 +399,7 @@ void vcpu_set_rflags(struct vcpu *vcpu, uint64_t val);
*
* @return the value of CR0.
*/
uint64_t vcpu_get_cr0(struct vcpu *vcpu);
uint64_t vcpu_get_cr0(struct acrn_vcpu *vcpu);
/**
* @brief set vcpu CR0 value
@@ -409,7 +409,7 @@ uint64_t vcpu_get_cr0(struct vcpu *vcpu);
* @param[inout] vcpu pointer to vcpu data structure
* @param[in] val the value set CR0
*/
void vcpu_set_cr0(struct vcpu *vcpu, uint64_t val);
void vcpu_set_cr0(struct acrn_vcpu *vcpu, uint64_t val);
/**
* @brief get vcpu CR2 value
@@ -420,7 +420,7 @@ void vcpu_set_cr0(struct vcpu *vcpu, uint64_t val);
*
* @return the value of CR2.
*/
uint64_t vcpu_get_cr2(struct vcpu *vcpu);
uint64_t vcpu_get_cr2(struct acrn_vcpu *vcpu);
/**
* @brief set vcpu CR2 value
@@ -430,7 +430,7 @@ uint64_t vcpu_get_cr2(struct vcpu *vcpu);
* @param[inout] vcpu pointer to vcpu data structure
* @param[in] val the value set CR2
*/
void vcpu_set_cr2(struct vcpu *vcpu, uint64_t val);
void vcpu_set_cr2(struct acrn_vcpu *vcpu, uint64_t val);
/**
* @brief get vcpu CR4 value
@@ -441,7 +441,7 @@ void vcpu_set_cr2(struct vcpu *vcpu, uint64_t val);
*
* @return the value of CR4.
*/
uint64_t vcpu_get_cr4(struct vcpu *vcpu);
uint64_t vcpu_get_cr4(struct acrn_vcpu *vcpu);
/**
* @brief set vcpu CR4 value
@@ -451,10 +451,10 @@ uint64_t vcpu_get_cr4(struct vcpu *vcpu);
* @param[inout] vcpu pointer to vcpu data structure
* @param[in] val the value set CR4
*/
void vcpu_set_cr4(struct vcpu *vcpu, uint64_t val);
void vcpu_set_cr4(struct acrn_vcpu *vcpu, uint64_t val);
uint64_t vcpu_get_pat_ext(const struct vcpu *vcpu);
void vcpu_set_pat_ext(struct vcpu *vcpu, uint64_t val);
uint64_t vcpu_get_pat_ext(const struct acrn_vcpu *vcpu);
void vcpu_set_pat_ext(struct acrn_vcpu *vcpu, uint64_t val);
/**
* @brief set all the vcpu registers
@@ -464,7 +464,7 @@ void vcpu_set_pat_ext(struct vcpu *vcpu, uint64_t val);
* @param[inout] vcpu pointer to vcpu data structure
* @param[in] vcpu_regs all the registers' value
*/
void set_vcpu_regs(struct vcpu *vcpu, struct acrn_vcpu_regs *vcpu_regs);
void set_vcpu_regs(struct acrn_vcpu *vcpu, struct acrn_vcpu_regs *vcpu_regs);
/**
* @brief reset all the vcpu registers
@@ -473,7 +473,7 @@ void set_vcpu_regs(struct vcpu *vcpu, struct acrn_vcpu_regs *vcpu_regs);
*
* @param[inout] vcpu pointer to vcpu data structure
*/
void reset_vcpu_regs(struct vcpu *vcpu);
void reset_vcpu_regs(struct acrn_vcpu *vcpu);
/**
* @brief set the vcpu AP entry
@@ -483,24 +483,24 @@ void reset_vcpu_regs(struct vcpu *vcpu);
* @param[inout] vcpu pointer to vcpu data structure
* @param[in] entry the entry value for AP
*/
void set_ap_entry(struct vcpu *vcpu, uint64_t entry);
void set_ap_entry(struct acrn_vcpu *vcpu, uint64_t entry);
static inline bool is_long_mode(struct vcpu *vcpu)
static inline bool is_long_mode(struct acrn_vcpu *vcpu)
{
return (vcpu_get_efer(vcpu) & MSR_IA32_EFER_LMA_BIT) != 0UL;
}
static inline bool is_paging_enabled(struct vcpu *vcpu)
static inline bool is_paging_enabled(struct acrn_vcpu *vcpu)
{
return (vcpu_get_cr0(vcpu) & CR0_PG) != 0UL;
}
static inline bool is_pae(struct vcpu *vcpu)
static inline bool is_pae(struct acrn_vcpu *vcpu)
{
return (vcpu_get_cr4(vcpu) & CR4_PAE) != 0UL;
}
struct vcpu* get_ever_run_vcpu(uint16_t pcpu_id);
struct acrn_vcpu* get_ever_run_vcpu(uint16_t pcpu_id);
/**
* @brief create a vcpu for the target vm
@@ -514,7 +514,7 @@ struct vcpu* get_ever_run_vcpu(uint16_t pcpu_id);
*
* @return 0: vcpu created successfully, other values failed.
*/
int create_vcpu(uint16_t pcpu_id, struct vm *vm, struct vcpu **rtn_vcpu_handle);
int create_vcpu(uint16_t pcpu_id, struct vm *vm, struct acrn_vcpu **rtn_vcpu_handle);
/**
* @brief run into non-root mode based on vcpu setting
@@ -527,9 +527,9 @@ int create_vcpu(uint16_t pcpu_id, struct vm *vm, struct vcpu **rtn_vcpu_handle);
*
* @return 0: vcpu run successfully, other values failed.
*/
int run_vcpu(struct vcpu *vcpu);
int run_vcpu(struct acrn_vcpu *vcpu);
int shutdown_vcpu(struct vcpu *vcpu);
int shutdown_vcpu(struct acrn_vcpu *vcpu);
/**
* @brief unmap the vcpu with pcpu and free its vlapic
@@ -539,7 +539,7 @@ int shutdown_vcpu(struct vcpu *vcpu);
* @param[inout] vcpu pointer to vcpu data structure
* @pre vcpu != NULL
*/
void offline_vcpu(struct vcpu *vcpu);
void offline_vcpu(struct acrn_vcpu *vcpu);
/**
* @brief reset vcpu state and values
@@ -548,7 +548,7 @@ void offline_vcpu(struct vcpu *vcpu);
*
* @param[inout] vcpu pointer to vcpu data structure
*/
void reset_vcpu(struct vcpu *vcpu);
void reset_vcpu(struct acrn_vcpu *vcpu);
/**
* @brief pause the vcpu and set new state
@@ -558,7 +558,7 @@ void reset_vcpu(struct vcpu *vcpu);
* @param[inout] vcpu pointer to vcpu data structure
* @param[in] new_state the state to set vcpu
*/
void pause_vcpu(struct vcpu *vcpu, enum vcpu_state new_state);
void pause_vcpu(struct acrn_vcpu *vcpu, enum vcpu_state new_state);
/**
* @brief resume the vcpu
@@ -567,7 +567,7 @@ void pause_vcpu(struct vcpu *vcpu, enum vcpu_state new_state);
*
* @param[inout] vcpu pointer to vcpu data structure
*/
void resume_vcpu(struct vcpu *vcpu);
void resume_vcpu(struct acrn_vcpu *vcpu);
/**
* @brief set the vcpu to running state, then it will be scheculed.
@@ -576,7 +576,7 @@ void resume_vcpu(struct vcpu *vcpu);
*
* @param[inout] vcpu pointer to vcpu data structure
*/
void schedule_vcpu(struct vcpu *vcpu);
void schedule_vcpu(struct acrn_vcpu *vcpu);
/**
* @brief create a vcpu for the vm and mapped to the pcpu.
@@ -588,7 +588,7 @@ void schedule_vcpu(struct vcpu *vcpu);
*/
int prepare_vcpu(struct vm *vm, uint16_t pcpu_id);
void request_vcpu_pre_work(struct vcpu *vcpu, uint16_t pre_work_id);
void request_vcpu_pre_work(struct acrn_vcpu *vcpu, uint16_t pre_work_id);
void vcpu_dumpreg(void *data);

View File

@@ -96,7 +96,7 @@ void vioapic_set_irq(struct vm *vm, uint32_t irq, uint32_t operation);
* @return void
*/
void vioapic_set_irq_nolock(struct vm *vm, uint32_t irq, uint32_t operation);
void vioapic_update_tmr(struct vcpu *vcpu);
void vioapic_update_tmr(struct acrn_vcpu *vcpu);
uint32_t vioapic_pincount(const struct vm *vm);
void vioapic_process_eoi(struct vm *vm, uint32_t vector);

View File

@@ -70,7 +70,7 @@ struct acrn_vlapic {
struct vlapic_pir_desc pir_desc;
struct vm *vm;
struct vcpu *vcpu;
struct acrn_vcpu *vcpu;
uint32_t esr_pending;
int esr_firing;
@@ -177,16 +177,16 @@ void vlapic_post_intr(uint16_t dest_pcpu_id);
*
* @pre vcpu != NULL
*/
uint64_t apicv_get_pir_desc_paddr(struct vcpu *vcpu);
uint64_t apicv_get_pir_desc_paddr(struct acrn_vcpu *vcpu);
int vlapic_rdmsr(struct vcpu *vcpu, uint32_t msr, uint64_t *rval);
int vlapic_wrmsr(struct vcpu *vcpu, uint32_t msr, uint64_t wval);
int vlapic_rdmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t *rval);
int vlapic_wrmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t wval);
/*
* Signals to the LAPIC that an interrupt at 'vector' needs to be generated
* to the 'cpu', the state is recorded in IRR.
*/
int vlapic_set_intr(struct vcpu *vcpu, uint32_t vector, bool level);
int vlapic_set_intr(struct acrn_vcpu *vcpu, uint32_t vector, bool level);
#define LAPIC_TRIG_LEVEL true
#define LAPIC_TRIG_EDGE false
@@ -200,7 +200,7 @@ int vlapic_set_intr(struct vcpu *vcpu, uint32_t vector, bool level);
* @return -EINVAL on error that vector is invalid or vcpu is NULL.
*/
static inline int
vlapic_intr_level(struct vcpu *vcpu, uint32_t vector)
vlapic_intr_level(struct acrn_vcpu *vcpu, uint32_t vector)
{
return vlapic_set_intr(vcpu, vector, LAPIC_TRIG_LEVEL);
}
@@ -215,7 +215,7 @@ vlapic_intr_level(struct vcpu *vcpu, uint32_t vector)
* @return -EINVAL on error that vector is invalid or vcpu is NULL.
*/
static inline int
vlapic_intr_edge(struct vcpu *vcpu, uint32_t vector)
vlapic_intr_edge(struct acrn_vcpu *vcpu, uint32_t vector)
{
return vlapic_set_intr(vcpu, vector, LAPIC_TRIG_EDGE);
}
@@ -265,11 +265,11 @@ void vlapic_set_tmr_one_vec(struct acrn_vlapic *vlapic, uint32_t delmode,
void vlapic_apicv_batch_set_tmr(struct acrn_vlapic *vlapic);
uint32_t vlapic_get_apicid(struct acrn_vlapic *vlapic);
int vlapic_create(struct vcpu *vcpu);
int vlapic_create(struct acrn_vcpu *vcpu);
/*
* @pre vcpu != NULL
*/
void vlapic_free(struct vcpu *vcpu);
void vlapic_free(struct acrn_vcpu *vcpu);
void vlapic_init(struct acrn_vlapic *vlapic);
void vlapic_reset(struct acrn_vlapic *vlapic);
void vlapic_restore(struct acrn_vlapic *vlapic, const struct lapic_regs *regs);
@@ -277,10 +277,10 @@ bool vlapic_enabled(const struct acrn_vlapic *vlapic);
uint64_t vlapic_apicv_get_apic_access_addr(void);
uint64_t vlapic_apicv_get_apic_page_addr(struct acrn_vlapic *vlapic);
void vlapic_apicv_inject_pir(struct acrn_vlapic *vlapic);
int apic_access_vmexit_handler(struct vcpu *vcpu);
int apic_write_vmexit_handler(struct vcpu *vcpu);
int veoi_vmexit_handler(struct vcpu *vcpu);
int tpr_below_threshold_vmexit_handler(__unused struct vcpu *vcpu);
int apic_access_vmexit_handler(struct acrn_vcpu *vcpu);
int apic_write_vmexit_handler(struct acrn_vcpu *vcpu);
int veoi_vmexit_handler(struct acrn_vcpu *vcpu);
int tpr_below_threshold_vmexit_handler(__unused struct acrn_vcpu *vcpu);
void calcvdest(struct vm *vm, uint64_t *dmask, uint32_t dest, bool phys);
/**

View File

@@ -23,7 +23,7 @@ enum vm_privilege_level {
struct vm_hw_info {
/* vcpu array of this VM */
struct vcpu vcpu_array[CONFIG_MAX_VCPUS_PER_VM];
struct acrn_vcpu vcpu_array[CONFIG_MAX_VCPUS_PER_VM];
uint16_t created_vcpus; /* Number of created vcpus */
uint64_t gpa_lowtop; /* top lowmem gpa of this VM */
} __aligned(CPU_PAGE_SIZE);
@@ -205,10 +205,10 @@ static inline bool is_vm0(const struct vm *vm)
/*
* @pre vcpu_id < CONFIG_MAX_VCPUS_PER_VM
*/
static inline struct vcpu *vcpu_from_vid(struct vm *vm, uint16_t vcpu_id)
static inline struct acrn_vcpu *vcpu_from_vid(struct vm *vm, uint16_t vcpu_id)
{
uint16_t i;
struct vcpu *vcpu;
struct acrn_vcpu *vcpu;
foreach_vcpu(i, vm, vcpu) {
if (vcpu->vcpu_id == vcpu_id) {
@@ -218,10 +218,10 @@ static inline struct vcpu *vcpu_from_vid(struct vm *vm, uint16_t vcpu_id)
return vcpu;
}
static inline struct vcpu *vcpu_from_pid(struct vm *vm, uint16_t pcpu_id)
static inline struct acrn_vcpu *vcpu_from_pid(struct vm *vm, uint16_t pcpu_id)
{
uint16_t i;
struct vcpu *vcpu;
struct acrn_vcpu *vcpu;
foreach_vcpu(i, vm, vcpu) {
if (vcpu->pcpu_id == pcpu_id) {
@@ -232,10 +232,10 @@ static inline struct vcpu *vcpu_from_pid(struct vm *vm, uint16_t pcpu_id)
return NULL;
}
static inline struct vcpu *get_primary_vcpu(struct vm *vm)
static inline struct acrn_vcpu *get_primary_vcpu(struct vm *vm)
{
uint16_t i;
struct vcpu *vcpu;
struct acrn_vcpu *vcpu;
foreach_vcpu(i, vm, vcpu) {
if (is_vcpu_bsp(vcpu)) {