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

@@ -132,7 +132,7 @@ static inline void cpuid_subleaf(uint32_t leaf, uint32_t subleaf,
}
int set_vcpuid_entries(struct vm *vm);
void guest_cpuid(struct vcpu *vcpu,
void guest_cpuid(struct acrn_vcpu *vcpu,
uint32_t *eax, uint32_t *ebx,
uint32_t *ecx, uint32_t *edx);

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)) {

View File

@@ -49,7 +49,7 @@ struct vm_io_range {
struct vm_io_handler;
struct vm;
struct vcpu;
struct acrn_vcpu;
typedef
uint32_t (*io_read_fn_t)(struct vm *vm, uint16_t port, size_t size);
@@ -178,7 +178,7 @@ struct mem_io_node {
*
* @param vcpu The virtual CPU which triggers the VM exit on I/O instruction
*/
int32_t pio_instr_vmexit_handler(struct vcpu *vcpu);
int32_t pio_instr_vmexit_handler(struct acrn_vcpu *vcpu);
/**
* @brief Initialize the I/O bitmap for \p vm
@@ -259,7 +259,7 @@ void unregister_mmio_emulation_handler(struct vm *vm, uint64_t start,
* either a previous call to emulate_io() returning 0 or the corresponding VHM
* request transferring to the COMPLETE state.
*/
void emulate_mmio_post(const struct vcpu *vcpu, const struct io_request *io_req);
void emulate_mmio_post(const struct acrn_vcpu *vcpu, const struct io_request *io_req);
/**
* @brief Post-work of VHM requests for MMIO emulation
@@ -271,7 +271,7 @@ void emulate_mmio_post(const struct vcpu *vcpu, const struct io_request *io_req)
* @remark This function must be called after the VHM request corresponding to
* \p vcpu being transferred to the COMPLETE state.
*/
void dm_emulate_mmio_post(struct vcpu *vcpu);
void dm_emulate_mmio_post(struct acrn_vcpu *vcpu);
/**
* @brief Emulate \p io_req for \p vcpu
@@ -288,14 +288,14 @@ void dm_emulate_mmio_post(struct vcpu *vcpu);
* @return -EINVAL - \p io_req has an invalid type.
* @return Negative on other errors during emulation.
*/
int32_t emulate_io(struct vcpu *vcpu, struct io_request *io_req);
int32_t emulate_io(struct acrn_vcpu *vcpu, struct io_request *io_req);
/**
* @brief General post-work for all kinds of VHM requests for I/O emulation
*
* @param vcpu The virtual CPU that triggers the MMIO access
*/
void emulate_io_post(struct vcpu *vcpu);
void emulate_io_post(struct acrn_vcpu *vcpu);
/**
* @brief Deliver \p io_req to SOS and suspend \p vcpu till its completion
@@ -305,7 +305,7 @@ void emulate_io_post(struct vcpu *vcpu);
*
* @pre vcpu != NULL && io_req != NULL
*/
int32_t acrn_insert_request_wait(struct vcpu *vcpu, const struct io_request *io_req);
int32_t acrn_insert_request_wait(struct acrn_vcpu *vcpu, const struct io_request *io_req);
/**
* @}

View File

@@ -141,7 +141,7 @@ uint32_t irq_to_vector(uint32_t irq);
*
* @pre vcpu != NULL
*/
int vcpu_queue_exception(struct vcpu *vcpu, uint32_t vector, uint32_t err_code);
int vcpu_queue_exception(struct acrn_vcpu *vcpu, uint32_t vector, uint32_t err_code);
/**
* @brief Inject external interrupt to guest.
@@ -152,7 +152,7 @@ int vcpu_queue_exception(struct vcpu *vcpu, uint32_t vector, uint32_t err_code);
*
* @pre vcpu != NULL
*/
void vcpu_inject_extint(struct vcpu *vcpu);
void vcpu_inject_extint(struct acrn_vcpu *vcpu);
/**
* @brief Inject NMI to guest.
@@ -163,7 +163,7 @@ void vcpu_inject_extint(struct vcpu *vcpu);
*
* @pre vcpu != NULL
*/
void vcpu_inject_nmi(struct vcpu *vcpu);
void vcpu_inject_nmi(struct acrn_vcpu *vcpu);
/**
* @brief Inject general protection exeception(GP) to guest.
@@ -175,7 +175,7 @@ void vcpu_inject_nmi(struct vcpu *vcpu);
*
* @pre vcpu != NULL
*/
void vcpu_inject_gp(struct vcpu *vcpu, uint32_t err_code);
void vcpu_inject_gp(struct acrn_vcpu *vcpu, uint32_t err_code);
/**
* @brief Inject page fault exeception(PF) to guest.
@@ -188,7 +188,7 @@ void vcpu_inject_gp(struct vcpu *vcpu, uint32_t err_code);
*
* @pre vcpu != NULL
*/
void vcpu_inject_pf(struct vcpu *vcpu, uint64_t addr, uint32_t err_code);
void vcpu_inject_pf(struct acrn_vcpu *vcpu, uint64_t addr, uint32_t err_code);
/**
* @brief Inject invalid opcode exeception(UD) to guest.
@@ -199,7 +199,7 @@ void vcpu_inject_pf(struct vcpu *vcpu, uint64_t addr, uint32_t err_code);
*
* @pre vcpu != NULL
*/
void vcpu_inject_ud(struct vcpu *vcpu);
void vcpu_inject_ud(struct acrn_vcpu *vcpu);
/**
* @brief Inject alignment check exeception(AC) to guest.
@@ -210,7 +210,7 @@ void vcpu_inject_ud(struct vcpu *vcpu);
*
* @pre vcpu != NULL
*/
void vcpu_inject_ac(struct vcpu *vcpu);
void vcpu_inject_ac(struct acrn_vcpu *vcpu);
/**
* @brief Inject stack fault exeception(SS) to guest.
@@ -221,16 +221,16 @@ void vcpu_inject_ac(struct vcpu *vcpu);
*
* @pre vcpu != NULL
*/
void vcpu_inject_ss(struct vcpu *vcpu);
void vcpu_make_request(struct vcpu *vcpu, uint16_t eventid);
void vcpu_inject_ss(struct acrn_vcpu *vcpu);
void vcpu_make_request(struct acrn_vcpu *vcpu, uint16_t eventid);
/*
* @pre vcpu != NULL
*/
int exception_vmexit_handler(struct vcpu *vcpu);
int interrupt_window_vmexit_handler(struct vcpu *vcpu);
int external_interrupt_vmexit_handler(struct vcpu *vcpu);
int acrn_handle_pending_request(struct vcpu *vcpu);
int exception_vmexit_handler(struct acrn_vcpu *vcpu);
int interrupt_window_vmexit_handler(struct acrn_vcpu *vcpu);
int external_interrupt_vmexit_handler(struct acrn_vcpu *vcpu);
int acrn_handle_pending_request(struct acrn_vcpu *vcpu);
/**
* @brief Initialize the interrupt
@@ -241,7 +241,7 @@ int acrn_handle_pending_request(struct vcpu *vcpu);
*/
void interrupt_init(uint16_t pcpu_id);
void cancel_event_injection(struct vcpu *vcpu);
void cancel_event_injection(struct acrn_vcpu *vcpu);
#ifdef HV_DEBUG
/**

View File

@@ -149,7 +149,7 @@ void flush_vpid_global(void);
*
* @return None
*/
void invept(const struct vcpu *vcpu);
void invept(const struct acrn_vcpu *vcpu);
/**
* @brief Host-physical address continous checking
*
@@ -302,7 +302,7 @@ void ept_mr_del(struct vm *vm, uint64_t *pml4_page, uint64_t gpa,
* @return -EINVAL - fail to handle the EPT violation
* @return 0 - Success to handle the EPT violation
*/
int ept_violation_vmexit_handler(struct vcpu *vcpu);
int ept_violation_vmexit_handler(struct acrn_vcpu *vcpu);
/**
* @brief EPT misconfiguration handling
*
@@ -311,7 +311,7 @@ int ept_violation_vmexit_handler(struct vcpu *vcpu);
* @return -EINVAL - fail to handle the EPT misconfig
* @return 0 - Success to handle the EPT misconfig
*/
int ept_misconfig_vmexit_handler(__unused struct vcpu *vcpu);
int ept_misconfig_vmexit_handler(__unused struct acrn_vcpu *vcpu);
/**
* @}

View File

@@ -62,7 +62,7 @@ struct mtrr_state {
*
* @return None
*/
void mtrr_wrmsr(struct vcpu *vcpu, uint32_t msr, uint64_t value);
void mtrr_wrmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t value);
/**
* @brief Virtual MTRR MSR read
*
@@ -71,7 +71,7 @@ void mtrr_wrmsr(struct vcpu *vcpu, uint32_t msr, uint64_t value);
*
* @return unsigned long integer - The specified virtual MTRR MSR value
*/
uint64_t mtrr_rdmsr(const struct vcpu *vcpu, uint32_t msr);
uint64_t mtrr_rdmsr(const struct acrn_vcpu *vcpu, uint32_t msr);
/**
* @brief Virtual MTRR initialization
*
@@ -79,7 +79,7 @@ uint64_t mtrr_rdmsr(const struct vcpu *vcpu, uint32_t msr);
*
* @return None
*/
void init_mtrr(struct vcpu *vcpu);
void init_mtrr(struct acrn_vcpu *vcpu);
/**
* @}
*/

View File

@@ -128,11 +128,11 @@ struct trusty_startup_param {
uint8_t padding[4];
};
void switch_world(struct vcpu *vcpu, int next_world);
bool initialize_trusty(struct vcpu *vcpu, uint64_t param);
void switch_world(struct acrn_vcpu *vcpu, int next_world);
bool initialize_trusty(struct acrn_vcpu *vcpu, uint64_t param);
void destroy_secure_world(struct vm *vm, bool need_clr_mem);
void save_sworld_context(struct vcpu *vcpu);
void restore_sworld_context(struct vcpu *vcpu);
void save_sworld_context(struct acrn_vcpu *vcpu);
void restore_sworld_context(struct acrn_vcpu *vcpu);
void trusty_set_dseed(const void *dseed, uint8_t dseed_num);
#endif /* TRUSTY_H_ */

View File

@@ -8,14 +8,14 @@
#define VMEXIT_H_
struct vm_exit_dispatch {
int (*handler)(struct vcpu *);
int (*handler)(struct acrn_vcpu *);
uint32_t need_exit_qualification;
};
int vmexit_handler(struct vcpu *vcpu);
int vmcall_vmexit_handler(struct vcpu *vcpu);
int cpuid_vmexit_handler(struct vcpu *vcpu);
int cr_access_vmexit_handler(struct vcpu *vcpu);
int vmexit_handler(struct acrn_vcpu *vcpu);
int vmcall_vmexit_handler(struct acrn_vcpu *vcpu);
int cpuid_vmexit_handler(struct acrn_vcpu *vcpu);
int cr_access_vmexit_handler(struct acrn_vcpu *vcpu);
extern void vm_exit(void);
static inline uint64_t
vm_exit_qualification_bit_mask(uint64_t exit_qual, uint32_t msb, uint32_t lsb)

View File

@@ -451,22 +451,22 @@ void exec_vmwrite32(uint32_t field, uint32_t value);
void exec_vmwrite64(uint32_t field_full, uint64_t value);
#define exec_vmwrite exec_vmwrite64
void init_vmcs(struct vcpu *vcpu);
void init_vmcs(struct acrn_vcpu *vcpu);
void vmx_off(uint16_t pcpu_id);
void exec_vmclear(void *addr);
void exec_vmptrld(void *addr);
uint64_t vmx_rdmsr_pat(const struct vcpu *vcpu);
int vmx_wrmsr_pat(struct vcpu *vcpu, uint64_t value);
uint64_t vmx_rdmsr_pat(const struct acrn_vcpu *vcpu);
int vmx_wrmsr_pat(struct acrn_vcpu *vcpu, uint64_t value);
void vmx_write_cr0(struct vcpu *vcpu, uint64_t cr0);
void vmx_write_cr4(struct vcpu *vcpu, uint64_t cr4);
void vmx_write_cr0(struct acrn_vcpu *vcpu, uint64_t cr0);
void vmx_write_cr4(struct acrn_vcpu *vcpu, uint64_t cr4);
bool is_vmx_disabled(void);
void switch_apicv_mode_x2apic(struct vcpu *vcpu);
void switch_apicv_mode_x2apic(struct acrn_vcpu *vcpu);
static inline enum vm_cpu_mode get_vcpu_mode(const struct vcpu *vcpu)
static inline enum vm_cpu_mode get_vcpu_mode(const struct acrn_vcpu *vcpu)
{
return vcpu->arch_vcpu.cpu_mode;
}