diff --git a/hypervisor/arch/x86/guest/splitlock.c b/hypervisor/arch/x86/guest/splitlock.c index 09bcace47..a3f825747 100644 --- a/hypervisor/arch/x86/guest/splitlock.c +++ b/hypervisor/arch/x86/guest/splitlock.c @@ -31,7 +31,7 @@ void vcpu_kick_splitlock_emulation(struct acrn_vcpu *cur_vcpu) uint16_t i; if (cur_vcpu->vm->hw.created_vcpus > 1U) { - get_vm_lock(cur_vcpu->vm); + get_split_lock(cur_vcpu->vm); foreach_vcpu(i, cur_vcpu->vm, other) { if (other != cur_vcpu) { @@ -53,7 +53,7 @@ void vcpu_complete_splitlock_emulation(struct acrn_vcpu *cur_vcpu) } } - put_vm_lock(cur_vcpu->vm); + put_split_lock(cur_vcpu->vm); } } diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index 5b8672938..efe355a7f 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -1088,3 +1088,13 @@ void put_vm_lock(struct acrn_vm *vm) { spinlock_release(&vm->vm_state_lock); } + +void get_split_lock(struct acrn_vm *vm) +{ + spinlock_obtain(&vm->split_lock); +} + +void put_split_lock(struct acrn_vm *vm) +{ + spinlock_release(&vm->split_lock); +} diff --git a/hypervisor/include/arch/x86/asm/guest/vm.h b/hypervisor/include/arch/x86/asm/guest/vm.h index 1d2d64c5b..74065db25 100644 --- a/hypervisor/include/arch/x86/asm/guest/vm.h +++ b/hypervisor/include/arch/x86/asm/guest/vm.h @@ -149,6 +149,7 @@ struct acrn_vm { * the initialization depends on the clear BSS section */ spinlock_t vm_state_lock; + spinlock_t split_lock; spinlock_t vlapic_mode_lock; /* Spin-lock used to protect vlapic_mode modifications for a VM */ spinlock_t ept_lock; /* Spin-lock used to protect ept add/modify/remove for a VM */ spinlock_t emul_mmio_lock; /* Used to protect emulation mmio_node concurrent access for a VM */ @@ -274,6 +275,10 @@ void get_vm_lock(struct acrn_vm *vm); void put_vm_lock(struct acrn_vm *vm); void *get_sworld_memory_base(void); + +void get_split_lock(struct acrn_vm *vm); +void put_split_lock(struct acrn_vm *vm); + #endif /* !ASSEMBLER */ #endif /* VM_H_ */