VirtualBox

Changeset 108976 in vbox


Ignore:
Timestamp:
Apr 15, 2025 12:30:07 PM (5 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
168496
Message:

VMM/GIC: bugref:10877 Minus 1 bites us again and LPI configuration table work-in-progress.

Location:
trunk
Files:
3 edited

Legend:

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

    r108946 r108976  
    728728/** GITS LPI Configuration   */
    729729/** GITS LPI CTE: Enable. */
    730 #define GITS_BF_LPI_CTE_ENABLE_SHIFT                            0
    731 #define GITS_BF_LPI_CTE_ENABLE_MASK                             UINT8_C(0x1)
     730#define GIC_BF_LPI_CTE_ENABLE_SHIFT                     0
     731#define GIC_BF_LPI_CTE_ENABLE_MASK                      UINT8_C(0x1)
    732732/** GITS LPI CTE: Reserved (bit 1). */
    733 #define GITS_BF_LPI_CTE_RSVD_1_SHIFT                            1
    734 #define GITS_BF_LPI_CTE_RSVD_1_MASK                             UINT8_C(0x2)
     733#define GIC_BF_LPI_CTE_RSVD_1_SHIFT                     1
     734#define GIC_BF_LPI_CTE_RSVD_1_MASK                      UINT8_C(0x2)
    735735/** GITS LPI CTE: Priority. */
    736 #define GITS_BF_LPI_CTE_PRIORITY_SHIFT                          2
    737 #define GITS_BF_LPI_CTE_PRIORITY_MASK                           UINT8_C(0xfc)
    738 RT_BF_ASSERT_COMPILE_CHECKS(GITS_BF_LPI_CTE_, UINT8_C(0), UINT8_MAX,
     736#define GIC_BF_LPI_CTE_PRIORITY_SHIFT                   2
     737#define GIC_BF_LPI_CTE_PRIORITY_MASK                    UINT8_C(0xfc)
     738RT_BF_ASSERT_COMPILE_CHECKS(GIC_BF_LPI_CTE_, UINT8_C(0), UINT8_MAX,
    739739                            (ENABLE, RSVD_1, PRIORITY));
     740
     741/** Minimum number of bits required to enable LPIs (i.e. should accomodate
     742 *  GIC_INTID_RANGE_LPI_START). */
     743#define GIC_LPI_ID_BITS_MIN                             14
     744
    740745/** @} */
    741746
  • trunk/src/VBox/VMM/VMMAll/GICAll.cpp

    r108946 r108976  
    661661
    662662
     663static void gicDistReadLpiConfigTableFromMemory(PPDMDEVINS pDevIns, PGICDEV pGicDev)
     664{
     665    Assert(pGicDev->fEnableLpis);
     666    LogFlowFunc(("\n"));
     667
     668    /* Check if the guest is disabling LPIs by setting GICR_PROPBASER.IDBits < 13. */
     669    uint8_t const cIdBits = RT_BF_GET(pGicDev->uLpiConfigBaseReg.u, GIC_BF_REDIST_REG_PROPBASER_ID_BITS) + 1;
     670    if (cIdBits < GIC_LPI_ID_BITS_MIN)
     671        return;
     672
     673    /* Copy the LPI config table from guest memory to our internal cache. */
     674    Assert(UINT32_C(2) << pGicDev->uMaxLpi <= RT_ELEMENTS(pGicDev->abLpiConfig));
     675    RTGCPHYS const GCPhysLpiConfigTable = pGicDev->uLpiConfigBaseReg.u & GIC_BF_REDIST_REG_PROPBASER_PHYS_ADDR_MASK;
     676    uint32_t const cbLpiConfigTable     = sizeof(pGicDev->abLpiConfig);
     677
     678    /** @todo Try releasing and re-acquiring the device critical section here.
     679     *        Probably safe, but haven't verified this... */
     680    int const rc = PDMDevHlpPhysReadMeta(pDevIns, GCPhysLpiConfigTable, (void *)&pGicDev->abLpiConfig[0], cbLpiConfigTable);
     681    AssertRC(rc);
     682}
     683
     684
    663685/**
    664686 * Updates the internal IRQ state and sets or clears the appropriate force action
     
    20502072                     | (pGicDev->fMbi ? GIC_DIST_REG_TYPER_MBIS : 0)
    20512073                     | (pGicDev->fRangeSel ? GIC_DIST_REG_TYPER_RSS : 0)
    2052                      | GIC_DIST_REG_TYPER_IDBITS_SET(16)             /* We only support 16-bit interrupt IDs. */
     2074                     | GIC_DIST_REG_TYPER_IDBITS_SET(15)             /* We only support 16-bit interrupt IDs. */
    20532075                     | (pGicDev->fAff3Levels ? GIC_DIST_REG_TYPER_A3V : 0);
    20542076            if (pGicDev->fExtSpi)
     
    24612483        case GIC_REDIST_REG_CTLR_OFF:
    24622484            pGicDev->fEnableLpis = RT_BOOL(uValue & GIC_REDIST_REG_CTLR_ENABLE_LPI);
     2485            if (pGicDev->fEnableLpis)
     2486                gicDistReadLpiConfigTableFromMemory(pDevIns, pGicDev);
    24632487            break;
    24642488        case GIC_REDIST_REG_PROPBASER_OFF:
  • trunk/src/VBox/VMM/VMMR3/GICR3.cpp

    r108971 r108976  
    342342    }
    343343
    344     /* */
    345     {
    346 
    347     }
    348     /** @todo Dump LPI config and LPI pending registers. */
     344    /* LPI CTE (Configuration Table Entries). */
     345    {
     346        uint32_t const cLpiCtes   = RT_ELEMENTS(pGicDev->abLpiConfig);
     347        uint32_t       cLpiCtesEn = 0;
     348        for (uint32_t i = 0; i < cLpiCtes; i++)
     349            if (RT_BF_GET(pGicDev->abLpiConfig[i], GIC_BF_LPI_CTE_ENABLE))
     350                ++cLpiCtesEn;
     351
     352        pHlp->pfnPrintf(pHlp, "  LPI config table (capacity=%u entries, enabled=%u entries)%s\n", cLpiCtes, cLpiCtesEn,
     353                        cLpiCtesEn > 0 ? ":" : "");
     354        for (uint32_t i = 0; i < cLpiCtesEn; i++)
     355        {
     356            uint8_t const uLpiCte   = pGicDev->abLpiConfig[i];
     357            uint8_t const uPriority = RT_BF_GET(uLpiCte, GIC_BF_LPI_CTE_PRIORITY);
     358            pHlp->pfnPrintf(pHlp, "    [%4u]               = %#x (priority=%u)\n", uLpiCte, uPriority);
     359        }
     360    }
     361
     362    /** @todo Dump LPI pending registers. */
    349363}
    350364
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