Skip to content

Commit f2fe354

Browse files
jsun26intelacrnsi
authored andcommitted
HV: remove mptable in vm_config
Define a static mptable array and each VM could index its vmptable by vm id, then mptable is not needed in vm configurations; Tracked-On: #2291 Signed-off-by: Victor Sun <victor.sun@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
1 parent 26c7e37 commit f2fe354

File tree

4 files changed

+3
-9
lines changed

4 files changed

+3
-9
lines changed

hypervisor/arch/x86/configs/vm_config.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ bool sanitize_vm_config(void)
8989
} else if (((vm_config->guest_flags & GUEST_FLAG_LAPIC_PASSTHROUGH) != 0U)
9090
&& ((vm_config->guest_flags & GUEST_FLAG_RT) == 0U)) {
9191
ret = false;
92-
} else if (vm_config->mptable == NULL) {
93-
ret = false;
9492
} else {
9593
pre_launch_pcpu_bitmap |= vm_config->pcpu_bitmap;
9694
}

hypervisor/dm/vmptable.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <mptable.h>
1010
#include <default_acpi_info.h>
1111

12+
static struct mptable_info vm_mptables[CONFIG_MAX_VM_NUM];
13+
1214
static struct mptable_info mptable_template = {
1315
.mpfp = {
1416
.signature = MPFP_SIG,
@@ -80,7 +82,6 @@ static uint8_t mpt_compute_checksum(void *base, size_t len)
8082
/**
8183
* @pre vm != NULL
8284
* @pre vm->vm_id < CONFIG_MAX_VM_NUM
83-
* @pre vm_configs[vm->vm_id].mptable != NULL
8485
*/
8586
int32_t mptable_build(struct acrn_vm *vm)
8687
{
@@ -96,7 +97,7 @@ int32_t mptable_build(struct acrn_vm *vm)
9697
struct acrn_vm_config *vm_config;
9798

9899
vm_config = get_vm_config(vm->vm_id);
99-
mptable = vm_config->mptable;
100+
mptable = &vm_mptables[vm->vm_id];
100101
vcpu_num = vm_config->cpu_num;
101102
pcpu_bitmap = vm_config->pcpu_bitmap;
102103
(void *)memcpy_s((void *)mptable, sizeof(struct mptable_info),

hypervisor/include/arch/x86/vm_config.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ struct acrn_vm_config {
8989
uint16_t clos; /* if guest_flags has GUEST_FLAG_CLOS_REQUIRED, then VM use this CLOS */
9090

9191
struct vuart_config vuart[MAX_VUART_NUM_PER_VM];/* vuart configuration for VM */
92-
struct mptable_info *mptable; /* Pointer to mptable struct if VM type is pre-launched */
9392
} __aligned(8);
9493

9594
struct acrn_vm_config *get_vm_config(uint16_t vm_id);

hypervisor/scenarios/logical_partition/vm_configurations.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
extern struct acrn_vm_pci_ptdev_config vm0_pci_ptdevs[VM0_CONFIG_PCI_PTDEV_NUM];
1111
extern struct acrn_vm_pci_ptdev_config vm1_pci_ptdevs[VM1_CONFIG_PCI_PTDEV_NUM];
1212

13-
static struct mptable_info vm_mptables[CONFIG_MAX_VM_NUM];
14-
1513
struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
1614
{ /* VM0 */
1715
.load_order = PRE_LAUNCHED_VM,
@@ -49,7 +47,6 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
4947
},
5048
.pci_ptdev_num = VM0_CONFIG_PCI_PTDEV_NUM,
5149
.pci_ptdevs = vm0_pci_ptdevs,
52-
.mptable = &vm_mptables[0],
5350
},
5451
{ /* VM1 */
5552
.load_order = PRE_LAUNCHED_VM,
@@ -88,6 +85,5 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
8885
},
8986
.pci_ptdev_num = VM1_CONFIG_PCI_PTDEV_NUM,
9087
.pci_ptdevs = vm1_pci_ptdevs,
91-
.mptable = &vm_mptables[1],
9288
},
9389
};

0 commit comments

Comments
 (0)