HV: make vm id statically by uuid

Currently VM id of NORMAL_VM is allocated dymatically, we need to make
VM id statically for FuSa compliance.

This patch will pre-configure UUID for all VMs, then NORMAL_VM could
get its VM id/configuration from vm_configs array by indexing the UUID.

If UUID collisions is found in vm configs array, HV will refuse to
load the VM;

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Victor Sun
2019-04-09 20:39:49 +08:00
committed by ACRN System Integration
parent cb10dc7e73
commit 445999af5d
7 changed files with 77 additions and 34 deletions

View File

@@ -213,7 +213,7 @@ void launch_vms(uint16_t pcpu_id);
bool is_valid_vm(const struct acrn_vm *vm);
bool is_sos_vm(const struct acrn_vm *vm);
bool is_prelaunched_vm(const struct acrn_vm *vm);
uint16_t find_free_vm_id(void);
uint16_t get_vmid_by_uuid(const uint8_t *uuid);
struct acrn_vm *get_vm_from_vmid(uint16_t vm_id);
struct acrn_vm *get_sos_vm(void);

View File

@@ -45,7 +45,7 @@ struct acrn_vm_pci_ptdev_config {
struct acrn_vm_config {
enum acrn_vm_type type; /* specify the type of VM */
char name[MAX_VM_OS_NAME_LEN]; /* VM name identifier, useful for debug. */
uint8_t uuid[16]; /* UUID of the VM */
const uint8_t uuid[16]; /* UUID of the VM */
uint64_t pcpu_bitmap; /* from pcpu bitmap, we could know VM core number */
uint64_t guest_flags; /* VM flags that we want to configure for guest
* Now we have two flags:
@@ -63,6 +63,7 @@ struct acrn_vm_config {
} __aligned(8);
struct acrn_vm_config *get_vm_config(uint16_t vm_id);
bool vm_has_matched_uuid(uint16_t vmid, const uint8_t *uuid);
bool sanitize_vm_config(void);
extern struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM];