VirtualBox

Ignore:
Timestamp:
Apr 3, 2025 10:40:08 AM (3 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
168283
Message:

VMM/GIC: bugref:10877 GITS work-in-progress, remove unused R0/RC callbacks, fixed typo in debug info dumping ITS table base adderss registers and other nits.

File:
1 edited

Legend:

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

    r108834 r108835  
    4242
    4343#include <iprt/armv8.h>
     44#include <iprt/mem.h>
    4445
    4546
     
    290291    PCGICDEV   pGicDev  = PDMDEVINS_2_DATA(pDevIns, PCGICDEV);
    291292    if (pGicDev->hMmioGits != NIL_IOMMMIOHANDLE)
    292     {
    293         PCGITSDEV  pGitsDev = &pGicDev->Gits;
    294         gitsR3DbgInfo(pGitsDev, pHlp, pszArgs);
    295     }
     293        gitsR3DbgInfo(&pGicDev->Gits, pHlp, pszArgs);
    296294    else
    297295        pHlp->pfnPrintf(pHlp, "GIC ITS is not mapped/configured for the VM\n");
     
    314312    AssertPtrReturn(pGicDev, VERR_INVALID_PARAMETER);
    315313    LogFlowFunc(("Command-queue thread spawned and initialized\n"));
     314
     315    /*
     316     * Pre-allocate the maximum size of the command queue allowed by the spec.
     317     * This prevents trashing the heap as well as deal with out-of-memory situations
     318     * up-front while starting the VM. It also simplifies the code from having to
     319     * dynamically grow/shrink the allocation based on how software sizes the queue.
     320     * Guests normally don't alter the queue size all the time, but that's not an
     321     * assumption we can make.
     322     */
     323    uint16_t const cMaxPages  = GITS_BF_CTRL_REG_CBASER_SIZE_MASK + 1;
     324    size_t const   cbCmdQueue = cMaxPages << GUEST_PAGE_SHIFT;
     325    void *pvCommands = RTMemAllocZ(cbCmdQueue);
     326    AssertLogRelMsgReturn(pvCommands, ("Failed to alloc %.Rhcb (%zu bytes) for GITS command queue\n", cbCmdQueue, cbCmdQueue),
     327                          VERR_NO_MEMORY);
    316328
    317329    while (pThread->enmState == PDMTHREADSTATE_RUNNING)
     
    322334        {
    323335            int const rc = PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pGicDev->hEvtCmdQueue, RT_INDEFINITE_WAIT);
    324             AssertLogRelMsgReturn(RT_SUCCESS(rc) || rc == VERR_INTERRUPTED, ("%Rrc\n", rc), rc);
     336            AssertLogRelMsgReturnStmt(RT_SUCCESS(rc) || rc == VERR_INTERRUPTED, ("%Rrc\n", rc), RTMemFree(pvCommands), rc);
    325337            if (pThread->enmState != PDMTHREADSTATE_RUNNING)
    326338                break;
     
    330342        PDM_CRITSECT_RELEASE_ASSERT_RC_DEV(pDevIns, pDevIns->pCritSectRoR3, rcLock);
    331343
    332         /** @todo Process commands.   */
     344        /** @todo Process commands. */
    333345
    334346        PDMDevHlpCritSectLeave(pDevIns, pDevIns->pCritSectRoR3);
    335347    }
     348
     349    RTMemFree(pvCommands);
    336350
    337351    LogFlowFunc(("Command-queue thread terminating\n"));
     
    613627        gicResetCpu(pDevIns, pVCpuDest);
    614628    }
    615 }
    616 
    617 
    618 /**
    619  * @interface_method_impl{PDMDEVREG,pfnRelocate}
    620  */
    621 DECLCALLBACK(void) gicR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
    622 {
    623     RT_NOREF(pDevIns, offDelta);
    624629}
    625630
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