mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-03 04:39:50 +00:00
HV: Kconfig: remove MAX_VCPUS_PER_VM in Kconfig
In current architecutre, the maximum vCPUs number per VM could not exceed the pCPUs number. Given the MAX_PCPU_NUM macro is provided in board configurations, so remove the MAX_VCPUS_PER_VM from Kconfig and add a macro of MAX_VCPUS_PER_VM to reference MAX_PCPU_NUM directly. Tracked-On: #4230 Signed-off-by: Victor Sun <victor.sun@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
0ba8434838
commit
a44c1c900c
@ -76,14 +76,6 @@ config RELEASE
|
||||
console and hypervisor shell are available only in non-release
|
||||
(i.e. debug) builds. Assertions are not effective in release builds.
|
||||
|
||||
config MAX_VCPUS_PER_VM
|
||||
int "Maximum number of VCPUs per VM"
|
||||
range 1 48
|
||||
default 8
|
||||
help
|
||||
The maximum number of virtual CPUs the hypervisor can support in a
|
||||
single VM.
|
||||
|
||||
config MAX_EMULATED_MMIO_REGIONS
|
||||
int "Maximum number of emulated MMIO regions"
|
||||
range 0 128
|
||||
|
@ -262,7 +262,7 @@ hyperv_init_vcpuid_entry(uint32_t leaf, uint32_t subleaf, uint32_t flags,
|
||||
entry->edx = 0U;
|
||||
break;
|
||||
case 0x40000005U: /* HV Maximum Supported Virtual & logical Processors */
|
||||
entry->eax = CONFIG_MAX_VCPUS_PER_VM;
|
||||
entry->eax = MAX_VCPUS_PER_VM;
|
||||
entry->ebx = 0U;
|
||||
entry->ecx = 0U;
|
||||
entry->edx = 0U;
|
||||
|
@ -412,7 +412,7 @@ int32_t create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn
|
||||
* vm->hw.created_vcpus++;
|
||||
*/
|
||||
vcpu_id = vm->hw.created_vcpus;
|
||||
if (vcpu_id < CONFIG_MAX_VCPUS_PER_VM) {
|
||||
if (vcpu_id < MAX_VCPUS_PER_VM) {
|
||||
/* Allocate memory for VCPU */
|
||||
vcpu = &(vm->hw.vcpu_array[vcpu_id]);
|
||||
(void)memset((void *)vcpu, 0U, sizeof(struct acrn_vcpu));
|
||||
@ -443,7 +443,7 @@ int32_t create_vcpu(uint16_t pcpu_id, struct acrn_vm *vm, struct acrn_vcpu **rtn
|
||||
*
|
||||
* This assignment guarantees a unique non-zero per vcpu vpid in runtime.
|
||||
*/
|
||||
vcpu->arch.vpid = 1U + (vm->vm_id * CONFIG_MAX_VCPUS_PER_VM) + vcpu->vcpu_id;
|
||||
vcpu->arch.vpid = 1U + (vm->vm_id * MAX_VCPUS_PER_VM) + vcpu->vcpu_id;
|
||||
|
||||
/* Initialize exception field in VCPU context */
|
||||
vcpu->arch.exception_info.exception = VECTOR_INVALID;
|
||||
|
@ -1685,7 +1685,7 @@ vlapic_reset(struct acrn_vlapic *vlapic, const struct acrn_apicv_ops *ops)
|
||||
|
||||
/**
|
||||
* @pre vlapic->vm != NULL
|
||||
* @pre vlapic->vcpu->vcpu_id < CONFIG_MAX_VCPUS_PER_VM
|
||||
* @pre vlapic->vcpu->vcpu_id < MAX_VCPUS_PER_VM
|
||||
*/
|
||||
void
|
||||
vlapic_init(struct acrn_vlapic *vlapic)
|
||||
|
@ -120,7 +120,7 @@ int32_t hcall_get_platform_info(struct acrn_vm *vm, uint64_t param)
|
||||
struct hc_platform_info platform_info;
|
||||
|
||||
platform_info.cpu_num = get_pcpu_nums();
|
||||
platform_info.max_vcpus_per_vm = CONFIG_MAX_VCPUS_PER_VM;
|
||||
platform_info.max_vcpus_per_vm = MAX_VCPUS_PER_VM;
|
||||
platform_info.max_kata_containers = CONFIG_MAX_KATA_VM_NUM;
|
||||
if (copy_to_gpa(vm, &platform_info, param, sizeof(platform_info)) != 0) {
|
||||
pr_err("%s: Unable copy param to vm\n", __func__);
|
||||
@ -317,7 +317,7 @@ int32_t hcall_set_vcpu_regs(struct acrn_vm *vm, uint16_t vmid, uint64_t param)
|
||||
(target_vm->state != VM_STARTED)) {
|
||||
if (copy_from_gpa(vm, &vcpu_regs, param, sizeof(vcpu_regs)) != 0) {
|
||||
pr_err("%s: Unable copy param to vm\n", __func__);
|
||||
} else if (vcpu_regs.vcpu_id >= CONFIG_MAX_VCPUS_PER_VM) {
|
||||
} else if (vcpu_regs.vcpu_id >= MAX_VCPUS_PER_VM) {
|
||||
pr_err("%s: invalid vcpu_id for set_vcpu_regs\n", __func__);
|
||||
} else {
|
||||
vcpu = vcpu_from_vid(target_vm, vcpu_regs.vcpu_id);
|
||||
@ -548,7 +548,7 @@ int32_t hcall_notify_ioreq_finish(uint16_t vmid, uint16_t vcpu_id)
|
||||
dev_dbg(ACRN_DBG_HYCALL, "[%d] NOTIFY_FINISH for vcpu %d",
|
||||
vmid, vcpu_id);
|
||||
|
||||
if (vcpu_id >= CONFIG_MAX_VCPUS_PER_VM) {
|
||||
if (vcpu_id >= MAX_VCPUS_PER_VM) {
|
||||
pr_err("%s, failed to get VCPU %d context from VM %d\n",
|
||||
__func__, vcpu_id, target_vm->vm_id);
|
||||
} else {
|
||||
|
@ -191,7 +191,7 @@ void vlapic_create(struct acrn_vcpu *vcpu);
|
||||
void vlapic_free(struct acrn_vcpu *vcpu);
|
||||
/**
|
||||
* @pre vlapic->vm != NULL
|
||||
* @pre vlapic->vcpu->vcpu_id < CONFIG_MAX_VCPUS_PER_VM
|
||||
* @pre vlapic->vcpu->vcpu_id < MAX_VCPUS_PER_VM
|
||||
*/
|
||||
void vlapic_init(struct acrn_vlapic *vlapic);
|
||||
void vlapic_reset(struct acrn_vlapic *vlapic, const struct acrn_apicv_ops *ops);
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
struct vm_hw_info {
|
||||
/* vcpu array of this VM */
|
||||
struct acrn_vcpu vcpu_array[CONFIG_MAX_VCPUS_PER_VM];
|
||||
struct acrn_vcpu vcpu_array[MAX_VCPUS_PER_VM];
|
||||
uint16_t created_vcpus; /* Number of created vcpus */
|
||||
} __aligned(PAGE_SIZE);
|
||||
|
||||
@ -165,7 +165,7 @@ static inline uint64_t vm_active_cpus(const struct acrn_vm *vm)
|
||||
}
|
||||
|
||||
/*
|
||||
* @pre vcpu_id < CONFIG_MAX_VCPUS_PER_VM
|
||||
* @pre vcpu_id < MAX_VCPUS_PER_VM
|
||||
* @pre &(vm->hw.vcpu_array[vcpu_id])->state != VCPU_OFFLINE
|
||||
*/
|
||||
static inline struct acrn_vcpu *vcpu_from_vid(struct acrn_vm *vm, uint16_t vcpu_id)
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <sgx.h>
|
||||
|
||||
#define AFFINITY_CPU(n) (1U << (n))
|
||||
#define MAX_VCPUS_PER_VM MAX_PCPU_NUM
|
||||
#define MAX_VUART_NUM_PER_VM 2U
|
||||
#define MAX_VM_OS_NAME_LEN 32U
|
||||
#define MAX_MOD_TAG_LEN 32U
|
||||
@ -99,7 +100,7 @@ struct acrn_vm_config {
|
||||
const uint8_t uuid[16]; /* UUID of the VM */
|
||||
uint16_t vcpu_num; /* Number of vCPUs for the VM */
|
||||
|
||||
uint64_t vcpu_affinity[CONFIG_MAX_VCPUS_PER_VM];/* bitmaps for vCPUs' affinity */
|
||||
uint64_t vcpu_affinity[MAX_VCPUS_PER_VM];/* bitmaps for vCPUs' affinity */
|
||||
uint64_t guest_flags; /* VM flags that we want to configure for guest
|
||||
* Now we have two flags:
|
||||
* GUEST_FLAG_SECURE_WORLD_ENABLED
|
||||
|
@ -10,6 +10,7 @@
|
||||
#ifdef PROFILING_ON
|
||||
|
||||
#include <vcpu.h>
|
||||
#include <vm_config.h>
|
||||
#include <vm_configurations.h>
|
||||
|
||||
#define MAX_MSR_LIST_NUM 15U
|
||||
@ -114,7 +115,7 @@ struct profiling_vm_info {
|
||||
uint8_t uuid[16];
|
||||
char vm_name[16];
|
||||
uint16_t num_vcpus;
|
||||
struct profiling_vcpu_pcpu_map cpu_map[CONFIG_MAX_VCPUS_PER_VM];
|
||||
struct profiling_vcpu_pcpu_map cpu_map[MAX_VCPUS_PER_VM];
|
||||
};
|
||||
|
||||
struct profiling_vm_info_list {
|
||||
|
@ -16,7 +16,7 @@
|
||||
typedef int32_t CAT_(CTA_DummyType,__LINE__)[(expr) ? 1 : -1]
|
||||
|
||||
/* This is to make sure the 16 bits vpid won't overflow */
|
||||
#if ((CONFIG_MAX_VM_NUM * CONFIG_MAX_VCPUS_PER_VM) > 0xffffU)
|
||||
#if ((CONFIG_MAX_VM_NUM * MAX_VCPUS_PER_VM) > 0xffffU)
|
||||
#error "VM number or VCPU number are too big"
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user