VirtualBox

Changeset 45553 in vbox for trunk/src


Ignore:
Timestamp:
Apr 15, 2013 3:04:43 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
85039
Message:

ConsoleImpl2.cpp: Force HW-virt if 64-bit guest. Log force HW-virt decisions and some more.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r45367 r45553  
    872872        }
    873873
     874        if (fOsXGuest)
     875            InsertConfigInteger(pCPUM, "EnableHVP", 1);
     876
     877        /* Synthetic CPU */
     878        BOOL fSyntheticCpu = false;
     879        hrc = pMachine->GetCPUProperty(CPUPropertyType_Synthetic, &fSyntheticCpu);          H();
     880        InsertConfigInteger(pCPUM, "SyntheticCpu", fSyntheticCpu);
     881
     882        /* Physical Address Extension (PAE) */
     883        BOOL fEnablePAE = false;
     884        hrc = pMachine->GetCPUProperty(CPUPropertyType_PAE, &fEnablePAE);                   H();
     885        InsertConfigInteger(pRoot, "EnablePAE", fEnablePAE);
     886
     887
    874888        /*
    875889         * Hardware virtualization extensions.
    876890         */
     891        BOOL fIsGuest64Bit;
     892        hrc = guestOSType->COMGETTER(Is64Bit)(&fIsGuest64Bit);                              H();
     893        BOOL fSupportsLongMode;
     894        hrc = host->GetProcessorFeature(ProcessorFeature_LongMode, &fSupportsLongMode);     H();
     895        if (!fSupportsLongMode && fIsGuest64Bit)
     896        {
     897            LogRel(("WARNING! 64-bit guest type selected but the host CPU does NOT support 64-bit.\n"));
     898            fIsGuest64Bit = FALSE;
     899        }
     900
    877901        BOOL fHWVirtExEnabled;
    878         BOOL fHwVirtExtForced = false;
     902        hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_Enabled, &fHWVirtExEnabled); H();
     903        if (cCpus > 1 && !fHWVirtExEnabled)
     904        {
     905            LogRel(("Forced fHWVirtExEnabled to TRUE by SMP guest.\n"));
     906            fHWVirtExEnabled = TRUE;
     907        }
     908        if (!fHWVirtExEnabled && fIsGuest64Bit)
     909        {
     910            LogRel(("WARNING! 64-bit guest type selected on host without hardware virtualization (VT-x or AMD-V).\n"));
     911            fIsGuest64Bit = FALSE;
     912        }
     913
     914        BOOL fHwVirtExtForced;
    879915#ifdef VBOX_WITH_RAW_MODE
    880         hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_Enabled, &fHWVirtExEnabled); H();
    881         if (cCpus > 1) /** @todo SMP: This isn't nice, but things won't work on mac otherwise. */
    882             fHWVirtExEnabled = TRUE;
     916        /* - With more than 4GB PGM will use different RAMRANGE sizes for raw
     917             mode and hv mode to optimize lookup times.
     918           - With more than one virtual CPU, raw-mode isn't a fallback option.
     919           - With a 64-bit guest, raw-mode isn't a fallback option either. */
     920        fHwVirtExtForced = fHWVirtExEnabled
     921                        && (   cbRam + cbRamHole > _4G
     922                            || cCpus > 1
     923                            || fIsGuest64Bit);
    883924# ifdef RT_OS_DARWIN
    884925        fHwVirtExtForced = fHWVirtExEnabled;
    885 # else
    886         /* - With more than 4GB PGM will use different RAMRANGE sizes for raw
    887              mode and hv mode to optimize lookup times.
    888            - With more than one virtual CPU, raw-mode isn't a fallback option. */
    889         fHwVirtExtForced = fHWVirtExEnabled
    890                         && (   cbRam + cbRamHole > _4G
    891                             || cCpus > 1);
    892926# endif
     927        if (fHwVirtExtForced)
     928        {
     929            if (cbRam + cbRamHole > _4G)
     930                LogRel(("fHwVirtExtForced=TRUE - Lots of RAM\n"));
     931            if (cCpus > 1)
     932                LogRel(("fHwVirtExtForced=TRUE - SMP\n"));
     933            if (fIsGuest64Bit)
     934                LogRel(("fHwVirtExtForced=TRUE - 64-bit guest\n"));
     935# ifdef RT_OS_DARWIN
     936            LogRel(("fHwVirtExtForced=TRUE - Darwin host\n"));
     937# endif
     938        }
    893939#else  /* !VBOX_WITH_RAW_MODE */
    894         fHWVirtExEnabled = fHwVirtExtForced = true;
     940        fHWVirtExEnabled = fHwVirtExtForced = TRUE;
     941        LogRel(("fHwVirtExtForced=TRUE - No raw-mode support in this build!\n"));
    895942#endif /* !VBOX_WITH_RAW_MODE */
    896         /* only honor the property value if there was no other reason to enable it */
    897         if (!fHwVirtExtForced)
     943        if (!fHwVirtExtForced) /* No need to query if already forced above. */
    898944        {
    899945            hrc = pMachine->GetHWVirtExProperty(HWVirtExPropertyType_Force, &fHwVirtExtForced); H();
    900         }
    901         InsertConfigInteger(pRoot, "HwVirtExtForced",      fHwVirtExtForced);
    902 
    903 
    904         /*
    905          * MM values.
    906          */
    907         PCFGMNODE pMM;
    908         InsertConfigNode(pRoot, "MM", &pMM);
    909         InsertConfigInteger(pMM, "CanUseLargerHeap", chipsetType == ChipsetType_ICH9);
    910 
    911         /*
    912          * Hardware virtualization settings.
    913          */
    914         BOOL        fIsGuest64Bit = false;
    915         PCFGMNODE   pHWVirtExt;
     946            if (fHwVirtExtForced)
     947                LogRel(("fHwVirtExtForced=TRUE - HWVirtExPropertyType_Force\n"));
     948        }
     949        InsertConfigInteger(pRoot, "HwVirtExtForced", fHwVirtExtForced);
     950
     951        /* /HWVirtExt/xzy */
     952        PCFGMNODE pHWVirtExt;
    916953        InsertConfigNode(pRoot, "HWVirtExt", &pHWVirtExt);
     954        InsertConfigInteger(pHWVirtExt, "Enabled", fHWVirtExEnabled);
    917955        if (fHWVirtExEnabled)
    918956        {
    919             InsertConfigInteger(pHWVirtExt, "Enabled",     1);
    920 
    921957            /* Indicate whether 64-bit guests are supported or not. */
    922958            /** @todo This is currently only forced off on 32-bit hosts only because it
    923              *        makes a lof of difference there (REM and Solaris performance).
    924              */
    925             BOOL fSupportsLongMode = false;
    926             hrc = host->GetProcessorFeature(ProcessorFeature_LongMode,
    927                                             &fSupportsLongMode);                            H();
    928             hrc = guestOSType->COMGETTER(Is64Bit)(&fIsGuest64Bit);                          H();
    929 
    930             if (fSupportsLongMode && fIsGuest64Bit)
     959             *        makes a lof of difference there (REM and Solaris performance). */
     960            if (fIsGuest64Bit)
    931961            {
    932962                InsertConfigInteger(pHWVirtExt, "64bitEnabled", 1);
     
    939969#if ARCH_BITS == 32 /* 32-bit guests only. */
    940970            else
    941             {
    942971                InsertConfigInteger(pHWVirtExt, "64bitEnabled", 0);
    943             }
    944972#endif
    945973
     
    9791007        InsertConfigInteger(pHWVirtExt, "EnableVPID", fEnableVPID);
    9801008
    981         /* Physical Address Extension (PAE) */
    982         BOOL fEnablePAE = false;
    983         hrc = pMachine->GetCPUProperty(CPUPropertyType_PAE, &fEnablePAE);                   H();
    984         InsertConfigInteger(pRoot, "EnablePAE", fEnablePAE);
    985 
    986         /* Synthetic CPU */
    987         BOOL fSyntheticCpu = false;
    988         hrc = pMachine->GetCPUProperty(CPUPropertyType_Synthetic, &fSyntheticCpu);          H();
    989         InsertConfigInteger(pCPUM, "SyntheticCpu", fSyntheticCpu);
    990 
    991         if (fOsXGuest)
    992             InsertConfigInteger(pCPUM, "EnableHVP", 1);
    993 
    994         BOOL fPXEDebug;
    995         hrc = biosSettings->COMGETTER(PXEDebugEnabled)(&fPXEDebug);                         H();
     1009        /*
     1010         * MM values.
     1011         */
     1012        PCFGMNODE pMM;
     1013        InsertConfigNode(pRoot, "MM", &pMM);
     1014        InsertConfigInteger(pMM, "CanUseLargerHeap", chipsetType == ChipsetType_ICH9);
    9961015
    9971016        /*
     
    14201439            InsertConfigString(pBiosCfg,   "FloppyDevice",         "i82078");
    14211440            InsertConfigInteger(pBiosCfg,  "IOAPIC",               fIOAPIC);
     1441            BOOL fPXEDebug;
     1442            hrc = biosSettings->COMGETTER(PXEDebugEnabled)(&fPXEDebug);                     H();
    14221443            InsertConfigInteger(pBiosCfg,  "PXEDebug",             fPXEDebug);
    14231444            InsertConfigBytes(pBiosCfg,    "UUID", &HardwareUuid,sizeof(HardwareUuid));
     
    14271448
    14281449            DeviceType_T bootDevice;
    1429             if (SchemaDefs::MaxBootPosition > 9)
    1430             {
    1431                 AssertMsgFailed(("Too many boot devices %d\n",
    1432                                 SchemaDefs::MaxBootPosition));
    1433                 return VERR_INVALID_PARAMETER;
    1434             }
     1450            AssertMsgReturn(SchemaDefs::MaxBootPosition <= 9, ("Too many boot devices %d\n", SchemaDefs::MaxBootPosition),
     1451                            VERR_INVALID_PARAMETER);
    14351452
    14361453            for (ULONG pos = 1; pos <= SchemaDefs::MaxBootPosition; ++pos)
     
    15331550                InsertConfigInteger(pCfg, "DmiExposeMemoryTable", 1);
    15341551            }
    1535             PCFGMNODE pDrv;
    15361552            InsertConfigNode(pInst,    "LUN#0", &pLunL0);
    15371553            InsertConfigString(pLunL0, "Driver", "NvramStorage");
Note: See TracChangeset for help on using the changeset viewer.

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