misc:remove some check related with UUID
Remove UUID checks since have removed UUID Tracked-On: #6685 Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
This commit is contained in:
parent
bb0327e700
commit
185e70ad78
|
@ -14,11 +14,6 @@
|
|||
#include <vpci.h>
|
||||
#include <hv_prebuild.h>
|
||||
|
||||
static uint8_t rtvm_uuids[][16] = {
|
||||
PRE_RTVM_UUID1,
|
||||
POST_RTVM_UUID1,
|
||||
};
|
||||
static uint8_t safety_vm_uuid1[16] = SAFETY_VM_UUID1;
|
||||
|
||||
/* sanity check for below structs is not needed, so use a empty struct instead */
|
||||
const struct pci_vdev_ops vhostbridge_ops;
|
||||
|
@ -27,55 +22,6 @@ const struct pci_vdev_ops vmcs9900_ops;
|
|||
|
||||
#define PLATFORM_CPUS_MASK ((1UL << MAX_PCPU_NUM) - 1UL)
|
||||
|
||||
/**
|
||||
* return true if the input uuid is for safety VM
|
||||
*/
|
||||
static bool is_safety_vm_uuid(const uint8_t *uuid)
|
||||
{
|
||||
/* TODO: Extend to check more safety VM uuid if we have more than one safety VM. */
|
||||
return uuid_is_equal(uuid, safety_vm_uuid1);
|
||||
}
|
||||
|
||||
/**
|
||||
* return true if the input uuid is for RTVM
|
||||
*/
|
||||
static bool is_rtvm_uuid(const uint8_t *uuid)
|
||||
{
|
||||
bool ret = false;
|
||||
uint16_t i;
|
||||
uint8_t *rtvm_uuid;
|
||||
|
||||
for (i = 0U; i < ARRAY_SIZE(rtvm_uuids); i++) {
|
||||
rtvm_uuid = rtvm_uuids[i];
|
||||
if (uuid_is_equal(uuid, rtvm_uuid)) {
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* return true if no UUID collision is found in vm configs array start from vm_configs[vm_id]
|
||||
*
|
||||
* @pre vm_id < CONFIG_MAX_VM_NUM
|
||||
*/
|
||||
static bool check_vm_uuid_collision(uint16_t vm_id)
|
||||
{
|
||||
uint16_t i;
|
||||
bool ret = true;
|
||||
struct acrn_vm_config *start_config = get_vm_config(vm_id);
|
||||
struct acrn_vm_config *following_config;
|
||||
|
||||
for (i = vm_id + 1U; i < CONFIG_MAX_VM_NUM; i++) {
|
||||
following_config = get_vm_config(i);
|
||||
if (uuid_is_equal(&start_config->uuid[0], &following_config->uuid[0])) {
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RDT_ENABLED
|
||||
static bool check_vm_clos_config(uint16_t vm_id)
|
||||
|
@ -113,7 +59,8 @@ bool sanitize_vm_config(void)
|
|||
for (vm_id = 0U; vm_id < CONFIG_MAX_VM_NUM; vm_id++) {
|
||||
vm_config = get_vm_config(vm_id);
|
||||
|
||||
if ((vm_config->cpu_affinity == 0UL) || ((vm_config->cpu_affinity & ~PLATFORM_CPUS_MASK) != 0UL)) {
|
||||
if ((vm_config->name[0] != '\0')
|
||||
&& ((vm_config->cpu_affinity == 0UL) || ((vm_config->cpu_affinity & ~PLATFORM_CPUS_MASK) != 0UL))) {
|
||||
printf("%s: vm%u assigns invalid PCPU (affinity: 0x%016x)\n", __func__, vm_id, vm_config->cpu_affinity);
|
||||
ret = false;
|
||||
}
|
||||
|
@ -126,16 +73,6 @@ bool sanitize_vm_config(void)
|
|||
ret = false;
|
||||
} else if (vm_config->epc.size != 0UL) {
|
||||
ret = false;
|
||||
} else if (is_safety_vm_uuid(vm_config->uuid) && (vm_config->severity != (uint8_t)SEVERITY_SAFETY_VM)) {
|
||||
ret = false;
|
||||
} else {
|
||||
#if (SERVICE_VM_NUM == 1U)
|
||||
if (vm_config->severity <= SEVERITY_SERVICE_VM) {
|
||||
/* If there are both Service VM and Pre-launched VM, make sure pre-launched VM has higher severity than Service VM */
|
||||
printf("%s: pre-launched vm doesn't has higher severity than Service VM \n", __func__);
|
||||
ret = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case SERVICE_VM:
|
||||
|
@ -150,18 +87,6 @@ bool sanitize_vm_config(void)
|
|||
break;
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
/* VM with RTVM uuid must have RTVM severity */
|
||||
if (is_rtvm_uuid(vm_config->uuid) && (vm_config->severity != (uint8_t)SEVERITY_RTVM)) {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
/* VM WITHOUT RTVM uuid must NOT have RTVM severity */
|
||||
if (!is_rtvm_uuid(vm_config->uuid) && (vm_config->severity == (uint8_t)SEVERITY_RTVM)) {
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RDT_ENABLED
|
||||
if (ret) {
|
||||
ret = check_vm_clos_config(vm_id);
|
||||
|
@ -173,11 +98,6 @@ bool sanitize_vm_config(void)
|
|||
ret = false;
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
/* make sure no identical UUID in following VM configurations */
|
||||
ret = check_vm_uuid_collision(vm_id);
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
/* vuart[1+] are used for VM communications */
|
||||
for (vuart_idx = 1U; vuart_idx < MAX_VUART_NUM_PER_VM; vuart_idx++) {
|
||||
|
|
Loading…
Reference in New Issue