Skip to content

Commit a8fcc0f

Browse files
Sainath Grandhilijinxia
authored andcommitted
HV: Add vm_id entry to VM description in partitioning mode
ACRN boots multiple OS in partitioning mode. This patch adds code to assign vm_id in the vm data structure to be same as the one assigned at compile time. This makes the vm id deterministic for each VM booted from HV directly. Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
1 parent d0e9f24 commit a8fcc0f

File tree

1 file changed

+8
-0
lines changed
  • hypervisor/arch/x86/guest

1 file changed

+8
-0
lines changed

hypervisor/arch/x86/guest/vm.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ spinlock_t vm_list_lock = {
2222
.tail = 0U
2323
};
2424

25+
#ifndef CONFIG_PARTITION_MODE
2526
/* used for vmid allocation. And this means the max vm number is 64 */
2627
static uint64_t vmid_bitmap;
2728

@@ -43,6 +44,7 @@ static inline void free_vm_id(struct vm *vm)
4344
{
4445
bitmap_clear_lock(vm->vm_id, &vmid_bitmap);
4546
}
47+
#endif
4648

4749
static void init_vm(struct vm_description *vm_desc,
4850
struct vm *vm_handle)
@@ -120,12 +122,16 @@ int create_vm(struct vm_description *vm_desc, struct vm **rtn_vm)
120122
goto err;
121123
}
122124

125+
#ifdef CONFIG_PARTITION_MODE
126+
vm->vm_id = vm_desc->vm_id;
127+
#else
123128
vm->vm_id = alloc_vm_id();
124129
if (vm->vm_id == INVALID_VM_ID) {
125130
pr_err("%s, no more VMs can be supported\n", __func__);
126131
status = -ENODEV;
127132
goto err;
128133
}
134+
#endif
129135

130136
atomic_store16(&vm->hw.created_vcpus, 0U);
131137

@@ -291,8 +297,10 @@ int shutdown_vm(struct vm *vm)
291297
destroy_iommu_domain(vm->iommu);
292298
}
293299

300+
#ifndef CONFIG_PARTITION_MODE
294301
/* Free vm id */
295302
free_vm_id(vm);
303+
#endif
296304

297305
if (vm->vpic != NULL) {
298306
vpic_cleanup(vm);

0 commit comments

Comments
 (0)