diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index f720528b2..f1d99a183 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -60,6 +60,16 @@ bool is_sos_vm(const struct acrn_vm *vm) return (vm != NULL) && (vm == sos_vm_ptr); } +/** + * @pre vm != NULL && vm_config != NULL && vm->vmid < CONFIG_MAX_VM_NUM + */ +bool is_lapic_pt(const struct acrn_vm *vm) +{ + struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id); + + return ((vm_config->guest_flags & LAPIC_PASSTHROUGH) != 0U); +} + /** * @brief Initialize the I/O bitmap for \p vm * diff --git a/hypervisor/include/arch/x86/guest/vm.h b/hypervisor/include/arch/x86/guest/vm.h index 0f2007160..56e04f82f 100644 --- a/hypervisor/include/arch/x86/guest/vm.h +++ b/hypervisor/include/arch/x86/guest/vm.h @@ -244,10 +244,7 @@ uint16_t get_vm_pcpu_nums(const struct acrn_vm_config *vm_config); void vrtc_init(struct acrn_vm *vm); #endif -static inline bool is_lapic_pt(const struct acrn_vm *vm) -{ - return ((vm_configs[vm->vm_id].guest_flags & LAPIC_PASSTHROUGH) != 0U); -} +bool is_lapic_pt(const struct acrn_vm *vm); #endif /* !ASSEMBLER */