VirtualBox

Changeset 106761 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Oct 28, 2024 8:57:07 PM (4 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
165646
Message:

VMM/NEM-darwin/arm64: Translate the HV_xxxx status code to a string in the error message. Set error message should we fail to load the Hypervisor framework. Better logging wrt optional functions that aren't found. jiraref:VBP-1253

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/NEMR3Native-darwin-armv8.cpp

    r106743 r106761  
    604604
    605605    return VERR_IPE_UNEXPECTED_STATUS;
     606}
     607
     608
     609/** Puts a name to a hypervisor framework status code. */
     610static const char *nemR3DarwinHvStatusName(hv_return_t hrc)
     611{
     612    switch (hrc)
     613    {
     614        RT_CASE_RET_STR(HV_SUCCESS);
     615        RT_CASE_RET_STR(HV_ERROR);
     616        RT_CASE_RET_STR(HV_BUSY);
     617        RT_CASE_RET_STR(HV_BAD_ARGUMENT);
     618        RT_CASE_RET_STR(HV_ILLEGAL_GUEST_STATE);
     619        RT_CASE_RET_STR(HV_NO_RESOURCES);
     620        RT_CASE_RET_STR(HV_NO_DEVICE);
     621        RT_CASE_RET_STR(HV_DENIED);
     622        RT_CASE_RET_STR(HV_UNSUPPORTED);
     623    }
     624    return "";
    606625}
    607626
     
    10641083            int rc2 = RTLdrGetSymbol(hMod, g_aImports[i].pszName, (void **)g_aImports[i].ppfn);
    10651084            if (RT_SUCCESS(rc2))
    1066             {
    1067                 LogRel(("NEM:  info: Found optional import Hypervisor!%s.\n",
    1068                         g_aImports[i].pszName));
    1069             }
     1085                LogRel(("NEM:  info: Found optional import Hypervisor!%s.\n", g_aImports[i].pszName));
    10701086            else
    10711087            {
    10721088                *g_aImports[i].ppfn = NULL;
    1073 
    1074                 LogRel(("NEM:  info: Failed to import Hypervisor!%s: %Rrc\n",
    1075                         g_aImports[i].pszName, rc2));
     1089                LogRel(("NEM:  info: Optional import Hypervisor!%s not found: %Rrc\n", g_aImports[i].pszName, rc2));
    10761090            }
    10771091        }
    1078         if (RT_SUCCESS(rc))
    1079         {
    1080             Assert(!RTErrInfoIsSet(pErrInfo));
    1081         }
    1082 
     1092        Assert(RT_SUCCESS(rc) && !RTErrInfoIsSet(pErrInfo));
    10831093        RTLdrClose(hMod);
    10841094    }
     
    12431253    int rc = nemR3DarwinLoadHv(pErrInfo);
    12441254    if (RT_FAILURE(rc))
     1255    {
     1256        if ((fForced || !fFallback) && RTErrInfoIsSet(pErrInfo))
     1257            return VMSetError(pVM, rc, RT_SRC_POS, "%s", pErrInfo->pszMsg);
    12451258        return rc;
     1259    }
    12461260
    12471261    /*
     
    12501264     */
    12511265    PCFGMNODE pCfgCpum = CFGMR3GetChild(CFGMR3GetRoot(pVM), "CPUM/");
     1266
    12521267    hv_vm_config_t hVmCfg = NULL;
    1253 
    12541268    if (   hv_vm_config_create
    12551269        && hv_vm_config_get_el2_supported)
     
    12741288                if (hrc != HV_SUCCESS)
    12751289                    return VMSetError(pVM, VERR_CPUM_INVALID_HWVIRT_CONFIG, RT_SRC_POS,
    1276                                       "Cannot enable nested virtualization (hrc=%#x)!\n", hrc);
    1277                 else
    1278                 {
    1279                     pVM->nem.s.fEl2Enabled = true;
    1280                     LogRel(("NEM: Enabled nested virtualization (EL2) support\n"));
    1281                 }
     1290                                      "Cannot enable nested virtualization: hrc=%#x %s!\n", hrc, nemR3DarwinHvStatusName(hrc));
     1291                pVM->nem.s.fEl2Enabled = true;
     1292                LogRel(("NEM: Enabled nested virtualization (EL2) support\n"));
    12821293            }
    12831294        }
     
    13111322        Log(("NEM: Marked active!\n"));
    13121323        PGMR3EnableNemMode(pVM);
    1313     }
    1314     else
    1315         rc = RTErrInfoSetF(pErrInfo, VERR_NEM_INIT_FAILED,
    1316                            "hv_vm_create() failed: %#x", hrc);
     1324        return VINF_SUCCESS;
     1325    }
     1326
     1327    rc = RTErrInfoSetF(pErrInfo, VERR_NEM_INIT_FAILED, "hv_vm_create() failed: %#x %s", hrc, nemR3DarwinHvStatusName(hrc));
    13171328
    13181329    /*
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette