VirtualBox

Changeset 107194 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Nov 29, 2024 2:47:06 PM (7 weeks ago)
Author:
vboxsync
Message:

VMM: More adjustments for VBOX_WITH_ONLY_PGM_NEM_MODE, VBOX_WITH_MINIMAL_R0, VBOX_WITH_HWVIRT and such. jiraref:VBP-1466

Location:
trunk/src/VBox/VMM/VMMR3
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/DBGFR3Bp.cpp

    r107110 r107194  
    319319        && !pUVM->dbgf.s.paBpLocL1R3)
    320320    {
     321#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    321322        if (!SUPR3IsDriverless())
    322323        {
     
    330331        }
    331332        else
     333#endif
    332334        {
    333335            /* Driverless: Do dbgfR0BpInitWorker here, ring-3 style. */
     
    382384        && !pUVM->dbgf.s.paBpLocPortIoR3)
    383385    {
     386#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    384387        if (!SUPR3IsDriverless())
    385388        {
     
    393396        }
    394397        else
     398#endif
    395399        {
    396400            /* Driverless: Do dbgfR0BpPortIoInitWorker here, ring-3 style. */
     
    455459        if (pUVM->dbgf.s.pbmBpOwnersAllocR3)
    456460        {
     461#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    457462            if (!SUPR3IsDriverless())
    458463            {
     
    470475            }
    471476            else
     477#endif
    472478            {
    473479                /* Driverless: Do dbgfR0BpOwnerInitWorker here, ring-3 style. */
     
    624630        if (RT_LIKELY(pbmAlloc))
    625631        {
     632#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    626633            if (!SUPR3IsDriverless())
    627634            {
     
    638645            }
    639646            else
     647#endif
    640648            {
    641649                /* Driverless: Do dbgfR0BpChunkAllocWorker here, ring-3 style. */
     
    845853        if (RT_LIKELY(pbmAlloc))
    846854        {
     855#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    847856            if (!SUPR3IsDriverless())
    848857            {
     
    859868            }
    860869            else
     870#endif
    861871            {
    862872                /* Driverless: Do dbgfR0BpL2TblChunkAllocWorker here, ring-3 style. */
  • trunk/src/VBox/VMM/VMMR3/DBGFR3Tracer.cpp

    r106061 r107194  
    928928{
    929929    PDBGFTRACERINSR3 pThis = NULL;
     930    RT_NOREF(fR0Enabled);
    930931
    931932    /*
    932933     * Allocate the tracer instance.
    933934     */
     935#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    934936    if ((fR0Enabled /*|| fRCEnabled*/) && !SUPR3IsDriverless())
    935937    {
     
    950952    }
    951953    else
     954#endif
    952955    {
    953956        /* The code in this else branch works by the same rules as the DBGFR0Tracer.cpp
  • trunk/src/VBox/VMM/VMMR3/EM.cpp

    r107113 r107194  
    881881                    || pVCpu->em.s.enmState == EMSTATE_DEBUG_HYPER)
    882882                    AssertLogRelMsgFailedStmt(("Bad EM state."), rc = VERR_EM_INTERNAL_ERROR);
    883 #if !defined(VBOX_VMM_TARGET_ARMV8)
     883#ifdef VBOX_WITH_HWVIRT
    884884                else if (pVCpu->em.s.enmState == EMSTATE_DEBUG_GUEST_HM)
    885885                    rc = EMR3HmSingleInstruction(pVM, pVCpu, 0 /*fFlags*/);
     886#endif
     887#if !defined(VBOX_VMM_TARGET_ARMV8)
    886888                else if (pVCpu->em.s.enmState == EMSTATE_DEBUG_GUEST_NEM)
    887889                    rc = VBOXSTRICTRC_TODO(emR3NemSingleInstruction(pVM, pVCpu, 0 /*fFlags*/));
     
    12221224
    12231225    /*
    1224      * Execute everything in IEM?
     1226     * Can we use the default engine.  IEM is the fallback.
    12251227     */
    1226     if (   pVM->em.s.fIemExecutesAll
    1227         || VM_IS_EXEC_ENGINE_IEM(pVM))
    1228 #ifdef VBOX_WITH_IEM_RECOMPILER
    1229         return pVM->em.s.fIemRecompiled ? EMSTATE_RECOMPILER : EMSTATE_IEM;
    1230 #else
    1231         return EMSTATE_IEM;
    1232 #endif
    1233 
    1234 #if !defined(VBOX_VMM_TARGET_ARMV8)
    1235     if (VM_IS_HM_ENABLED(pVM))
    1236     {
    1237         if (HMCanExecuteGuest(pVM, pVCpu, &pVCpu->cpum.GstCtx))
    1238             return EMSTATE_HM;
    1239     }
    1240     else
    1241 #endif
    1242     if (NEMR3CanExecuteGuest(pVM, pVCpu))
    1243         return EMSTATE_NEM;
    1244 
    1245     /*
    1246      * Note! Raw mode and hw accelerated mode are incompatible. The latter
    1247      *       turns off monitoring features essential for raw mode!
    1248      */
     1228    if (!pVM->em.s.fIemExecutesAll)
     1229    {
     1230        switch (pVM->bMainExecutionEngine)
     1231        {
     1232#ifdef VBOX_WITH_HWVIRT
     1233            case VM_EXEC_ENGINE_HW_VIRT:
     1234                if (HMCanExecuteGuest(pVM, pVCpu, &pVCpu->cpum.GstCtx))
     1235                    return EMSTATE_HM;
     1236                break;
     1237#endif
     1238#ifdef VBOX_WITH_NATIVE_NEM
     1239            case VM_EXEC_ENGINE_NATIVE_API:
     1240                if (NEMR3CanExecuteGuest(pVM, pVCpu))
     1241                    return EMSTATE_NEM;
     1242                break;
     1243#endif
     1244            case VM_EXEC_ENGINE_IEM:
     1245                break;
     1246            default:
     1247                AssertMsgFailed(("bMainExecutionEngine=%d\n", pVM->bMainExecutionEngine));
     1248                break;
     1249        }
     1250    }
    12491251#ifdef VBOX_WITH_IEM_RECOMPILER
    12501252    return pVM->em.s.fIemRecompiled ? EMSTATE_RECOMPILER : EMSTATE_IEM;
     
    15161518        }
    15171519
     1520#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    15181521        /*
    15191522         * Out of memory? Putting this after CSAM as it may in theory cause us to run out of memory.
     
    15261529                return rc;
    15271530        }
     1531#endif
    15281532
    15291533        /* check that we got them all  */
     
    19681972#endif /* VBOX_VMM_TARGET_ARMV8 */
    19691973
     1974#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    19701975        /*
    19711976         * Allocate handy pages.
     
    19761981            UPDATE_RC();
    19771982        }
     1983#endif
    19781984
    19791985        /*
     
    20452051        if (VM_FF_IS_SET(pVM, VM_FF_PGM_NO_MEMORY))
    20462052        {
     2053#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    20472054            rc2 = PGMR3PhysAllocateHandyPages(pVM);
     2055#else
     2056            rc2 = VINF_EM_NO_MEMORY;
     2057#endif
    20482058            UPDATE_RC();
    20492059            if (rc == VINF_EM_NO_MEMORY)
     
    25062516                 */
    25072517                case EMSTATE_HM:
    2508 #if defined(VBOX_VMM_TARGET_ARMV8)
    2509                     AssertReleaseFailed(); /* Should never get here. */
     2518#ifdef VBOX_WITH_HWVIRT
     2519                    rc = emR3HmExecute(pVM, pVCpu, &fFFDone);
    25102520#else
    2511                     rc = emR3HmExecute(pVM, pVCpu, &fFFDone);
     2521                    AssertReleaseFailedStmt(rc = VERR_EM_INTERNAL_ERROR); /* Should never get here. */
    25122522#endif
    25132523                    break;
  • trunk/src/VBox/VMM/VMMR3/EMHM.cpp

    r106061 r107194  
    6060#include "EMInline.h"
    6161
     62#ifndef VBOX_WITH_HWVIRT
     63# error "VBOX_WITH_HWVIRT misconfig!"
     64#endif
     65
    6266
    6367/*********************************************************************************************************************************
  • trunk/src/VBox/VMM/VMMR3/EMR3Nem.cpp

    r106061 r107194  
    329329    }
    330330
     331#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    331332    /*
    332333     * Allocate handy pages (just in case the above actions have consumed some pages).
     
    338339            return rc;
    339340    }
     341#endif
    340342
    341343    /*
  • trunk/src/VBox/VMM/VMMR3/IOM.cpp

    r106061 r107194  
    219219    if (enmWhat == VMINITCOMPLETED_RING0)
    220220    {
     221# if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    221222        /*
    222223         * Synchronize the ring-3 I/O port and MMIO statistics indices into the
     
    229230            AssertLogRelRCReturn(rc, rc);
    230231        }
     232# endif
    231233
    232234        /*
  • trunk/src/VBox/VMM/VMMR3/IOMR3IoPort.cpp

    r106061 r107194  
    223223
    224224    int rc;
     225# if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    225226    if (!SUPR3IsDriverless())
    226227    {
     
    230231    }
    231232    else
     233# endif
    232234    {
    233235        /*
     
    283285
    284286    int rc;
     287#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    285288    if (!SUPR3IsDriverless())
    286289    {
     
    290293    }
    291294    else
     295#endif
    292296    {
    293297        /*
  • trunk/src/VBox/VMM/VMMR3/IOMR3Mmio.cpp

    r106061 r107194  
    135135
    136136    int rc;
     137# if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    137138    if (!SUPR3IsDriverless())
    138139    {
     
    142143    }
    143144    else
     145# endif
    144146    {
    145147        /*
     
    195197
    196198    int rc;
     199#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    197200    if (!SUPR3IsDriverless())
    198201    {
     
    202205    }
    203206    else
     207#endif
    204208    {
    205209        /*
  • trunk/src/VBox/VMM/VMMR3/NEMR3Native-win-armv8.cpp

    r107113 r107194  
    10201020                    }
    10211021
     1022#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    10221023                    if (!SUPR3IsDriverless())
    10231024                    {
     
    10301031                                              "/NEM/R0Stats/cPagesInUse");
    10311032                    }
     1033#endif /* VBOX_WITH_R0_MODULES && !VBOX_WITH_MINIMAL_R0 */
    10321034                }
    1033 
    10341035            }
    1035 
    10361036        }
    10371037    }
  • trunk/src/VBox/VMM/VMMR3/NEMR3Native-win.cpp

    r107113 r107194  
    13811381                    }
    13821382
     1383#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    13831384                    if (!SUPR3IsDriverless())
    13841385                    {
     
    13911392                                              "/NEM/R0Stats/cPagesInUse");
    13921393                    }
     1394#endif /* VBOX_WITH_R0_MODULES && !VBOX_WITH_MINIMAL_R0 */
    13931395
    13941396                }
  • trunk/src/VBox/VMM/VMMR3/PDMDevice.cpp

    r107113 r107194  
    289289        }
    290290
    291         /* RZEnabled, R0Enabled, RCEnabled*/
     291#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0) /** @todo not entirely correct for new-RC; */
     292        /* R0Enabled, RCEnabled*/
    292293        bool fR0Enabled = false;
    293294        bool fRCEnabled = false;
    294295        if (   (pReg->fFlags & (PDM_DEVREG_FLAGS_R0 | PDM_DEVREG_FLAGS_RC))
    295 #ifdef VBOX_WITH_PGM_NEM_MODE
     296# ifdef VBOX_WITH_PGM_NEM_MODE
    296297            && !PGMR3IsNemModeEnabled(pVM) /* No ring-0 in simplified memory mode. */
    297 #endif
     298# endif
    298299            && !SUPR3IsDriverless())
    299300        {
     
    323324            }
    324325        }
     326#endif /* VBOX_WITH_R0_MODULES && !VBOX_WITH_MINIMAL_R0 */
    325327
    326328#ifdef VBOX_WITH_DBGF_TRACING
     
    368370        PPDMDEVINS   pDevIns;
    369371        PPDMCRITSECT pCritSect;
     372#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    370373        if (fR0Enabled || fRCEnabled)
    371374        {
     
    396399            Req.afReserved[1]     = false;
    397400            Req.afReserved[2]     = false;
    398 #ifdef VBOX_WITH_DBGF_TRACING
     401# ifdef VBOX_WITH_DBGF_TRACING
    399402            Req.hDbgfTracerEvtSrc = hDbgfTraceEvtSrc;
    400 #else
     403# else
    401404            Req.hDbgfTracerEvtSrc = NIL_DBGFTRACEREVTSRC;
    402 #endif
     405# endif
    403406            rc = RTStrCopy(Req.szDevName, sizeof(Req.szDevName), pReg->szName);
    404407            AssertLogRelRCReturn(rc, rc);
     
    417420        }
    418421        else
     422#endif /* VBOX_WITH_R0_MODULES && !VBOX_WITH_MINIMAL_R0 */
    419423        {
    420424            /* The code in this else branch works by the same rules as the PDMR0Device.cpp
     
    569573        }
    570574
     575#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    571576        /*
    572577         * Call the ring-0 constructor if applicable.
     
    594599            }
    595600        }
     601#endif /* VBOX_WITH_R0_MODULES && !VBOX_WITH_MINIMAL_R0 */
    596602
    597603    } /* for device instances */
  • trunk/src/VBox/VMM/VMMR3/PDMQueue.cpp

    r106061 r107194  
    9494                    VERR_OUT_OF_RANGE);
    9595    AssertReturn(!fRZEnabled || enmType == PDMQUEUETYPE_INTERNAL || enmType == PDMQUEUETYPE_DEV, VERR_INVALID_PARAMETER);
     96#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    9697    if (SUPR3IsDriverless())
     98#endif
    9799        fRZEnabled = false;
    98100
     
    113115    PPDMQUEUE      pQueue;
    114116    PDMQUEUEHANDLE hQueue;
     117#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    115118    if (fRZEnabled)
    116119    {
     
    143146    }
    144147    else
     148#endif
    145149    {
    146150        /* Do it here using the paged heap: */
  • trunk/src/VBox/VMM/VMMR3/PGM-armv8.cpp

    r107171 r107194  
    185185    PCFGMNODE const pCfgPGM = CFGMR3GetChild(CFGMR3GetRoot(pVM), "/PGM");
    186186
     187    /** @todo RamPreAlloc doesn't work for NEM-mode.   */
    187188    int rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "RamPreAlloc", &pVM->pgm.s.fRamPreAlloc,
    188189#ifdef VBOX_WITH_PREALLOC_RAM_BY_DEFAULT
     
    194195    AssertLogRelRCReturn(rc, rc);
    195196
     197#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    196198    rc = CFGMR3QueryU32Def(pCfgPGM, "MaxRing3Chunks", &pVM->pgm.s.ChunkR3Map.cMax, UINT32_MAX);
    197199    AssertLogRelRCReturn(rc, rc);
    198200    for (uint32_t i = 0; i < RT_ELEMENTS(pVM->pgm.s.ChunkR3Map.Tlb.aEntries); i++)
    199201        pVM->pgm.s.ChunkR3Map.Tlb.aEntries[i].idChunk = NIL_GMM_CHUNKID;
     202#endif
    200203
    201204    /*
     
    241244    AssertRCReturn(rc, rc);
    242245
     246#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    243247    pgmR3PhysChunkInvalidateTLB(pVM, false /*fInRendezvous*/); /* includes pgmPhysInvalidatePageMapTLB call */
     248#endif
    244249
    245250    /*
  • trunk/src/VBox/VMM/VMMR3/PGM.cpp

    r107176 r107194  
    824824    for (size_t i = 0; i < RT_ELEMENTS(pVM->pgm.s.aPhysHandlerTypes); i++)
    825825    {
     826#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    826827        if (fDriverless)
     828#endif
    827829            pVM->pgm.s.aPhysHandlerTypes[i].hType  = i | (RTRandU64() & ~(uint64_t)PGMPHYSHANDLERTYPE_IDX_MASK);
    828830        pVM->pgm.s.aPhysHandlerTypes[i].enmKind    = PGMPHYSHANDLERKIND_INVALID;
     
    881883    AssertLogRelRCReturn(rc, rc);
    882884
    883 #if HC_ARCH_BITS == 32
    884 # ifdef RT_OS_DARWIN
     885#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
     886# if HC_ARCH_BITS == 32
     887#  ifdef RT_OS_DARWIN
    885888    rc = CFGMR3QueryU32Def(pCfgPGM, "MaxRing3Chunks", &pVM->pgm.s.ChunkR3Map.cMax, _1G / GMM_CHUNK_SIZE * 3);
     889#  else
     890    rc = CFGMR3QueryU32Def(pCfgPGM, "MaxRing3Chunks", &pVM->pgm.s.ChunkR3Map.cMax, _1G / GMM_CHUNK_SIZE);
     891#  endif
    886892# else
    887     rc = CFGMR3QueryU32Def(pCfgPGM, "MaxRing3Chunks", &pVM->pgm.s.ChunkR3Map.cMax, _1G / GMM_CHUNK_SIZE);
     893    rc = CFGMR3QueryU32Def(pCfgPGM, "MaxRing3Chunks", &pVM->pgm.s.ChunkR3Map.cMax, UINT32_MAX);
    888894# endif
    889 #else
    890     rc = CFGMR3QueryU32Def(pCfgPGM, "MaxRing3Chunks", &pVM->pgm.s.ChunkR3Map.cMax, UINT32_MAX);
    891 #endif
    892895    AssertLogRelRCReturn(rc, rc);
    893896    for (uint32_t i = 0; i < RT_ELEMENTS(pVM->pgm.s.ChunkR3Map.Tlb.aEntries); i++)
    894897        pVM->pgm.s.ChunkR3Map.Tlb.aEntries[i].idChunk = NIL_GMM_CHUNKID;
     898#endif
    895899
    896900    /*
     
    946950    AssertRCReturn(rc, rc);
    947951
     952#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    948953    pgmR3PhysChunkInvalidateTLB(pVM, false /*fInRendezvous*/); /* includes pgmPhysInvalidatePageMapTLB call */
     954#endif
    949955
    950956    /*
     
    979985    pVM->pgm.s.HCPhysInvMmioPg = pVM->pgm.s.HCPhysMmioPg;
    980986    Log(("HCPhysInvMmioPg=%RHp abMmioPg=%p\n", pVM->pgm.s.HCPhysMmioPg, pVM->pgm.s.abMmioPg));
    981 #endif /* VBOX_WITH_ONLY_PGM_NEM_MODE */
     987#endif
    982988
    983989
     
    12481254    STAM_REL_REG(pVM, &pPGM->cLargePages,                        STAMTYPE_U32,     "/PGM/Page/cLargePages",              STAMUNIT_COUNT,     "The number of large pages allocated (includes disabled).");
    12491255    STAM_REL_REG(pVM, &pPGM->cLargePagesDisabled,                STAMTYPE_U32,     "/PGM/Page/cLargePagesDisabled",      STAMUNIT_COUNT,     "The number of disabled large pages.");
     1256#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    12501257    STAM_REL_REG(pVM, &pPGM->ChunkR3Map.c,                       STAMTYPE_U32,     "/PGM/ChunkR3Map/c",                  STAMUNIT_COUNT,     "Number of mapped chunks.");
    12511258    STAM_REL_REG(pVM, &pPGM->ChunkR3Map.cMax,                    STAMTYPE_U32,     "/PGM/ChunkR3Map/cMax",               STAMUNIT_COUNT,     "Maximum number of mapped chunks.");
    12521259    STAM_REL_REG(pVM, &pPGM->cMappedChunks,                      STAMTYPE_U32,     "/PGM/ChunkR3Map/Mapped",             STAMUNIT_COUNT,     "Number of times we mapped a chunk.");
    12531260    STAM_REL_REG(pVM, &pPGM->cUnmappedChunks,                    STAMTYPE_U32,     "/PGM/ChunkR3Map/Unmapped",           STAMUNIT_COUNT,     "Number of times we unmapped a chunk.");
     1261#endif
    12541262
    12551263    STAM_REL_REG(pVM, &pPGM->StatLargePageReused,                STAMTYPE_COUNTER, "/PGM/LargePage/Reused",              STAMUNIT_OCCURENCES, "The number of times we've reused a large page.");
     
    27492757    return Args.cErrors == 0 ? VINF_SUCCESS : VERR_INTERNAL_ERROR;
    27502758}
     2759
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r107177 r107194  
    48464846                for (uint32_t iPage = 0; iPage < cGuestPages; iPage++, pRamPage++, pRomPage++)
    48474847                {
    4848                     Assert(PGM_PAGE_GET_HCPHYS(pRamPage) == UINT64_C(0x0000fffffffff000));
     4848                    Assert(PGM_PAGE_GET_HCPHYS(pRamPage) == UINT64_C(0x0000fffffffff000) || PGM_PAGE_GET_HCPHYS(pRamPage) == 0);
    48494849                    Assert(PGM_PAGE_GET_PAGEID(pRamPage) == NIL_GMM_PAGEID);
    48504850                    Assert(PGM_PAGE_GET_STATE(pRamPage) == PGM_PAGE_STATE_ALLOCATED);
     
    50325032                for (uint32_t iPage = 0; iPage < cGuestPages; iPage++, pRamPage++, pRomPage++)
    50335033                {
    5034                     Assert(PGM_PAGE_GET_HCPHYS(pRamPage) == UINT64_C(0x0000fffffffff000));
     5034                    Assert(PGM_PAGE_GET_HCPHYS(pRamPage) == UINT64_C(0x0000fffffffff000) || PGM_PAGE_GET_HCPHYS(pRamPage) == 0);
    50355035                    Assert(PGM_PAGE_GET_PAGEID(pRamPage) == NIL_GMM_PAGEID);
    50365036                    Assert(PGM_PAGE_GET_STATE(pRamPage) == PGM_PAGE_STATE_ALLOCATED);
     
    58305830*   Chunk Mappings and Page Allocation                                                                                           *
    58315831*********************************************************************************************************************************/
     5832#ifndef VBOX_WITH_ONLY_PGM_NEM_MODE
    58325833
    58335834/**
     
    58935894        return 0;
    58945895    }
    5895 #ifdef VBOX_STRICT
     5896# ifdef VBOX_STRICT
    58965897    for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.ChunkR3Map.Tlb.aEntries); i++)
    58975898    {
     
    58995900        Assert(pVM->pgm.s.ChunkR3Map.Tlb.aEntries[i].idChunk != pChunk->Core.Key);
    59005901    }
    5901 #endif
    5902 
    5903 #if 0 /* This is too much work with the PGMCPU::PhysTlb as well.  We flush them all instead. */
     5902# endif
     5903
     5904# if 0 /* This is too much work with the PGMCPU::PhysTlb as well.  We flush them all instead. */
    59045905    for (unsigned i = 0; i < RT_ELEMENTS(pVM->pgm.s.PhysTlbR3.aEntries); i++)
    59055906        if (pVM->pgm.s.PhysTlbR3.aEntries[i].pMap == pChunk)
    59065907            return 0;
    5907 #endif
     5908# endif
    59085909
    59095910    pArg->pChunk = pChunk;
     
    62286229        AssertMsg(rc == VINF_SUCCESS, ("%Rrc\n", rc));
    62296230        Assert(pVM->pgm.s.cHandyPages > 0);
    6230 #ifdef VBOX_STRICT
     6231# ifdef VBOX_STRICT
    62316232        uint32_t i;
    62326233        for (i = iClear; i < pVM->pgm.s.cHandyPages; i++)
     
    62476248            RTAssertPanic();
    62486249        }
    6249 #endif
     6250# endif
    62506251    }
    62516252    else
     
    63146315}
    63156316
     6317#endif /* !VBOX_WITH_ONLY_PGM_NEM_MODE */
     6318
    63166319
    63176320/*********************************************************************************************************************************
  • trunk/src/VBox/VMM/VMMR3/STAM.cpp

    r106308 r107194  
    166166static char **              stamR3SplitPattern(const char *pszPat, unsigned *pcExpressions, char **ppszCopy);
    167167static int                  stamR3EnumU(PUVM pUVM, const char *pszPat, bool fUpdateRing0, int (pfnCallback)(PSTAMDESC pDesc, void *pvArg), void *pvArg);
     168#ifdef VBOX_WITH_R0_MODULES
    168169static void                 stamR3Ring0StatsRegisterU(PUVM pUVM);
     170#endif
    169171
    170172#ifdef VBOX_WITH_DEBUGGER
     
    196198
    197199
     200#ifdef VBOX_WITH_R0_MODULES
    198201/**
    199202 * The GVMM mapping records - sans the host cpus.
     
    235238
    236239
     240# ifndef VBOX_WITH_MINIMAL_R0
    237241/**
    238242 * The GMM mapping records.
     
    272276    { RT_UOFFSETOF(GMMSTATS, VMStats.fMayAllocate),             STAMTYPE_BOOL,  STAMUNIT_NONE,  "/GMM/VM/fMayAllocate",             "Whether the VM is allowed to allocate memory or not." },
    273277};
     278# endif /* !VBOX_WITH_MINIMAL_R0 */
     279#endif /* VBOX_WITH_R0_MODULES */
    274280
    275281
     
    320326    pUVM->stam.s.pRoot = pRoot;
    321327
     328#ifdef VBOX_WITH_R0_MODULES
    322329    /*
    323330     * Register the ring-0 statistics (GVMM/GMM).
     
    325332    if (!SUPR3IsDriverless())
    326333        stamR3Ring0StatsRegisterU(pUVM);
     334#endif
    327335
    328336#ifdef VBOX_WITH_DEBUGGER
     
    25352543    int rc = VINF_SUCCESS;
    25362544
    2537     /* ring-0 */
     2545#ifdef VBOX_WITH_R0_MODULES
     2546    /*
     2547     * Check if the reset patterns cover anything related to ring-0.
     2548     */
    25382549    GVMMRESETSTATISTICSSREQ GVMMReq;
     2550    bool fGVMMMatched = (!pszPat || !*pszPat) && !SUPR3IsDriverless();
     2551# ifndef VBOX_WITH_MINIMAL_R0
    25392552    GMMRESETSTATISTICSSREQ  GMMReq;
    2540     bool fGVMMMatched = (!pszPat || !*pszPat) && !SUPR3IsDriverless();
    25412553    bool fGMMMatched  = fGVMMMatched;
     2554# endif
    25422555    if (fGVMMMatched)
    25432556    {
    25442557        memset(&GVMMReq.Stats, 0xff, sizeof(GVMMReq.Stats));
     2558# ifndef VBOX_WITH_MINIMAL_R0
    25452559        memset(&GMMReq.Stats,  0xff, sizeof(GMMReq.Stats));
     2560# endif
    25462561    }
    25472562    else
     
    25662581        }
    25672582
     2583# ifndef VBOX_WITH_MINIMAL_R0
    25682584        /* GMM */
    25692585        RT_ZERO(GMMReq.Stats);
     
    25742590                 fGMMMatched = true;
    25752591            }
     2592# endif
    25762593
    25772594        RTMemTmpFree(papszExpressions);
    25782595        RTStrFree(pszCopy);
    25792596    }
    2580 
     2597#endif /* !VBOX_WITH_R0_MODULES */
     2598
     2599
     2600    /*
     2601     * Grab the lock and do the resetting.
     2602     */
    25812603    STAM_LOCK_WR(pUVM);
    25822604
     2605#ifdef VBOX_WITH_R0_MODULES
     2606    /* Reset ring-0 stats first. */
    25832607    if (fGVMMMatched)
    25842608    {
     
    25902614    }
    25912615
     2616# ifndef VBOX_WITH_MINIMAL_R0
    25922617    if (fGMMMatched)
    25932618    {
     
    25982623        rc = SUPR3CallVMMR0Ex(VMCC_GET_VMR0_FOR_CALL(pVM), NIL_VMCPUID, VMMR0_DO_GMM_RESET_STATISTICS, 0, &GMMReq.Hdr);
    25992624    }
     2625# endif
     2626#endif
    26002627
    26012628    /* and the reset */
     
    33953422        switch (iRefreshGroup)
    33963423        {
     3424#ifdef VBOX_WITH_R0_MODULES
    33973425            /*
    33983426             * GVMM
     
    34573485            }
    34583486
     3487# ifndef VBOX_WITH_MINIMAL_R0
    34593488            /*
    34603489             * GMM
     
    34783507                SUPR3CallVMMR0(VMCC_GET_VMR0_FOR_CALL(pVM), NIL_VMCPUID, VMMR0_DO_NEM_UPDATE_STATISTICS, NULL);
    34793508                break;
     3509# endif
     3510#endif /* VBOX_WITH_R0_MODULES */
    34803511
    34813512            default:
     
    37453776
    37463777
     3778#ifdef VBOX_WITH_R0_MODULES
    37473779/**
    37483780 * Registers the ring-0 statistics.
     
    37893821    pUVM->stam.s.cRegisteredHostCpus = 0;
    37903822
     3823# ifndef VBOX_WITH_MINIMAL_R0
    37913824    /* GMM */
    37923825    for (unsigned i = 0; i < RT_ELEMENTS(g_aGMMStats); i++)
     
    37943827                        g_aGMMStats[i].enmType, STAMVISIBILITY_ALWAYS, g_aGMMStats[i].pszName,
    37953828                        g_aGMMStats[i].enmUnit, g_aGMMStats[i].pszDesc, STAM_REFRESH_GRP_GMM);
    3796 }
     3829# endif
     3830}
     3831#endif /* VBOX_WITH_R0_MODULES */
    37973832
    37983833
  • trunk/src/VBox/VMM/VMMR3/TM.cpp

    r106975 r107194  
    16181618     */
    16191619    int rc;
     1620#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    16201621    if (!SUPR3IsDriverless())
    16211622    {
     
    16261627    }
    16271628    else
     1629#endif
    16281630    {
    16291631        AssertReturn(cNewTimers <= _32K && cOldEntries <= _32K, VERR_TM_TOO_MANY_TIMERS);
  • trunk/src/VBox/VMM/VMMR3/VM.cpp

    r107113 r107194  
    576576
    577577
     578#ifdef VBOX_WITH_R0_MODULES
    578579    /*
    579580     * Load the VMMR0.r0 module so that we can call GVMMR0CreateVM.
     
    591592        }
    592593    }
     594#endif
    593595
    594596    /*
  • trunk/src/VBox/VMM/VMMR3/VMM.cpp

    r107113 r107194  
    289289        return rc;
    290290
     291#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    291292    /*
    292293     * Register the Ring-0 VM handle with the session for fast ioctl calls.
    293294     */
    294     bool const fDriverless = SUPR3IsDriverless();
    295     if (!fDriverless)
     295    if (!SUPR3IsDriverless())
    296296    {
    297297        rc = SUPR3SetVMForFastIOCtl(VMCC_GET_VMR0_FOR_CALL(pVM));
     
    299299            return rc;
    300300    }
     301#endif
    301302
    302303#ifdef VBOX_WITH_NMI
     
    312313         * Start the log flusher thread.
    313314         */
    314         if (!fDriverless)
     315        if (!SUPR3IsDriverless())
    315316            rc = RTThreadCreate(&pVM->vmm.s.hLogFlusherThread, vmmR3LogFlusher, pVM, 0 /*cbStack*/,
    316317                                RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "R0LogWrk");
     
    350351     * Statistics.
    351352     */
     353#if defined(VBOX_WITH_R0_MODULES) && !defined(VBOX_WITH_MINIMAL_R0)
    352354    STAM_REG(pVM, &pVM->vmm.s.StatRunGC,                    STAMTYPE_COUNTER, "/VMM/RunGC",                     STAMUNIT_OCCURENCES, "Number of context switches.");
    353355    STAM_REG(pVM, &pVM->vmm.s.StatRZRetNormal,              STAMTYPE_COUNTER, "/VMM/RZRet/Normal",              STAMUNIT_OCCURENCES, "Number of VINF_SUCCESS returns.");
     
    402404    STAM_REG(pVM, &pVM->vmm.s.StatRZRetPendingRequest,      STAMTYPE_COUNTER, "/VMM/RZRet/PendingRequest",      STAMUNIT_OCCURENCES, "Number of VINF_EM_PENDING_REQUEST returns.");
    403405    STAM_REG(pVM, &pVM->vmm.s.StatRZRetPatchTPR,            STAMTYPE_COUNTER, "/VMM/RZRet/PatchTPR",            STAMUNIT_OCCURENCES, "Number of VINF_EM_HM_PATCH_TPR_INSTR returns.");
     406#endif
    404407
    405408    STAMR3Register(pVM, &pVM->vmm.s.StatLogFlusherFlushes,  STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, "/VMM/LogFlush/00-Flushes",  STAMUNIT_OCCURENCES, "Total number of buffer flushes");
     
    12101213#endif
    12111214
     1215#ifdef VBOX_WITH_HWVIRT
    12121216
    12131217/**
     
    12191223VMMR3_INT_DECL(int) VMMR3HmRunGC(PVM pVM, PVMCPU pVCpu)
    12201224{
    1221 #if defined(VBOX_VMM_TARGET_ARMV8)
     1225# if defined(VBOX_VMM_TARGET_ARMV8)
    12221226    /* We should actually never get here as the only execution engine is NEM. */
    12231227    RT_NOREF(pVM, pVCpu);
    12241228    AssertReleaseFailed();
    12251229    return VERR_NOT_SUPPORTED;
    1226 #else
     1230# else
    12271231    Log2(("VMMR3HmRunGC: (cs:rip=%04x:%RX64)\n", CPUMGetGuestCS(pVCpu), CPUMGetGuestRIP(pVCpu)));
    12281232
     
    12301234    do
    12311235    {
    1232 # ifdef NO_SUPCALLR0VMM
     1236#  ifdef NO_SUPCALLR0VMM
    12331237        rc = VERR_GENERAL_FAILURE;
    1234 # else
     1238#  else
    12351239        rc = SUPR3CallVMMR0Fast(VMCC_GET_VMR0_FOR_CALL(pVM), VMMR0_DO_HM_RUN, pVCpu->idCpu);
    12361240        if (RT_LIKELY(rc == VINF_SUCCESS))
    12371241            rc = pVCpu->vmm.s.iLastGZRc;
    1238 # endif
     1242#  endif
    12391243    } while (rc == VINF_EM_RAW_INTERRUPT_HYPER);
    12401244
    1241 # if 0 /** @todo triggers too often */
     1245#  if 0 /** @todo triggers too often */
    12421246    Assert(!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_TO_R3));
    1243 # endif
     1247#  endif
    12441248
    12451249    /*
     
    12561260    }
    12571261    return vmmR3HandleRing0Assert(pVM, pVCpu);
    1258 #endif
    1259 }
    1260 
    1261 
    1262 /**
    1263  * Perform one of the fast I/O control VMMR0 operation.
    1264  *
    1265  * @returns VBox strict status code.
    1266  * @param   pVM             The cross context VM structure.
    1267  * @param   pVCpu           The cross context virtual CPU structure.
    1268  * @param   enmOperation    The operation to perform.
    1269  */
    1270 VMMR3_INT_DECL(VBOXSTRICTRC) VMMR3CallR0EmtFast(PVM pVM, PVMCPU pVCpu, VMMR0OPERATION enmOperation)
    1271 {
    1272     VBOXSTRICTRC rcStrict;
    1273     do
    1274     {
    1275 #ifdef NO_SUPCALLR0VMM
    1276         rcStrict = VERR_GENERAL_FAILURE;
    1277 #else
    1278         rcStrict = SUPR3CallVMMR0Fast(VMCC_GET_VMR0_FOR_CALL(pVM), enmOperation, pVCpu->idCpu);
    1279         if (RT_LIKELY(rcStrict == VINF_SUCCESS))
    1280             rcStrict = pVCpu->vmm.s.iLastGZRc;
    1281 #endif
    1282     } while (rcStrict == VINF_EM_RAW_INTERRUPT_HYPER);
    1283 
    1284     /*
    1285      * Flush the logs
    1286      */
    1287 #ifdef LOG_ENABLED
    1288     VMM_FLUSH_R0_LOG(pVM, pVCpu, &pVCpu->vmm.s.u.s.Logger, NULL);
    1289 #endif
    1290     VMM_FLUSH_R0_LOG(pVM, pVCpu, &pVCpu->vmm.s.u.s.RelLogger, RTLogRelGetDefaultInstance());
    1291     if (rcStrict != VERR_VMM_RING0_ASSERTION)
    1292         return rcStrict;
    1293     return vmmR3HandleRing0Assert(pVM, pVCpu);
    1294 }
     1262# endif
     1263}
     1264#endif /* VBOX_WITH_HWVIRT */
    12951265
    12961266
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