hv: Build mptable for guest if VM type is Pre-Launched

ACRN builds mptable for pre-launched VMs. It uses CONFIG_PARTITION_MODE
to compile mptable source code and related support. This patch removes
the macro and checks if the type of VM is pre-launched to build mptable.

Tracked-On: #2941
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Sainath Grandhi
2019-04-05 11:26:02 -07:00
committed by Eddie Dong
parent 869de39757
commit 16a2af5715
9 changed files with 24 additions and 40 deletions

View File

@@ -91,6 +91,8 @@ bool sanitize_vm_config(void)
} else if (((vm_config->guest_flags & GUEST_FLAG_LAPIC_PASSTHROUGH) != 0U)
&& ((vm_config->guest_flags & GUEST_FLAG_RT) == 0U)) {
ret = false;
} else if (vm_config->mptable == NULL) {
ret = false;
} else {
pre_launch_pcpu_bitmap |= vm_config->pcpu_bitmap;
}

View File

@@ -145,26 +145,6 @@ static inline uint16_t get_vm_bsp_pcpu_id(const struct acrn_vm_config *vm_config
return (cpu_id < get_pcpu_nums()) ? cpu_id : INVALID_CPU_ID;
}
#ifdef CONFIG_PARTITION_MODE
/**
* @pre vm_config != NULL
*/
uint16_t get_vm_pcpu_nums(const struct acrn_vm_config *vm_config)
{
uint16_t i, host_pcpu_num, pcpu_num = 0U;
uint64_t cpu_bitmap = vm_config->pcpu_bitmap;
host_pcpu_num = get_pcpu_nums();
for (i = 0U; i < host_pcpu_num ; i++) {
if (bitmap_test(i, &cpu_bitmap)) {
pcpu_num++;
}
}
return pcpu_num;
}
#endif
/**
* @pre vm != NULL && vm_config != NULL
*/
@@ -635,9 +615,9 @@ void prepare_vm(uint16_t vm_id, struct acrn_vm_config *vm_config)
err = create_vm(vm_id, vm_config, &vm);
if (err == 0) {
#ifdef CONFIG_PARTITION_MODE
(void)mptable_build(vm);
#endif
if (is_prelaunched_vm(vm)) {
(void)mptable_build(vm);
}
for (i = 0U; i < get_pcpu_nums(); i++) {
if (bitmap_test(i, &vm_config->pcpu_bitmap)) {