Skip to content

Commit

Permalink
HV: Add has_rt_vm API
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Yuan Liu <[email protected]>
Reviewed-by: Li, Fei1 <[email protected]>
  • Loading branch information
yliu80 authored and acrnsi committed Jun 20, 2019
1 parent 7018a13 commit ea699af
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions hypervisor/arch/x86/guest/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
1 change: 1 addition & 0 deletions hypervisor/include/arch/x86/guest/vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ea699af

Please sign in to comment.