VirtualBox

Changeset 88600 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Apr 20, 2021 11:23:33 AM (4 years ago)
Author:
vboxsync
Message:

Intel IOMMU: bugref:9967 IQA WIP.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/DevIommuIntel.cpp

    r88596 r88600  
    139139    kDmarDiag_None = 0,
    140140    kDmarDiag_IqtReg_Qt_NotAligned,
     141    kDmarDiag_IqaReg_Dw_Invalid,
    141142    /* Last member for determining array index limit. */
    142143    kDmarDiag_End
     
    150151static const char *const g_apszDmarDiagDesc[] =
    151152{
    152     DMARDIAG_DESC(kNone,                            "None"                ),
    153     DMARDIAG_DESC(kDmarDiag_IqtReg_Qt_NotAligned,   "IqtReg_Qt_NotAligned")
     153    DMARDIAG_DESC(kNone                         , "None"                ),
     154    DMARDIAG_DESC(kDmarDiag_IqtReg_Qt_NotAligned, "IqtReg_Qt_NotAligned"),
     155    DMARDIAG_DESC(kDmarDiag_IqaReg_Dw_Invalid   , "IqaReg_Dw_Invalid"   )
    154156    /* kDmarDiag_End */
    155157};
     
    841843 * @param   pThisCC     The current-context DMAR device state.
    842844 */
    843 static void dmarFaultRaiseInterrupt(PPDMDEVINS pDevIns, PDMAR pThis, PCDMARCC pThisCC)
    844 {
     845static void dmarFaultRaiseInterrupt(PPDMDEVINS pDevIns)
     846{
     847    PDMAR    pThis   = PDMDEVINS_2_DATA(pDevIns, PDMAR);
     848    PCDMARCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PCDMARCC);
    845849#ifdef RT_STRICT
    846850    {
     
    918922
    919923/**
    920  * Records an IQE (invalidation queue error) fault.
     924 * Records an IQE fault.
    921925 *
    922926 * @param   pDevIns     The IOMMU device instance.
     
    941945    dmarRegChange64(pThis, VTD_MMIO_OFF_IQERCD_REG, UINT64_MAX, fIqei);
    942946
    943     dmarFaultRaiseInterrupt(pDevIns, pThis, pThisCC);
     947    dmarFaultRaiseInterrupt(pDevIns);
    944948}
    945949
     
    956960static VBOXSTRICTRC dmarCcmdRegWrite(PPDMDEVINS pDevIns, uint16_t off, uint8_t cb, uint64_t uCcmdReg)
    957961{
    958     /* We only care about responding to high 32-bits writes, low 32-bits are data. */
     962    /* At present, we only care about responding to high 32-bits writes, low 32-bits are data. */
    959963    if (off + cb > VTD_MMIO_OFF_CCMD_REG + 4)
    960964    {
     
    10181022
    10191023/**
     1024 * Handles writes to IQA_REG.
     1025 *
     1026 * @returns Strict VBox status code.
     1027 * @param   pDevIns     The IOMMU device instance.
     1028 * @param   off         The MMIO register offset.
     1029 * @param   cb          The size of the MMIO access (in bytes).
     1030 * @param   uIqaReg     The value written to IQA_REG.
     1031 */
     1032static VBOXSTRICTRC dmarIqaRegWrite(PPDMDEVINS pDevIns, uint16_t off, uint64_t uIqaReg)
     1033{
     1034    /** @todo Don't allow writing this when GSTS.QIES is set? */
     1035
     1036    /* At present, we only care about the low 32-bits, high 32-bits are data. */
     1037    if (off == VTD_MMIO_OFF_IQA_REG)
     1038    {
     1039        PDMAR pThis = PDMDEVINS_2_DATA(pDevIns, PDMAR);
     1040        uint8_t const fDw = RT_BF_GET(uIqaReg, VTD_BF_IQA_REG_DW);
     1041        if (fDw == VTD_IQA_REG_DW_256_BIT)
     1042        {
     1043            uint64_t const fDwMask           = VTD_BF_ECAP_REG_SMTS_MASK | VTD_BF_ECAP_REG_ADMS_MASK;
     1044            bool const     fSupports256BitDw = RT_BOOL(pThis->fExtCap & fDwMask);
     1045            if (fSupports256BitDw)
     1046            { /* likely */ }
     1047            else
     1048                dmarIqeFaultRecord(pDevIns, kDmarDiag_IqaReg_Dw_Invalid, kInvalidDescriptorWidth);
     1049        }
     1050    }
     1051    return VINF_SUCCESS;
     1052}
     1053
     1054
     1055/**
    10201056 * Memory access bulk (one or more 4K pages) request from a device.
    10211057 *
     
    11111147            {
    11121148                rcStrict = dmarCcmdRegWrite(pDevIns, offReg, cb, uRegWritten);
     1149                break;
     1150            }
     1151
     1152            case VTD_MMIO_OFF_IQA_REG:
     1153            case VTD_MMIO_OFF_IQA_REG + 4:
     1154            {
     1155                rcStrict = dmarIqaRegWrite(pDevIns, offReg, uRegWritten);
    11131156                break;
    11141157            }
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