VirtualBox

Changeset 108835 in vbox


Ignore:
Timestamp:
Apr 3, 2025 10:40:08 AM (6 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.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/gic-its.h

    r108829 r108835  
    264264/** GITS_BASER: ITS Table Descriptors - RW. */
    265265#define GITS_CTRL_REG_BASER_OFF_FIRST                           0x0100
     266#define GITS_CTRL_REG_BASER_OFF_LAST                            0x0138
     267#define GITS_CTRL_REG_BASER_RANGE_SIZE                          (GITS_CTRL_REG_BASER_OFF_LAST + sizeof(uint64_t) - GITS_CTRL_REG_BASER_OFF_FIRST)
    266268/** GITS_BASER: Size - Number of pages allocated to the table minus one. */
    267269#define GITS_BF_CTRL_REG_BASER_SIZE_SHIFT                       0
     
    299301                             VALID));
    300302
    301 #define GITS_CTRL_REG_BASER_OFF_LAST                            0x0138
    302 #define GITS_CTRL_REG_BASER_RANGE_SIZE                          (GITS_CTRL_REG_BASER_OFF_LAST + sizeof(uint64_t) - GITS_CTRL_REG_BASER_OFF_FIRST)
    303 
    304303/** GITS_PIDR2: ITS Peripheral ID2 register - RO. */
    305304#define GITS_CTRL_REG_PIDR2_OFF                                 0xffe8
     
    331330#define GITS_TRANSLATION_REG_TRANSLATER                         0x0040
    332331
     332/** GITS Two-level (indirect) table entry. */
     333#define GITS_BF_ITE_LVL2_RSVD_11_0_SHIFT                        0
     334#define GITS_BF_ITE_LVL2_RSVD_11_0_MASK                         UINT64_C(0x0000000000000fff)
     335#define GITS_BF_ITE_LVL2_PHYS_ADDR_SHIFT                        12
     336#define GITS_BF_ITE_LVL2_PHYS_ADDR_MASK                         UINT64_C(0x000ffffffffff000)
     337#define GITS_BF_ITE_LVL2_RSVD_62_52_SHIFT                       52
     338#define GITS_BF_ITE_LVL2_RSVD_62_52_MASK                        UINT64_C(0x7ff0000000000000)
     339#define GITS_BF_ITE_LVL2_VALID_SHIFT                            63
     340#define GITS_BF_ITE_LVL2_VALID_MASK                             UINT64_C(0x8000000000000000)
     341RT_BF_ASSERT_COMPILE_CHECKS(GITS_BF_ITE_LVL2_, UINT64_C(0), UINT64_MAX,
     342                            (RSVD_11_0, PHYS_ADDR, RSVD_62_52, VALID));
     343
    333344/**
    334345 * Memory shareability attributes.
  • trunk/src/VBox/VMM/VMMAll/GICAll.cpp

    r108827 r108835  
    4747 * sources to specific PEs. The ITS is only accessible via its memory mapped I/O
    4848 * region. When the MMIO handle for the its region is NIL_IOMMMIOHANDLE it's
    49  * considered to be disabled for the VM. The ITS code lives in GITSAll.cpp.
     49 * considered to be disabled for the VM. Most of the ITS code lives in GITSAll.cpp.
    5050 *
    5151 * This implementation only targets GICv3. This implementation does not support
     
    33713371
    33723372
    3373 
    3374 #ifndef IN_RING3
    3375 /**
    3376  * @callback_method_impl{PDMDEVREGR0,pfnConstruct}
    3377  */
    3378 static DECLCALLBACK(int) gicRZConstruct(PPDMDEVINS pDevIns)
    3379 {
    3380     PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
    3381     AssertReleaseFailed();
    3382     return VINF_SUCCESS;
    3383 }
    3384 #endif /* !IN_RING3 */
    3385 
    3386 
    33873373/**
    33883374 * GIC device registration structure.
     
    34083394    /* .pfnConstruct = */           gicR3Construct,
    34093395    /* .pfnDestruct = */            gicR3Destruct,
    3410     /* .pfnRelocate = */            gicR3Relocate,
     3396    /* .pfnRelocate = */            NULL,
    34113397    /* .pfnMemSetup = */            NULL,
    34123398    /* .pfnPowerOn = */             NULL,
     
    34303416#elif defined(IN_RING0)
    34313417    /* .pfnEarlyConstruct = */      NULL,
    3432     /* .pfnConstruct = */           gicRZConstruct,
     3418    /* .pfnConstruct = */           NULL,
    34333419    /* .pfnDestruct = */            NULL,
    34343420    /* .pfnFinalDestruct = */       NULL,
     
    34433429    /* .pfnReserved7 = */           NULL,
    34443430#elif defined(IN_RC)
    3445     /* .pfnConstruct = */           gicRZConstruct,
     3431    /* .pfnConstruct = */           NULL,
    34463432    /* .pfnReserved0 = */           NULL,
    34473433    /* .pfnReserved1 = */           NULL,
  • trunk/src/VBox/VMM/VMMAll/GITSAll.cpp

    r108833 r108835  
    322322        static const char* const s_apszType[] = { "UnImpl", "Devices", "vPEs", "Intr Collections" };
    323323
    324         uint64_t const uReg        = pGitsDev->aItsTableRegs[8].u;
     324        uint64_t const uReg        = pGitsDev->aItsTableRegs[i].u;
    325325        uint16_t const uSize       = RT_BF_GET(uReg, GITS_BF_CTRL_REG_BASER_SIZE);
    326326        uint16_t const cPages      = uSize > 0 ? uSize + 1 : 0;
  • 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
  • trunk/src/VBox/VMM/include/GICInternal.h

    r108833 r108835  
    283283DECLCALLBACK(int)                  gicR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg);
    284284DECLCALLBACK(int)                  gicR3Destruct(PPDMDEVINS pDevIns);
    285 DECLCALLBACK(void)                 gicR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta);
    286285DECLCALLBACK(void)                 gicR3Reset(PPDMDEVINS pDevIns);
    287286
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