mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +00:00
HV: Introduce a new API is_rt_vm
This patch checks if the GUEST_FLAG_RT is set when GUEST_FLAG_LAPIC_PASSTHROUGH is set. If GUEST_FLAG_RT is not set while GUEST_FLAG_LAPIC_PASSTHROUGH is set, we will refuse to boot the VM. Meanwhile, this patch introduces a new API is_rt_vm. Tracked-On: #2865 Signed-off-by: Kaige Fu <kaige.fu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
committed by
ACRN System Integration
parent
2e4d7eb527
commit
ed286e3239
@@ -136,19 +136,26 @@ int32_t hcall_create_vm(struct acrn_vm *vm, uint64_t param)
|
||||
vm_config->guest_flags |= cv.vm_flag;
|
||||
(void)memcpy_s(&vm_config->GUID[0], 16U, &cv.GUID[0], 16U);
|
||||
|
||||
ret = create_vm(vm_id, vm_config, &target_vm);
|
||||
if (ret != 0) {
|
||||
dev_dbg(ACRN_DBG_HYCALL, "HCALL: Create VM failed");
|
||||
cv.vmid = ACRN_INVALID_VMID;
|
||||
/* GUEST_FLAG_RT must be set if we have GUEST_FLAG_LAPIC_PASSTHROUGH set in guest_flags */
|
||||
if (((vm_config->guest_flags & GUEST_FLAG_LAPIC_PASSTHROUGH) != 0U)
|
||||
&& ((vm_config->guest_flags & GUEST_FLAG_RT) == 0U)) {
|
||||
pr_err("Wrong guest flags 0x%llx\n", vm_config->guest_flags);
|
||||
ret = -1;
|
||||
} else {
|
||||
cv.vmid = target_vm->vm_id;
|
||||
ret = 0;
|
||||
}
|
||||
ret = create_vm(vm_id, vm_config, &target_vm);
|
||||
if (ret != 0) {
|
||||
dev_dbg(ACRN_DBG_HYCALL, "HCALL: Create VM failed");
|
||||
cv.vmid = ACRN_INVALID_VMID;
|
||||
ret = -1;
|
||||
} else {
|
||||
cv.vmid = target_vm->vm_id;
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
if (copy_to_gpa(vm, &cv.vmid, param, sizeof(cv.vmid)) != 0) {
|
||||
pr_err("%s: Unable copy param to vm\n", __func__);
|
||||
ret = -1;
|
||||
if (copy_to_gpa(vm, &cv.vmid, param, sizeof(cv.vmid)) != 0) {
|
||||
pr_err("%s: Unable copy param to vm\n", __func__);
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user