mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-05 15:45:05 +00:00
hv: remove UUID
With current arch design the UUID is used to identify ACRN VMs,
all VM configurations must be deployed with given UUIDs at build time.
For post-launched VMs, end user must use UUID as acrn-dm parameter
to launch specified user VM. This is not friendly for end users
that they have to look up the pre-configured UUID before launching VM,
and then can only launch the VM which its UUID in the pre-configured UUID
list,otherwise the launch will fail.Another side, VM name is much straight
forward for end user to identify VMs, whereas the VM name defined
in launch script has not been passed to hypervisor VM configuration
so it is not consistent with the VM name when user list VM
in hypervisor shell, this would confuse user a lot.
This patch will resolve these issues by removing UUID as VM identifier
and use VM name instead:
1. Hypervisor will check the VM name duplication during VM creation time
to make sure the VM name is unique.
2. If the VM name passed from acrn-dm matches one of pre-configured
VM configurations, the corresponding VM will be launched,
we call it static configured VM.
If there is no matching found, hypervisor will try to allocate one
unused VM configuration slot for this VM with given VM name and get it
run if VM number does not reach CONFIG_MAX_VM_NUM,
we will call it dynamic configured VM.
3. For dynamic configured VMs, we need a guest flag to identify them
because the VM configuration need to be destroyed
when it is shutdown or creation failed.
v7->v8:
-- rename is_static_vm_configured to is_static_configured_vm
-- only set DM owned guest_flags in hcall_create_vm
-- add check dynamic flag in get_unused_vmid
v6->v7:
-- refine get_vmid_by_name, return the first matching vm_id
-- the GUEST_FLAG_STATIC_VM is added to identify the static or
dynamic VM, the offline tool will set this flag for
all the pre-defined VMs.
-- only clear name field for dynamic VM instead of clear entire
vm_config
Tracked-On: #6685
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Victor Sun<victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
#define GUEST_FLAG_NVMX_ENABLED (1UL << 5U) /* Whether this VM supports nested virtualization */
|
||||
#define GUEST_FLAG_SECURITY_VM (1UL << 6U) /* Whether this VM needs to do security-vm related fixup (TPM2 and SMBIOS pt) */
|
||||
#define GUEST_FLAG_VCAT_ENABLED (1UL << 7U) /* Whether this VM supports vCAT */
|
||||
#define GUEST_FLAG_STATIC_VM (1UL << 8U) /* Whether this VM uses static VM configuration */
|
||||
|
||||
/* TODO: We may need to get this addr from guest ACPI instead of hardcode here */
|
||||
#define VIRTUAL_SLEEP_CTL_ADDR 0x400U /* Pre-launched VM uses ACPI reduced HW mode and sleep control register */
|
||||
@@ -67,6 +68,8 @@
|
||||
#define VIRTUAL_PM1A_SLP_EN 0x2000U
|
||||
#define VIRTUAL_PM1A_ALWAYS_ZERO 0xc003
|
||||
|
||||
#define MAX_VM_NAME_LEN (16U)
|
||||
|
||||
/**
|
||||
* @brief Hypercall
|
||||
*
|
||||
@@ -351,8 +354,8 @@ struct acrn_vm_creation {
|
||||
/** Reserved */
|
||||
uint16_t reserved1;
|
||||
|
||||
/** the UUID of this VM */
|
||||
uint8_t uuid[16];
|
||||
/** the name of this VM */
|
||||
uint8_t name[MAX_VM_NAME_LEN];
|
||||
|
||||
/* VM flag bits from Guest OS, now used
|
||||
* GUEST_FLAG_SECURE_WORLD_ENABLED (1UL<<0)
|
||||
@@ -591,12 +594,9 @@ enum acrn_vm_load_order {
|
||||
MAX_LOAD_ORDER
|
||||
};
|
||||
|
||||
#define MAX_VM_OS_NAME_LEN 32U
|
||||
|
||||
struct acrn_vm_config_header {
|
||||
enum acrn_vm_load_order load_order;
|
||||
char name[MAX_VM_OS_NAME_LEN];
|
||||
const uint8_t uuid[16];
|
||||
char name[MAX_VM_NAME_LEN];
|
||||
uint8_t reserved[2];
|
||||
uint8_t severity;
|
||||
uint64_t cpu_affinity;
|
||||
|
||||
Reference in New Issue
Block a user