Skip to content

Commit ea699af

Browse files
yliu80acrnsi
authored andcommitted
HV: Add has_rt_vm API
The has_rt_vm walk through all VMs to check RT VM flag and if there is no any RT VM, then return false otherwise return true. Signed-off-by: Jack Ren <jack.ren@intel.com> Signed-off-by: Yuan Liu <yuan1.liu@intel.com> Reviewed-by: Li, Fei1 <fei1.li@intel.com>
1 parent 7018a13 commit ea699af

File tree

2 files changed

+17
-0
lines changed
  • hypervisor
    • arch/x86/guest
    • include/arch/x86/guest

2 files changed

+17
-0
lines changed

hypervisor/arch/x86/guest/vm.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,3 +854,19 @@ enum vm_vlapic_state check_vm_vlapic_state(const struct acrn_vm *vm)
854854
vlapic_state = vm->arch_vm.vlapic_state;
855855
return vlapic_state;
856856
}
857+
858+
/**
859+
* if there is RT VM return true otherwise return false.
860+
*/
861+
bool has_rt_vm(void)
862+
{
863+
uint16_t vm_id;
864+
865+
for (vm_id = 0U; vm_id < CONFIG_MAX_VM_NUM; vm_id++) {
866+
if (is_rt_vm(get_vm_from_vmid(vm_id))) {
867+
break;
868+
}
869+
}
870+
871+
return ((vm_id == CONFIG_MAX_VM_NUM) ? false : true);
872+
}

hypervisor/include/arch/x86/guest/vm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ void vrtc_init(struct acrn_vm *vm);
224224

225225
bool is_lapic_pt_configured(const struct acrn_vm *vm);
226226
bool is_rt_vm(const struct acrn_vm *vm);
227+
bool has_rt_vm(void);
227228
bool is_highest_severity_vm(const struct acrn_vm *vm);
228229
bool vm_hide_mtrr(const struct acrn_vm *vm);
229230
void update_vm_vlapic_state(struct acrn_vm *vm);

0 commit comments

Comments
 (0)