VirtualBox

Changeset 107984 in vbox


Ignore:
Timestamp:
Jan 30, 2025 6:43:18 AM (3 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
167247
Message:

VMM/GIC: bugref:10404 CFGM bits.

Location:
trunk
Files:
4 edited

Legend:

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

    r107957 r107984  
    162162# define GIC_DIST_REG_TYPER_ESPI_RANGE                  (  RT_BIT_32(27) | RT_BIT_32(28) | RT_BIT(29) \
    163163                                                         | RT_BIT_32(30) | RT_BIT_32(31))
     164# define GIC_DIST_REG_TYPER_ESPI_RANGE_BIT              27
    164165# define GIC_DIST_REG_TYPER_ESPI_RANGE_SET(a_Range)     (((a_Range) << 27) & GIC_DIST_REG_TYPER_ESPI_RANGE)
    165166
  • trunk/src/VBox/VMM/VMMAll/GICAll.cpp

    r107957 r107984  
    407407            break;
    408408        case GIC_DIST_REG_TYPER_OFF:
    409             *puValue =   GIC_DIST_REG_TYPER_NUM_ITLINES_SET(pThis->uItLinesNumber)
     409            Assert(pThis->uMaxSpi > 0 && pThis->uMaxSpi < GIC_DIST_REG_TYPER_NUM_ITLINES);
     410            *puValue =   GIC_DIST_REG_TYPER_NUM_ITLINES_SET(pThis->uMaxSpi)
    410411                       | GIC_DIST_REG_TYPER_NUM_PES_SET(0)      /* 1 PE */ /** @todo r=ramshankar: Should this be pVCpu->cCpus? Currently it means 'ARE' must always be used? */
    411412                       /*| GIC_DIST_REG_TYPER_ESPI*/            /** @todo */
  • trunk/src/VBox/VMM/VMMR3/GICR3.cpp

    r107957 r107984  
    398398    PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "DistributorMmioBase|RedistributorMmioBase|ItsMmioBase"
    399399                                           "|ArchRev"
    400                                            "|ArchExtNmi"
    401                                            "|ItLinesNumber", "");
     400                                           "|Nmi"
     401                                           "|MaxSpi"
     402                                           "|MaxExtSpi"
     403                                           "|PpiNum", "");
    402404
    403405#if 0
     
    422424    else
    423425        return PDMDevHlpVMSetError(pDevIns, VERR_INVALID_PARAMETER, RT_SRC_POS,
    424                                    N_("Configuration error: \"ArchRev\" %u is not supported"), pGicDev->uArchRev);
    425 
    426     /** @devcfgm{gic, ArchExtNmi, bool, false}
     426                                   N_("Configuration error: \"ArchRev\" value %u is not supported"), pGicDev->uArchRev);
     427
     428    /** @devcfgm{gic, Nmi, bool, false}
    427429     * Configures whether NMIs are supported (GICD_TYPER.NMI). */
    428     rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "ArchExtNmi", &pGicDev->fNmi, false);
    429     AssertLogRelRCReturn(rc, rc);
    430     if (   !pGicDev->fNmi
    431         || pGicDev->uArchRev >= 3)
     430    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "Nmi", &pGicDev->fNmi, false);
     431    AssertLogRelRCReturn(rc, rc);
     432
     433    /** @devcfgm{gic, ExtSpi, bool, false}
     434     * Configures whether extended SPIs are supported (GICD_TYPER.ESPI). */
     435    rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "ExtSpi", &pGicDev->fExtSpi, false);
     436    AssertLogRelRCReturn(rc, rc);
     437
     438    /** @devcfgm{gic, MaxSpi, uint16_t, 1}
     439     * Configures GICD_TYPER.ItLinesNumber.
     440     *
     441     * For the INTID range [32,1023], configures the maximum SPI supported. Valid values
     442     * are [1,31] which equates to interrupt IDs [63,1023]. A value of 0 implies SPIs
     443     * are supported. We don't allow configuring this value as it's expected that
     444     * most guests would assume support for SPIs. */
     445    AssertCompile(GIC_DIST_REG_TYPER_NUM_ITLINES == 31);
     446    rc = pHlp->pfnCFGMQueryU16Def(pCfg, "MaxSpi", &pGicDev->uMaxSpi, 1 /* 63 INTIDs */);
     447    AssertLogRelRCReturn(rc, rc);
     448    if (pGicDev->uMaxSpi - 1 < 31)
    432449    { /* likely */ }
    433450    else
    434451        return PDMDevHlpVMSetError(pDevIns, VERR_INVALID_PARAMETER, RT_SRC_POS,
    435                                    N_("Configuration error: \"ArchExtNmi\" requires architecture revision v3 or newer"));
    436 
    437     /** @devcfgm{gic, ItLinesNumber, uint16_t, 1}
    438      * Configures GICD_TYPER.ItLinesNumber, bits [4:0].
     452                                   N_("Configuration error: \"MaxSpi\" must be in the range [1,%u]"),
     453                                   GIC_DIST_REG_TYPER_NUM_ITLINES);
     454
     455    /** @devcfgm{gic, MaxExtSpi, uint16_t, 31}
     456     * Configures GICD_TYPER.ESPI_range.
    439457     *
    440      * For the INTID range 32-1023, configures the maximum SPI supported. Valid values
    441      * are [1, 31] which equates to interrupt IDs [63, 1023]. A value of 0 indicates no
    442      * SPIs are supported. We do not allow configuring this value as it's expected most
    443      * guests would assume support for SPIs. */
    444     rc = pHlp->pfnCFGMQueryU16Def(pCfg, "ItLinesNumber", &pGicDev->uItLinesNumber, 1 /* 63 interrupt IDs */);
    445     AssertLogRelRCReturn(rc, rc);
    446     if (   pGicDev->uItLinesNumber
    447         && !(pGicDev->uItLinesNumber & ~GIC_DIST_REG_TYPER_NUM_ITLINES))
     458     * For the extended SPI range [4096,5119], configures the maximum extended SPI
     459     * supported. Valid values are [0,31] which equates to extended SPI INTIDs
     460     * [4096,5119]. This is ignored (set to 0) when extended SPIs are disabled. */
     461    AssertCompile(GIC_DIST_REG_TYPER_ESPI_RANGE >> GIC_DIST_REG_TYPER_ESPI_RANGE_BIT == 31);
     462    rc = pHlp->pfnCFGMQueryU16Def(pCfg, "MaxExtSpi", &pGicDev->uMaxExtSpi, 31);
     463    AssertLogRelRCReturn(rc, rc);
     464    if (pGicDev->uMaxExtSpi <= 31)
    448465    { /* likely */ }
    449466    else
    450467        return PDMDevHlpVMSetError(pDevIns, VERR_INVALID_PARAMETER, RT_SRC_POS,
    451                                    N_("Configuration error: \"ItLinesNumber\" must be in the range [1,%u]"),
    452                                    GIC_DIST_REG_TYPER_NUM_ITLINES);
     468                                   N_("Configuration error: \"MaxExtSpi\" must be in the range [0,31]"));
     469
     470    /** @devcfgm{gic, MaxExtPpi, uint16_t, 0}
     471     * Configures GICR_TYPER.PPInum.
     472     *
     473     * For the extended PPI INTIDs [31,1056,1119], configures the maximum extended
     474     * PPI supported. Valid values are [0,1,2] which equates [31,1087,1119]. A value of
     475     * 0 implies extended PPIs are not supported. */
     476    rc = pHlp->pfnCFGMQueryU8Def(pCfg, "PpiNum", &pGicDev->fPpiNum, 0);
     477    AssertLogRelRCReturn(rc, rc);
     478    if (pGicDev->fPpiNum <= GIC_REDIST_REG_TYPER_PPI_NUM_MAX_1119)
     479    { /* likely */ }
     480    else
     481        return PDMDevHlpVMSetError(pDevIns, VERR_INVALID_PARAMETER, RT_SRC_POS,
     482                                   N_("Configuration error: \"PpiNum\" must be in the range [0,2]"));
    453483
    454484    /*
  • trunk/src/VBox/VMM/include/GICInternal.h

    r107957 r107984  
    105105    /** @name Configurables.
    106106     * @{ */
    107     /** The maximum SPI supported (GICD_TYPER.ItsLinesNumber). */
    108     uint16_t                    uItLinesNumber;
    109107    /** The GIC architecture (GICD_PIDR2.ArchRev and GICR_PIDR2.ArchRev). */
    110108    uint8_t                     uArchRev;
     109    /** Extended PPIs supported (GICR_TYPER.PpiNum). */
     110    uint8_t                     fPpiNum;
     111    /** Whether extended SPIs are supported (GICD_TYPER.ESPI). */
     112    bool                        fExtSpi;
    111113    /** Whether NMIs are supported (GICD_TYPER.NMI). */
    112114    bool                        fNmi;
     115    /** The maximum SPI supported (GICD_TYPER.ItsLinesNumber). */
     116    uint16_t                    uMaxSpi;
     117    /** Maximum extended SPI supported (GICR_TYPER.ESPI_range).  */
     118    uint16_t                    uMaxExtSpi;
    113119    /** @} */
    114120} GICDEV;
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