mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-05 15:45:05 +00:00
HV:treewide:Add 16-bit atomic operations and update vpid type
There are some integer type conversions reported by static analysis tool for vcpu id, number of created vcpus, and vpid, to reduce these type conversions, redesign vcpu id, number of created vcpus, and vpid type as uint16_t as per their usage, related 16-bit atomic operations shall be added in HV. MISRA C requires that all unsigned constants should have the suffix 'U' (e.g. 0xffU), but the assembler may not accept such C-style constants. Add 16-bit atomic add/dec/store operations; Update temporary variables type and parameters type of related caller; Update vpid type as uint16_t; Replace Macro with constant value for CPU_PAGE_SIZE. Note: According to SDM A.10, there are some bits defined in the IA32_VMX_EPT_VPID_CAP MSR to support the INVVPID instruction, these bits don't mean actual VPID, so the vpid field in the data struct vmx_capability doesn't be updated. V1--V2: update comments for assembly code as per coding style; Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com>
This commit is contained in:
@@ -192,7 +192,7 @@ struct vcpu_arch {
|
||||
|
||||
/* A pointer to the VMCS for this CPU. */
|
||||
void *vmcs;
|
||||
int vpid;
|
||||
uint16_t vpid;
|
||||
|
||||
/* Holds the information needed for IRQ/exception handling. */
|
||||
struct {
|
||||
|
||||
@@ -23,7 +23,7 @@ struct vm_attr {
|
||||
struct vm_hw_info {
|
||||
uint16_t num_vcpus; /* Number of total virtual cores */
|
||||
uint16_t exp_num_vcpus; /* Number of real expected virtual cores */
|
||||
int created_vcpus; /* Number of created vcpus */
|
||||
uint16_t created_vcpus; /* Number of created vcpus */
|
||||
struct vcpu **vcpu_array; /* vcpu array of this VM */
|
||||
uint64_t gpa_lowtop; /* top lowmem gpa of this VM */
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user