VirtualBox

Changeset 99492 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Apr 20, 2023 7:21:44 PM (20 months ago)
Author:
vboxsync
Message:

VMM/GIC: Register the MMIO region handlers for the distributor and redisitributor frames, this is already enough for the UEFI firmware to not assert and continue with initialization, bugref:10404

Location:
trunk/src/VBox/VMM
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/GICAll.cpp

    r99385 r99492  
    148148 * @callback_method_impl{FNIOMMMIONEWREAD}
    149149 */
    150 DECLCALLBACK(VBOXSTRICTRC) apicReadMmio(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void *pv, unsigned cb)
     150DECL_HIDDEN_CALLBACK(VBOXSTRICTRC) gicDistMmioRead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void *pv, unsigned cb)
    151151{
    152152    NOREF(pvUser);
    153     Assert(!(off & 0xf));
    154     Assert(cb == 4); RT_NOREF_PV(cb);
     153    //Assert(!(off & 0xf));
     154    //Assert(cb == 4); RT_NOREF_PV(cb);
    155155
    156156    PVMCPUCC pVCpu    = PDMDevHlpGetVMCPU(pDevIns);
     
    171171 * @callback_method_impl{FNIOMMMIONEWWRITE}
    172172 */
    173 DECLCALLBACK(VBOXSTRICTRC) gicWriteMmio(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void const *pv, unsigned cb)
     173DECL_HIDDEN_CALLBACK(VBOXSTRICTRC) gicDistMmioWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void const *pv, unsigned cb)
    174174{
    175175    NOREF(pvUser);
    176     Assert(!(off & 0xf));
    177     Assert(cb == 4); RT_NOREF_PV(cb);
     176    //Assert(!(off & 0xf));
     177    //Assert(cb == 4); RT_NOREF_PV(cb);
     178
     179    PVMCPUCC pVCpu    = PDMDevHlpGetVMCPU(pDevIns);
     180    uint16_t offReg   = off & 0xff0;
     181    uint32_t uValue   = *(uint32_t *)pv;
     182
     183    STAM_COUNTER_INC(&pVCpu->gic.s.CTX_SUFF_Z(StatMmioWrite));
     184
     185    Log2(("GIC%u: gicWriteMmio: offReg=%#RX16 uValue=%#RX32\n", pVCpu->idCpu, offReg, uValue));
     186    return gicWriteRegister(pDevIns, pVCpu, offReg, uValue);
     187}
     188
     189
     190/**
     191 * @callback_method_impl{FNIOMMMIONEWREAD}
     192 */
     193DECL_HIDDEN_CALLBACK(VBOXSTRICTRC) gicReDistMmioRead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void *pv, unsigned cb)
     194{
     195    NOREF(pvUser);
     196    //Assert(!(off & 0xf));
     197    //Assert(cb == 4); RT_NOREF_PV(cb);
     198
     199    PVMCPUCC pVCpu    = PDMDevHlpGetVMCPU(pDevIns);
     200    uint16_t offReg   = off & 0xff0;
     201    uint32_t uValue   = 0;
     202
     203    STAM_COUNTER_INC(&pVCpu->gic.s.CTX_SUFF_Z(StatMmioRead));
     204
     205    VBOXSTRICTRC rc = VBOXSTRICTRC_VAL(gicReadRegister(pDevIns, pVCpu, offReg, &uValue));
     206    *(uint32_t *)pv = uValue;
     207
     208    Log2(("GIC%u: gicReadMmio: offReg=%#RX16 uValue=%#RX32\n", pVCpu->idCpu, offReg, uValue));
     209    return rc;
     210}
     211
     212
     213/**
     214 * @callback_method_impl{FNIOMMMIONEWWRITE}
     215 */
     216DECL_HIDDEN_CALLBACK(VBOXSTRICTRC) gicReDistMmioWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS off, void const *pv, unsigned cb)
     217{
     218    NOREF(pvUser);
     219    //Assert(!(off & 0xf));
     220    //Assert(cb == 4); RT_NOREF_PV(cb);
    178221
    179222    PVMCPUCC pVCpu    = PDMDevHlpGetVMCPU(pDevIns);
  • trunk/src/VBox/VMM/VMMR3/GICR3.cpp

    r99387 r99492  
    176176     * Register the MMIO ranges.
    177177     */
    178 #if 0
    179     rc = PDMDevHlpMmioCreateAndMap(pDevIns, GCPhysApicBase, sizeof(XAPICPAGE), apicWriteMmio, apicReadMmio,
    180                                    IOMMMIO_FLAGS_READ_DWORD | IOMMMIO_FLAGS_WRITE_DWORD_ZEROED, "APIC", &pApicDev->hMmio);
    181     AssertRCReturn(rc, rc);
    182 #endif
     178    RTGCPHYS GCPhysMmioBase = 0;
     179    rc = pHlp->pfnCFGMQueryU64(pCfg, "DistributorMmioBase", &GCPhysMmioBase);
     180    if (RT_FAILURE(rc))
     181        return PDMDEV_SET_ERROR(pDevIns, rc,
     182                                N_("Configuration error: Failed to get the \"DistributorMmioBase\" value"));
     183
     184    rc = PDMDevHlpMmioCreateAndMap(pDevIns, GCPhysMmioBase, GIC_DIST_REG_FRAME_SIZE, gicDistMmioWrite, gicDistMmioRead,
     185                                   IOMMMIO_FLAGS_READ_DWORD | IOMMMIO_FLAGS_WRITE_DWORD_ZEROED, "GICv3_Dist", &pGicDev->hMmioDist);
     186    AssertRCReturn(rc, rc);
     187
     188    rc = pHlp->pfnCFGMQueryU64(pCfg, "RedistributorMmioBase", &GCPhysMmioBase);
     189    if (RT_FAILURE(rc))
     190        return PDMDEV_SET_ERROR(pDevIns, rc,
     191                                N_("Configuration error: Failed to get the \"RedistributorMmioBase\" value"));
     192
     193    RTGCPHYS cbRegion = pVM->cCpus * (GIC_REDIST_REG_FRAME_SIZE + GIC_REDIST_SGI_PPI_REG_FRAME_SIZE); /* Adjacent and per vCPU. */
     194    rc = PDMDevHlpMmioCreateAndMap(pDevIns, GCPhysMmioBase, cbRegion, gicReDistMmioWrite, gicReDistMmioRead,
     195                                   IOMMMIO_FLAGS_READ_DWORD | IOMMMIO_FLAGS_WRITE_DWORD_ZEROED, "GICv3_ReDist", &pGicDev->hMmioReDist);
     196    AssertRCReturn(rc, rc);
    183197
    184198    /*
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