Skip to content

Commit

Permalink
Merge pull request #202 from ntkme/hv_vm_create-errors
Browse files Browse the repository at this point in the history
Log the error if hv_vm_create fails
  • Loading branch information
jeremyhu authored Sep 22, 2021
2 parents df93818 + 6aeeeb8 commit d53a8bd
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/vmm/intel/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,31 @@ static int
vmx_init(void)
{
int error = hv_vm_create(HV_VM_DEFAULT);
if (error) {
if (error == HV_NO_DEVICE) {
switch (error) {
case HV_SUCCESS:
break;
case HV_ERROR:
/* Don't know if this can happen, report to us */
xhyve_abort("hv_vm_create HV_ERROR\n");
case HV_BUSY:
/* Should never happen, report to us (perhaps we need to retry) */
xhyve_abort("hv_vm_create HV_BUSY\n");
case HV_BAD_ARGUMENT:
/* Should never happen, report to Apple */
xhyve_abort("hv_vm_create HV_BAD_ARGUMENT\n");
case HV_NO_RESOURCES:
/* Don't know if this can happen, report to us */
xhyve_abort("hv_vm_create HV_NO_RESOURCES\n");
case HV_NO_DEVICE:
printf("vmx_init: processor not supported by "
"Hypervisor.framework\n");
return (error);
}
else
xhyve_abort("hv_vm_create failed\n");
case HV_UNSUPPORTED:
/* Don't know if this can happen, report to us */
xhyve_abort("hv_vm_create HV_UNSUPPORTED\n");
default:
/* Should never happen, report to Apple */
xhyve_abort("hv_vm_create unknown error %d\n", error);
}

/*
Expand Down

0 comments on commit d53a8bd

Please sign in to comment.