mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-20 12:42:54 +00:00
This patch will move the VM configuration check to pre-build stage, a test program will do the check for pre-defined VM configuration data before making hypervisor binary. If test failed, the make process will be aborted. So once the hypervisor binary is built successfully or start to run, it means the VM configuration has been sanitized. The patch did not add any new VM configuration check function, it just port the original sanitize_vm_config() function from cpu.c to static_checks.c with below change: 1. remove runtime rdt detection for clos check; 2. replace pr_err() from logmsg.h with printf() from stdio.h; 3. replace runtime call get_pcpu_nums() in ALL_CPUS_MASK macro with static defined MAX_PCPU_NUM; 4. remove cpu_affinity check since pre-launched VM might share pcpu with SOS VM; The BOARD/SCENARIO parameter check and configuration folder check is also moved to prebuild Makefile. Tracked-On: #5077 Signed-off-by: Victor Sun <victor.sun@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
47 lines
1000 B
C
47 lines
1000 B
C
/*
|
|
* Copyright (C) 2018 Intel Corporation. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <vm_config.h>
|
|
|
|
/*
|
|
* @pre vm_id < CONFIG_MAX_VM_NUM
|
|
* @post return != NULL
|
|
*/
|
|
struct acrn_vm_config *get_vm_config(uint16_t vm_id)
|
|
{
|
|
return &vm_configs[vm_id];
|
|
}
|
|
|
|
/*
|
|
* @pre vm_id < CONFIG_MAX_VM_NUM
|
|
*/
|
|
uint8_t get_vm_severity(uint16_t vm_id)
|
|
{
|
|
return vm_configs[vm_id].severity;
|
|
}
|
|
|
|
bool uuid_is_equal(const uint8_t *uuid1, const uint8_t *uuid2)
|
|
{
|
|
uint64_t uuid1_h = *(const uint64_t *)uuid1;
|
|
uint64_t uuid1_l = *(const uint64_t *)(uuid1 + 8);
|
|
uint64_t uuid2_h = *(const uint64_t *)uuid2;
|
|
uint64_t uuid2_l = *(const uint64_t *)(uuid2 + 8);
|
|
|
|
return ((uuid1_h == uuid2_h) && (uuid1_l == uuid2_l));
|
|
}
|
|
|
|
/**
|
|
* return true if the input uuid is configured in VM
|
|
*
|
|
* @pre vmid < CONFIG_MAX_VM_NUM
|
|
*/
|
|
bool vm_has_matched_uuid(uint16_t vmid, const uint8_t *uuid)
|
|
{
|
|
struct acrn_vm_config *vm_config = get_vm_config(vmid);
|
|
|
|
return (uuid_is_equal(vm_config->uuid, uuid));
|
|
}
|