VirtualBox

Changeset 26577 in vbox


Ignore:
Timestamp:
Feb 16, 2010 12:57:58 PM (15 years ago)
Author:
vboxsync
Message:

More large page work

Location:
trunk
Files:
9 edited

Legend:

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

    r26563 r26577  
    271271GMMR0DECL(int)  GMMR0AllocateHandyPages(PVM pVM, VMCPUID idCpu, uint32_t cPagesToUpdate, uint32_t cPagesToAlloc, PGMMPAGEDESC paPages);
    272272GMMR0DECL(int)  GMMR0AllocatePages(PVM pVM, VMCPUID idCpu, uint32_t cPages, PGMMPAGEDESC paPages, GMMACCOUNT enmAccount);
    273 GMMR0DECL(int)  GMMR0AllocateLargePage(PVM pVM, VMCPUID idCpu, uint64_t cbPage, uint32_t *pidPage);
     273GMMR0DECL(int)  GMMR0AllocateLargePage(PVM pVM, VMCPUID idCpu, uint32_t cbPage, uint32_t *pidPage, RTHCPHYS *pHCPhys);
    274274GMMR0DECL(int)  GMMR0FreePages(PVM pVM, VMCPUID idCpu, uint32_t cPages, PGMMFREEPAGEDESC paPages, GMMACCOUNT enmAccount);
    275275GMMR0DECL(int)  GMMR0FreeLargePage(PVM pVM, VMCPUID idCpu, uint32_t idPage);
     
    419419     */
    420420    uint32_t        idPage;
     421    /* Host physical address of the large page. */
     422    RTHCPHYS        HCPhys;
    421423} GMMALLOCLARGEPAGEREQ;
    422424/** Pointer to a GMMR0AllocateLargePageReq / VMMR0_DO_GMM_ALLOC_LARGE_PAGE request buffer. */
     
    459461GMMR3DECL(void) GMMR3FreePagesCleanup(PGMMFREEPAGESREQ pReq);
    460462GMMR3DECL(void) GMMR3FreeAllocatedPages(PVM pVM, GMMALLOCATEPAGESREQ const *pAllocReq);
     463GMMR3DECL(int)  GMMR3AllocateLargePage(PVM pVM,  uint32_t cbPage, uint32_t *pidPage, RTHCPHYS *pHCPhys);
     464GMMR3DECL(int)  GMMR3FreeLargePage(PVM pVM,  uint32_t idPage);
    461465GMMR3DECL(int)  GMMR3DeflatedBalloon(PVM pVM, uint32_t cPages);
    462466GMMR3DECL(int)  GMMR3MapUnmapChunk(PVM pVM, uint32_t idChunkMap, uint32_t idChunkUnmap, PRTR3PTR ppvR3);
  • trunk/include/VBox/pgm.h

    r26330 r26577  
    533533VMMR3DECL(void)     PGMR3PhysChunkInvalidateTLB(PVM pVM);
    534534VMMR3DECL(int)      PGMR3PhysAllocateHandyPages(PVM pVM);
    535 
     535VMMR3DECL(int)      PGMR3PhysAllocateLargePage(PVM pVM);
    536536
    537537VMMR3DECL(void)     PGMR3ReleaseOwnedLocks(PVM pVM);
  • trunk/include/VBox/vmm.h

    r26563 r26577  
    9595    /** Allocates more handy pages. */
    9696    VMMCALLRING3_PGM_ALLOCATE_HANDY_PAGES,
     97    /** Allocates a large (2MB) page. */
     98    VMMCALLRING3_PGM_ALLOCATE_LARGE_PAGE,
    9799    /** Acquire the MM hypervisor heap lock. */
    98100    VMMCALLRING3_MMHYPER_LOCK,
  • trunk/src/VBox/VMM/GMM.cpp

    r20864 r26577  
    314314}
    315315
     316/**
     317 * @see GMMR0AllocateLargePage
     318 */
     319GMMR3DECL(int)  GMMR3AllocateLargePage(PVM pVM,  uint32_t cbPage, uint32_t *pidPage, RTHCPHYS *pHCPhys)
     320{
     321    GMMALLOCLARGEPAGEREQ Req;
     322    Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
     323    Req.Hdr.cbReq = sizeof(Req);
     324    Req.cbPage = cbPage;
     325    Req.idPage = NIL_GMM_PAGEID;
     326    int rc = VMMR3CallR0(pVM, VMMR0_DO_GMM_ALLOC_LARGE_PAGE, 0, &Req.Hdr);
     327    if (RT_SUCCESS(rc) && pidPage)
     328        *pidPage = Req.idPage;
     329   
     330    if (RT_SUCCESS(rc) && pHCPhys)
     331        *pHCPhys = Req.HCPhys;
     332    return rc;
     333}
     334
     335/**
     336 * @see GMMR0FreeLargePage
     337 */
     338GMMR3DECL(int)  GMMR3FreeLargePage(PVM pVM,  uint32_t idPage)
     339{
     340    GMMFREELARGEPAGEREQ Req;
     341    Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
     342    Req.Hdr.cbReq = sizeof(Req);
     343    Req.idPage = idPage;
     344    return VMMR3CallR0(pVM, VMMR0_DO_GMM_FREE_LARGE_PAGE, 0, &Req.Hdr);
     345}
    316346
    317347/**
  • trunk/src/VBox/VMM/PGMInternal.h

    r26491 r26577  
    26502650    /** The GC mapping of the zero page. */
    26512651    RTGCPTR                         pvZeroPgRC;
    2652 #if GC_ARCH_BITS != 32
    2653     uint32_t                        u32ZeroAlignment; /**< Alignment padding. */
    2654 #endif
    26552652    /** @}*/
    26562653
    26572654    /** The number of handy pages. */
    26582655    uint32_t                        cHandyPages;
     2656
     2657    /** The number of large handy pages. */
     2658    uint32_t                        cLargeHandyPages;
     2659
    26592660    /**
    26602661     * Array of handy pages.
     
    26682669     */
    26692670    GMMPAGEDESC                     aHandyPages[PGM_HANDY_PAGES];
     2671
     2672    /**
     2673     * Array of large handy pages. (currently size 1)
     2674     *
     2675     * This array is used in a two way communication between pgmPhysAllocLargePage
     2676     * and GMMR0AllocateLargePage, with PGMR3PhysAllocateLargePage serving as
     2677     * an intermediary.
     2678     */
     2679    GMMPAGEDESC                     aLargeHandyPage[1];
    26702680
    26712681    /**
  • trunk/src/VBox/VMM/PGMPhys.cpp

    r26364 r26577  
    31653165
    31663166/**
     3167 * Response to VMMCALLRING3_PGM_ALLOCATE_LARGE_PAGE to allocate a large (2MB) page
     3168 * for use with a nested paging PDE.
     3169 *
     3170 * @returns The following VBox status codes.
     3171 * @retval  VINF_SUCCESS on success.
     3172 * @retval  VINF_EM_NO_MEMORY if we're out of memory.
     3173 *
     3174 * @param   pVM         The VM handle.
     3175 */
     3176VMMR3DECL(int) PGMR3PhysAllocateLargePage(PVM pVM)
     3177{
     3178    int      rc = VINF_SUCCESS;
     3179    uint32_t idPage;
     3180    RTHCPHYS HCPhys;
     3181    void    *pvDummy;
     3182
     3183    pgmLock(pVM);
     3184
     3185    rc = GMMR3AllocateLargePage(pVM, _2M, &idPage, &HCPhys);
     3186    if (RT_SUCCESS(rc))
     3187    {
     3188        /* Map the large page into our address space. */
     3189        rc = pgmPhysPageMapByPageID(pVM, idPage, HCPhys, &pvDummy);
     3190    }
     3191
     3192    pgmUnlock(pVM);
     3193    return rc;
     3194}
     3195
     3196
     3197/**
    31673198 * Response to VM_FF_PGM_NEED_HANDY_PAGES and VMMCALLRING3_PGM_ALLOCATE_HANDY_PAGES.
    31683199 *
  • trunk/src/VBox/VMM/VMM.cpp

    r26437 r26577  
    20712071
    20722072        /*
     2073         * Allocates a large page.
     2074         */
     2075        case VMMCALLRING3_PGM_ALLOCATE_LARGE_PAGE:
     2076        {
     2077            pVCpu->vmm.s.rcCallRing3 = PGMR3PhysAllocateLargePage(pVM);
     2078            break;
     2079        }
     2080
     2081        /*
    20732082         * Acquire the PGM lock.
    20742083         */
  • trunk/src/VBox/VMM/VMMAll/PGMAllBth.h

    r26570 r26577  
    29372937    Assert(!PdeDst.n.u1Present); /* We're only supposed to call SyncPT on PDE!P and conflicts.*/
    29382938
     2939# if PGM_SHW_TYPE == PGM_TYPE_EPT
     2940
     2941# endif
     2942
    29392943    GSTPDE PdeSrc;
    29402944    PdeSrc.au32[0]      = 0; /* faked so we don't have to #ifdef everything */
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r26564 r26577  
    22912291 * @param   cbPage          Large page size
    22922292 * @param   pidPage         Id of the page (out)
    2293  */
    2294 GMMR0DECL(int)  GMMR0AllocateLargePage(PVM pVM, VMCPUID idCpu, uint32_t cbPage, uint32_t *pidPage)
     2293 * @param   HCPhys          Host physical address of the page (out)
     2294 */
     2295GMMR0DECL(int)  GMMR0AllocateLargePage(PVM pVM, VMCPUID idCpu, uint32_t cbPage, uint32_t *pidPage, RTHCPHYS *pHCPhys)
    22952296{
    22962297    LogFlow(("GMMR0AllocateLargePage: pVM=%p cbPage=%x\n", pVM, cbPage));
    22972298
    22982299    AssertReturn(cbPage == GMM_CHUNK_SIZE, VERR_INVALID_PARAMETER);
     2300    AssertPtrReturn(pidPage, VERR_INVALID_PARAMETER);
     2301    AssertPtrReturn(pHCPhys, VERR_INVALID_PARAMETER);
    22992302
    23002303    /*
     
    23132316
    23142317    *pidPage = NIL_GMM_PAGEID;
     2318    *pHCPhys = NIL_RTHCPHYS;
    23152319
    23162320    rc = RTSemFastMutexRequest(pGMM->Mtx);
     
    23452349        /* Return the first page as we'll use the whole chunk as one big page. */
    23462350        *pidPage = PageDesc.idPage;
     2351        *pHCPhys = PageDesc.HCPhysGCPhys;
    23472352
    23482353        for (unsigned i = 1; i < cPages; i++)
     
    23842389                    VERR_INVALID_PARAMETER);
    23852390
    2386     return GMMR0AllocateLargePage(pVM, idCpu, pReq->cbPage, &pReq->idPage);
     2391    return GMMR0AllocateLargePage(pVM, idCpu, pReq->cbPage, &pReq->idPage, &pReq->HCPhys);
    23872392}
    23882393
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