VirtualBox

Ignore:
Timestamp:
Apr 21, 2025 7:01:04 AM (2 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
168562
Message:

VMM/GIC: bugref:10877 Some GIC, ITS cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/include/GICInternal.h

    r109021 r109033  
    7474    do \
    7575    { \
    76         int const rcLock = PDMDevHlpCritSectEnter(pDevIns, pDevIns->pCritSectRoR3, VINF_SUCCESS); \
    77         PDM_CRITSECT_RELEASE_ASSERT_RC_DEV(pDevIns, pDevIns->pCritSectRoR3, rcLock); \
     76        int const rcLock_ = PDMDevHlpCritSectEnter((a_pDevIns), (a_pDevIns)->pCritSectRoR3, VINF_SUCCESS); \
     77        PDM_CRITSECT_RELEASE_ASSERT_RC_DEV((a_pDevIns), (a_pDevIns)->pCritSectRoR3, rcLock_); \
    7878    } while(0)
    7979
     
    8383/** Returns whether the critical section is held. */
    8484#define GIC_CRIT_SECT_IS_OWNER(a_pDevIns)       PDMDevHlpCritSectIsOwner((a_pDevIns), (a_pDevIns)->CTX_SUFF(pCritSectRo))
     85
     86/** Returns whether the given register offset is within the specified range. */
     87#define GIC_IS_REG_IN_RANGE(a_offReg, a_offFirst, a_cbRegion)    ((uint32_t)(a_offReg) - (a_offFirst) < (a_cbRegion))
     88
     89/** @def GIC_SET_REG_U64_FULL
     90 * Sets a 64-bit GIC register.
     91 * @param   a_uReg      The 64-bit register to set.
     92 * @param   a_uValue    The 64-bit value being written.
     93 * @param   a_fRwMask   The 64-bit mask of valid read-write bits.
     94 */
     95#define GIC_SET_REG_U64_FULL(a_uReg, a_uValue, a_fRwMask) \
     96    do \
     97    { \
     98        AssertCompile(sizeof(a_uReg) == sizeof(uint64_t)); \
     99        AssertCompile(sizeof(a_fRwMask) == sizeof(uint64_t)); \
     100        (a_uReg) = ((a_uReg) & ~(a_fRwMask)) | ((a_uValue) & (a_fRwMask)); \
     101    } while (0)
     102
     103/** @def GIC_SET_REG_U64_LO
     104 * Sets the lower half of a 64-bit GIC register.
     105 * @param   a_uReg      The lower half of a 64-bit register to set.
     106 * @param   a_uValue    The value being written (only lower 32-bits are used).
     107 * @param   a_fRwMask   The 64-bit mask of valid read-write bits.
     108 */
     109#define GIC_SET_REG_U64_LO(a_uReg, a_uValue, a_fRwMask) \
     110    do \
     111    { \
     112        AssertCompile(sizeof(a_uReg) == sizeof(uint32_t)); \
     113        AssertCompile(sizeof(a_fRwMask) == sizeof(uint64_t)); \
     114        (a_uReg) = ((a_uReg) & ~(RT_LO_U32(a_fRwMask))) | ((uint32_t)(a_uValue) & (RT_LO_U32(a_fRwMask))); \
     115    } while (0)
     116
     117/** @def GIC_SET_REG_U64_HI
     118 * Sets the upper half of a 64-bit GIC register.
     119 * @param   a_uReg      The upper half of the 64-bit register to set.
     120 * @param   a_uValue    The value being written (only lower 32-bits are used).
     121 * @param   a_fRwMask   The 64-bit mask of valid read-write bits.
     122 */
     123#define GIC_SET_REG_U64_HI(a_uReg, a_uValue, a_fRwMask) \
     124    do \
     125    { \
     126        AssertCompile(sizeof(a_uReg) == sizeof(uint32_t)); \
     127        AssertCompile(sizeof(a_fRwMask) == sizeof(uint64_t)); \
     128        (a_uReg) = ((a_uReg) & ~(RT_HI_U32(a_fRwMask))) | ((uint32_t)(a_uValue) & (RT_HI_U32(a_fRwMask))); \
     129    } while (0)
     130
     131/** @def GIC_SET_REG_U32
     132 * Sets a 32-bit GIC register.
     133 * @param   a_uReg      The 32-bit register to set.
     134 * @param   a_uValue    The 32-bit value being written (only lower 32-bits are
     135 *                      used).
     136 * @param   a_fRwMask   The mask of valid read-write bits (only lower 32-bits are
     137 *                      used).
     138 */
     139#define GIC_SET_REG_U32(a_uReg, a_uValue, a_fRwMask) \
     140    do \
     141    { \
     142        AssertCompile(sizeof(a_uReg) == sizeof(uint32_t)); \
     143        (a_uReg) = ((a_uReg) & ~(a_fRwMask)) | ((uint32_t)(a_uValue) & (uint32_t)(a_fRwMask)); \
     144    } while (0)
     145
    85146
    86147/**
     
    114175    /** Flag whether affinity routing is enabled. */
    115176    bool                        fAffRoutingEnabled;
    116     /** Alignment. */
    117     bool                        fPadding0;
    118177    /** @} */
    119178
     
    147206    /** The maximum LPI supported (GICD_TYPER.num_LPI). */
    148207    uint8_t                     uMaxLpi;
     208    /** @} */
     209
     210    /** @name GITS device data and LPIs.
     211     * @{ */
     212    /** Whether LPIs are enabled (GICR_CTLR.EnableLpis of all redistributors). */
     213    bool                        fEnableLpis;
    149214    /** Padding. */
    150     bool                        afPadding0[3];
    151     /** @} */
    152 
    153     /** @name GITS device data and LPIs.
    154      * @{ */
     215    bool                        afPadding1[3];
    155216    /** ITS device state. */
    156217    GITSDEV                     Gits;
     
    161222    /** The LPI pending table base register (GICR_PENDBASER). */
    162223    RTUINT64U                   uLpiPendingBaseReg;
    163     /** Whether LPIs are enabled (GICR_CTLR.EnableLpis of all redistributors). */
    164     bool                        fEnableLpis;
    165     /** Padding. */
    166     bool                        afPadding1[7];
    167224    /** @} */
    168225
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