mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +00:00
hv: add a new field cpu_affinity in struct acrn_vm
For post-launched VMs, the configured CPU affinity could be different from the actual running CPU affinity. This new field acrn_vm->cpu_affinity recognizes this difference so that it's possible that CREATE_VM hypercall won't overwrite the configured CPU afifnity. Change name cpu_affinity_bitmap in acrn_vm_config to cpu_affinity. This is read-only in run time, never overwritten by acrn-dm. Remove vm_config->vcpu_num, which means the number of vCPUs of the configured CPU affinity. This is not to be confused with the actual running vCPU number: vm->hw.created_vcpus. Changed get_vm_bsp_pcpu_id() to get_configured_bsp_pcpu_id() for less confusion. Tracked-On: #4616 Signed-off-by: Zide Chen <zide.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -42,6 +42,7 @@ struct vm_hw_info {
|
||||
/* vcpu array of this VM */
|
||||
struct acrn_vcpu vcpu_array[MAX_VCPUS_PER_VM];
|
||||
uint16_t created_vcpus; /* Number of created vcpus */
|
||||
uint64_t cpu_affinity; /* Actual pCPUs this VM runs on. The set bits represent the pCPU IDs */
|
||||
} __aligned(PAGE_SIZE);
|
||||
|
||||
struct sw_module_info {
|
||||
@@ -239,7 +240,7 @@ void pause_vm(struct acrn_vm *vm);
|
||||
void resume_vm_from_s3(struct acrn_vm *vm, uint32_t wakeup_vec);
|
||||
void start_vm(struct acrn_vm *vm);
|
||||
int32_t reset_vm(struct acrn_vm *vm);
|
||||
int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_vm **rtn_vm);
|
||||
int32_t create_vm(uint16_t vm_id, uint64_t pcpu_bitmap, struct acrn_vm_config *vm_config, struct acrn_vm **rtn_vm);
|
||||
void prepare_vm(uint16_t vm_id, struct acrn_vm_config *vm_config);
|
||||
void launch_vms(uint16_t pcpu_id);
|
||||
bool is_poweroff_vm(const struct acrn_vm *vm);
|
||||
|
@@ -145,9 +145,11 @@ struct acrn_vm_config {
|
||||
enum acrn_vm_load_order load_order; /* specify the load order of VM */
|
||||
char name[MAX_VM_OS_NAME_LEN]; /* VM name identifier, useful for debug. */
|
||||
const uint8_t uuid[16]; /* UUID of the VM */
|
||||
uint16_t vcpu_num; /* Number of vCPUs for the VM */
|
||||
uint8_t reserved[2]; /* Temporarily reserve it so that don't need to update
|
||||
* the users of get_platform_info frequently.
|
||||
*/
|
||||
uint8_t severity; /* severity of the VM */
|
||||
uint64_t cpu_affinity_bitmap; /* The set bits represent the pCPUs the vCPUs of
|
||||
uint64_t cpu_affinity; /* The set bits represent the pCPUs the vCPUs of
|
||||
* the VM may run on.
|
||||
*/
|
||||
uint64_t guest_flags; /* VM flags that we want to configure for guest
|
||||
|
Reference in New Issue
Block a user