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>
This commit is contained in:
Yuan Liu 2019-06-18 17:26:09 +08:00 committed by ACRN System Integration
parent 7018a13cb6
commit ea699af861
2 changed files with 17 additions and 0 deletions

View File

@ -854,3 +854,19 @@ enum vm_vlapic_state check_vm_vlapic_state(const struct acrn_vm *vm)
vlapic_state = vm->arch_vm.vlapic_state;
return vlapic_state;
}
/**
* if there is RT VM return true otherwise return false.
*/
bool has_rt_vm(void)
{
uint16_t vm_id;
for (vm_id = 0U; vm_id < CONFIG_MAX_VM_NUM; vm_id++) {
if (is_rt_vm(get_vm_from_vmid(vm_id))) {
break;
}
}
return ((vm_id == CONFIG_MAX_VM_NUM) ? false : true);
}

View File

@ -224,6 +224,7 @@ void vrtc_init(struct acrn_vm *vm);
bool is_lapic_pt_configured(const struct acrn_vm *vm);
bool is_rt_vm(const struct acrn_vm *vm);
bool has_rt_vm(void);
bool is_highest_severity_vm(const struct acrn_vm *vm);
bool vm_hide_mtrr(const struct acrn_vm *vm);
void update_vm_vlapic_state(struct acrn_vm *vm);