VirtualBox

Changeset 17541 in vbox


Ignore:
Timestamp:
Mar 8, 2009 8:51:17 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
43976
Message:

MM,CFGM,VBox/param.h: Added a RamHoleSize CFGM value that defaults to 512MB. This is for pushing the RAM out of the PCI MMIO[2] area.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/param.h

    r17535 r17541  
    6060#define MM_HYPER_DYNAMIC_SIZE       (16 * PAGE_SIZE)
    6161
     62/** The default size of the below 4GB RAM hole. */
     63#define MM_RAM_HOLE_SIZE_DEFAULT    (512U * _1M)
     64
    6265/** @} */
    6366
  • trunk/src/VBox/VMM/CFGM.cpp

    r14070 r17541  
    769769    rc = CFGMR3InsertString(pRoot,  "Name",                 "Default VM");
    770770    UPDATERC();
    771     rc = CFGMR3InsertInteger(pRoot, "RamSize",              128 * _1M);
     771    rc = CFGMR3InsertInteger(pRoot, "RamSize",              128U * _1M);
     772    UPDATERC();
     773    rc = CFGMR3InsertInteger(pRoot, "RamHoleSize",          512U * _1M);
    772774    UPDATERC();
    773775    rc = CFGMR3InsertInteger(pRoot, "TimerMillies",         10);
     
    839841    rc = CFGMR3InsertNode(pInst,    "Config", &pCfg);
    840842    UPDATERC();
    841     rc = CFGMR3InsertInteger(pCfg,  "RamSize",              128 * _1M);
     843    rc = CFGMR3InsertInteger(pCfg,  "RamSize",              128U * _1M);
     844    UPDATERC();
     845    rc = CFGMR3InsertInteger(pCfg,  "RamHoleSize",          512U * _1M);
    842846    UPDATERC();
    843847    rc = CFGMR3InsertString(pCfg,   "BootDevice0",          "IDE");
  • trunk/src/VBox/VMM/MM.cpp

    r17513 r17541  
    303303        AssertMsgRCReturn(rc, ("Configuration error: Failed to query integer \"RamPreAlloc\", rc=%Rrc.\n", rc), rc);
    304304
    305     /** @cfgm{RamSize, uint64_t, 0, 0, UINT64_MAX}
     305    /** @cfgm{RamSize, uint64_t, 0, 16TB, 0}
    306306     * Specifies the size of the base RAM that is to be set up during
    307307     * VM initialization.
     
    313313    else
    314314        AssertMsgRCReturn(rc, ("Configuration error: Failed to query integer \"RamSize\", rc=%Rrc.\n", rc), rc);
    315 
     315    AssertLogRelMsg(!(cbRam & ~X86_PTE_PAE_PG_MASK), ("%RGp\n", cbRam));
    316316    cbRam &= X86_PTE_PAE_PG_MASK;
    317     pVM->mm.s.cbRamBase = cbRam;            /* Warning: don't move this code to MMR3Init without fixing REMR3Init.  */
    318     Log(("MM: %RU64 bytes of RAM%s\n", cbRam, fPreAlloc ? " (PreAlloc)" : ""));
     317    pVM->mm.s.cbRamBase = cbRam;
     318
     319    /** @cfgm{RamHoleSize, uint32_t, 0, 4032MB, 512MB}
     320     * Specifies the size of the memory hole. The memory hole is used
     321     * to avoid mapping RAM to the range normally used for PCI memory regions.
     322     * Must be aligned on a 4MB boundrary. */
     323    uint32_t cbRamHole;
     324    rc = CFGMR3QueryU32Def(CFGMR3GetRoot(pVM), "RamHoleSize", &cbRamHole, MM_RAM_HOLE_SIZE_DEFAULT);
     325    AssertLogRelMsgRCReturn(rc, ("Configuration error: Failed to query integer \"RamHoleSize\", rc=%Rrc.\n", rc), rc);
     326    AssertLogRelMsgReturn(cbRamHole <= 4032U * _1M,
     327                          ("Configuration error: \"RamHoleSize\"=%#RX32 is too large.\n", cbRamHole), VERR_OUT_OF_RANGE);
     328    AssertLogRelMsgReturn(cbRamHole > 16 * _1M,
     329                          ("Configuration error: \"RamHoleSize\"=%#RX32 is too large.\n", cbRamHole), VERR_OUT_OF_RANGE);
     330    AssertLogRelMsgReturn(!(cbRamHole & (_4M - 1)),
     331                          ("Configuration error: \"RamHoleSize\"=%#RX32 is misaligned.\n", cbRamHole), VERR_OUT_OF_RANGE);
     332    uint64_t const offRamHole = _4G - cbRamHole;
     333    if (cbRam < offRamHole)
     334        Log(("MM: %RU64 bytes of RAM%s\n", cbRam, fPreAlloc ? " (PreAlloc)" : ""));
     335    else
     336        Log(("MM: %RU64 bytes of RAM%s with a hole at %RU64 up to 4GB.\n", cbRam, fPreAlloc ? " (PreAlloc)" : "", offRamHole));
    319337
    320338    /** @cfgm{MM/Policy, string, no overcommitment}
     
    393411     * Setup the base ram (PGM).
    394412     */
    395     rc = PGMR3PhysRegisterRam(pVM, 0, cbRam, "Base RAM");
    396413#ifdef VBOX_WITH_NEW_PHYS_CODE
    397     if (RT_SUCCESS(rc) && fPreAlloc)
     414    if (cbRam > offRamHole)
     415    {
     416        rc = PGMR3PhysRegisterRam(pVM, 0, offRamHole, "Base RAM");
     417        if (RT_SUCCESS(rc))
     418            rc = PGMR3PhysRegisterRam(pVM, _4G, cbRam - offRamHole, "Above 4GB Base RAM");
     419    }
     420    else
     421        rc = PGMR3PhysRegisterRam(pVM, 0, RT_MIN(cbRam, offRamHole), "Base RAM");
     422    if (    RT_SUCCESS(rc)
     423        &&  fPreAlloc)
    398424    {
    399425        /** @todo RamPreAlloc should be handled at the very end of the VM creation. (lazy bird) */
     
    401427    }
    402428#else
     429    rc = PGMR3PhysRegisterRam(pVM, 0, cbRam, "Base RAM");
    403430    if (RT_SUCCESS(rc))
    404431    {
     
    423450     */
    424451    pVM->mm.s.fDoneMMR3InitPaging = true;
    425     AssertMsg(pVM->mm.s.cBasePages == cBasePages, ("%RX64 != %RX64\n", pVM->mm.s.cBasePages, cBasePages));
     452    AssertMsg(pVM->mm.s.cBasePages == cBasePages || RT_FAILURE(rc), ("%RX64 != %RX64\n", pVM->mm.s.cBasePages, cBasePages));
    426453#endif
    427454
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