Changeset 89201 in vbox for trunk/src/VBox/Devices/Bus
- Timestamp:
- May 20, 2021 2:05:41 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144542
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuIntel.cpp
r89195 r89201 661 661 * 662 662 * @returns @c true if qualified, @c false otherwise. 663 * @param enmI rFaultThe interrupt remapping fault condition.664 */ 665 static bool vtdIrFaultIsQualified(VTD _IR_FAULT_T enmIrFault)666 { 667 switch (enmI rFault)668 { 669 case kIrf_Irte_Not_Present:670 case kIrf_Irte_Present_Rsvd:671 case kIrf_Irte_Present_Invalid:672 case kIrf_Pid_Read_Failed:673 case kIrf_Pid_Rsvd:663 * @param enmIntrFault The interrupt remapping fault condition. 664 */ 665 static bool vtdIrFaultIsQualified(VTDINTRFAULT enmIntrFault) 666 { 667 switch (enmIntrFault) 668 { 669 case VTDINTRFAULT_IRTE_NOT_PRESENT: 670 case VTDINTRFAULT_IRTE_PRESENT_RSVD: 671 case VTDINTRFAULT_IRTE_PRESENT_INVALID: 672 case VTDINTRFAULT_PID_READ_FAILED: 673 case VTDINTRFAULT_PID_RSVD: 674 674 return true; 675 675 default: … … 1239 1239 * Records an interrupt request fault. 1240 1240 * 1241 * @param pDevIns The IOMMU device instance.1242 * @param enmDiag The diagnostic reason.1243 * @param enmI rFaultThe interrupt fault reason.1244 * @param idDevice The device ID (bus, device, function).1245 * @param idxIntr The interrupt index.1246 */ 1247 static void dmarIrFaultRecord(PPDMDEVINS pDevIns, DMARDIAG enmDiag, VTD _IR_FAULT_T enmIrFault, uint16_t idDevice,1241 * @param pDevIns The IOMMU device instance. 1242 * @param enmDiag The diagnostic reason. 1243 * @param enmIntrFault The interrupt fault reason. 1244 * @param idDevice The device ID (bus, device, function). 1245 * @param idxIntr The interrupt index. 1246 */ 1247 static void dmarIrFaultRecord(PPDMDEVINS pDevIns, DMARDIAG enmDiag, VTDINTRFAULT enmIntrFault, uint16_t idDevice, 1248 1248 uint16_t idxIntr) 1249 1249 { … … 1263 1263 /* Update the fault recording registers with the fault information. */ 1264 1264 uint64_t const uFrcdHi = RT_BF_MAKE(VTD_BF_1_FRCD_REG_SID, idDevice) 1265 | RT_BF_MAKE(VTD_BF_1_FRCD_REG_FR, enmI rFault)1265 | RT_BF_MAKE(VTD_BF_1_FRCD_REG_FR, enmIntrFault) 1266 1266 | RT_BF_MAKE(VTD_BF_1_FRCD_REG_F, 1); 1267 1267 uint64_t const uFrcdLo = (uint64_t)idxIntr << 48; … … 1286 1286 * in the IRTE. 1287 1287 * 1288 * @param pDevIns The IOMMU device instance.1289 * @param enmDiag The diagnostic reason.1290 * @param enmI rFaultThe interrupt fault reason.1291 * @param idDevice The device ID (bus, device, function).1292 * @param idxIntr The interrupt index.1293 * @param pIrte The IRTE that caused this fault.1294 */ 1295 static void dmarIrFaultRecordQualified(PPDMDEVINS pDevIns, DMARDIAG enmDiag, VTD _IR_FAULT_T enmIrFault, uint16_t idDevice,1288 * @param pDevIns The IOMMU device instance. 1289 * @param enmDiag The diagnostic reason. 1290 * @param enmIntrFault The interrupt fault reason. 1291 * @param idDevice The device ID (bus, device, function). 1292 * @param idxIntr The interrupt index. 1293 * @param pIrte The IRTE that caused this fault. 1294 */ 1295 static void dmarIrFaultRecordQualified(PPDMDEVINS pDevIns, DMARDIAG enmDiag, VTDINTRFAULT enmIntrFault, uint16_t idDevice, 1296 1296 uint16_t idxIntr, PCVTD_IRTE_T pIrte) 1297 1297 { 1298 Assert(vtdIrFaultIsQualified(enmI rFault));1298 Assert(vtdIrFaultIsQualified(enmIntrFault)); 1299 1299 Assert(pIrte); 1300 1300 if (!(pIrte->au64[0] & VTD_BF_0_IRTE_FPD_MASK)) 1301 return dmarIrFaultRecord(pDevIns, enmDiag, enmI rFault, idDevice, idxIntr);1301 return dmarIrFaultRecord(pDevIns, enmDiag, enmIntrFault, idDevice, idxIntr); 1302 1302 } 1303 1303 … … 1310 1310 * @param enmDiag The diagnostic reason. 1311 1311 */ 1312 static void dmarIqeFaultRecord(PPDMDEVINS pDevIns, DMARDIAG enmDiag, VTD _IQEI_TenmIqei)1312 static void dmarIqeFaultRecord(PPDMDEVINS pDevIns, DMARDIAG enmDiag, VTDIQEI enmIqei) 1313 1313 { 1314 1314 PDMAR pThis = PDMDEVINS_2_DATA(pDevIns, PDMAR); … … 1539 1539 /* Hardware treats bit 4 as RsvdZ in this situation, so clear it. */ 1540 1540 dmarRegChangeRaw32(pThis, offReg, ~RT_BIT(4), 0 /* fOrMask */); 1541 dmarIqeFaultRecord(pDevIns, kDmarDiag_IqtReg_Qt_NotAligned, kIqei_QueueTailNotAligned);1541 dmarIqeFaultRecord(pDevIns, kDmarDiag_IqtReg_Qt_NotAligned, VTDIQEI_QUEUE_TAIL_MISALIGNED); 1542 1542 } 1543 1543 return VINF_SUCCESS; … … 1570 1570 { /* likely */ } 1571 1571 else 1572 dmarIqeFaultRecord(pDevIns, kDmarDiag_IqaReg_Dw_256_Invalid, kIqei_InvalidDescriptorWidth);1572 dmarIqeFaultRecord(pDevIns, kDmarDiag_IqaReg_Dw_256_Invalid, VTDIQEI_INVALID_DESCRIPTOR_WIDTH); 1573 1573 } 1574 1574 /* else: 128-bit descriptor width is validated lazily, see explanation in dmarR3InvQueueProcessRequests. */ … … 1701 1701 1702 1702 DMAR_LOCK(pDevIns, pThisCC); 1703 uint32_t const uGstsReg = dmarRegReadRaw32(pThis, VTD_MMIO_OFF_GSTS_REG); 1703 uint32_t const uGstsReg = dmarRegReadRaw32(pThis, VTD_MMIO_OFF_GSTS_REG); 1704 uint64_t const uRtaddrReg = pThis->uRtaddrReg; 1704 1705 DMAR_UNLOCK(pDevIns, pThisCC); 1706 1705 1707 1706 1708 if (uGstsReg & VTD_BF_GSTS_REG_TES_MASK) … … 1710 1712 else 1711 1713 STAM_COUNTER_INC(&pThis->CTX_SUFF_Z(StatMemWrite)); 1714 1715 uint8_t const fTtm = RT_BF_GET(uRtaddrReg, VTD_BF_RTADDR_REG_TTM); 1716 switch (fTtm) 1717 { 1718 case VTD_TTM_LEGACY_MODE: 1719 case VTD_TTM_ABORT_DMA_MODE: 1720 { 1721 if (pThis->fExtCapReg & VTD_BF_ECAP_REG_ADMS_MASK) 1722 { 1723 1724 } 1725 } 1726 } 1712 1727 1713 1728 return VERR_NOT_IMPLEMENTED; … … 1884 1899 return VINF_SUCCESS; 1885 1900 } 1886 dmarIrFaultRecordQualified(pDevIns, kDmarDiag_Ir_Rfi_Irte_Mode_Invalid, kIrf_Irte_Present_Rsvd,1887 idDevice, idxIntr, &Irte);1901 dmarIrFaultRecordQualified(pDevIns, kDmarDiag_Ir_Rfi_Irte_Mode_Invalid, 1902 VTDINTRFAULT_IRTE_PRESENT_RSVD, idDevice, idxIntr, &Irte); 1888 1903 } 1889 1904 else 1890 dmarIrFaultRecordQualified(pDevIns, enmIrDiag, kIrf_Irte_Present_Rsvd, idDevice, idxIntr, &Irte); 1905 dmarIrFaultRecordQualified(pDevIns, enmIrDiag, VTDINTRFAULT_IRTE_PRESENT_RSVD, idDevice, idxIntr, 1906 &Irte); 1891 1907 } 1892 1908 else 1893 dmarIrFaultRecordQualified(pDevIns, kDmarDiag_Ir_Rfi_Irte_Rsvd, kIrf_Irte_Present_Rsvd, idDevice,1909 dmarIrFaultRecordQualified(pDevIns, kDmarDiag_Ir_Rfi_Irte_Rsvd, VTDINTRFAULT_IRTE_PRESENT_RSVD, idDevice, 1894 1910 idxIntr, &Irte); 1895 1911 } 1896 1912 else 1897 dmarIrFaultRecordQualified(pDevIns, kDmarDiag_Ir_Rfi_Irte_Not_Present, kIrf_Irte_Not_Present, idDevice,1898 id xIntr, &Irte);1913 dmarIrFaultRecordQualified(pDevIns, kDmarDiag_Ir_Rfi_Irte_Not_Present, VTDINTRFAULT_IRTE_NOT_PRESENT, 1914 idDevice, idxIntr, &Irte); 1899 1915 } 1900 1916 else 1901 dmarIrFaultRecord(pDevIns, kDmarDiag_Ir_Rfi_Irte_Read_Failed, kIrf_Irte_Read_Failed, idDevice, idxIntr);1917 dmarIrFaultRecord(pDevIns, kDmarDiag_Ir_Rfi_Irte_Read_Failed, VTDINTRFAULT_IRTE_READ_FAILED, idDevice, idxIntr); 1902 1918 } 1903 1919 else 1904 dmarIrFaultRecord(pDevIns, kDmarDiag_Ir_Rfi_Intr_Index_Invalid, kIrf_Intr_Index_Invalid, idDevice, idxIntr);1920 dmarIrFaultRecord(pDevIns, kDmarDiag_Ir_Rfi_Intr_Index_Invalid, VTDINTRFAULT_INTR_INDEX_INVALID, idDevice, idxIntr); 1905 1921 } 1906 1922 else 1907 dmarIrFaultRecord(pDevIns, kDmarDiag_Ir_Rfi_Rsvd, kIrf_Remappable_Intr_Rsvd, idDevice, 0 /* idxIntr */);1923 dmarIrFaultRecord(pDevIns, kDmarDiag_Ir_Rfi_Rsvd, VTDINTRFAULT_REMAPPABLE_INTR_RSVD, idDevice, 0 /* idxIntr */); 1908 1924 return VERR_IOMMU_INTR_REMAP_DENIED; 1909 1925 } … … 1949 1965 || !(uGstsReg & VTD_BF_GSTS_REG_CFIS_MASK)) 1950 1966 { 1951 dmarIrFaultRecord(pDevIns, kDmarDiag_Ir_Cfi_Blocked, kIrf_Cfi_Blocked, idDevice, 0 /* idxIntr */);1967 dmarIrFaultRecord(pDevIns, kDmarDiag_Ir_Cfi_Blocked, VTDINTRFAULT_CFI_BLOCKED, idDevice, 0 /* idxIntr */); 1952 1968 return VERR_IOMMU_INTR_REMAP_DENIED; 1953 1969 } … … 2147 2163 { /* likely */ } 2148 2164 else 2149 DMAR_IQE_FAULT_RECORD_RET(kDmarDiag_IqaReg_Dw_128_Invalid, kIqei_InvalidDescriptorWidth);2165 DMAR_IQE_FAULT_RECORD_RET(kDmarDiag_IqaReg_Dw_128_Invalid, VTDIQEI_INVALID_DESCRIPTOR_WIDTH); 2150 2166 #endif 2151 2167 … … 2169 2185 { /* likely */ } 2170 2186 else 2171 DMAR_IQE_FAULT_RECORD_RET(kDmarDiag_Iqei_Inv_Wait_Dsc_Invalid, kIqei_InvalidDescriptorType);2187 DMAR_IQE_FAULT_RECORD_RET(kDmarDiag_Iqei_Inv_Wait_Dsc_Invalid, VTDIQEI_INVALID_DESCRIPTOR_TYPE); 2172 2188 2173 2189 /* Validate reserved bits. */ … … 2179 2195 { /* likely */ } 2180 2196 else 2181 DMAR_IQE_FAULT_RECORD_RET(kDmarDiag_Iqei_Inv_Wait_Dsc_0_1_Rsvd, kIqei_RsvdFieldViolation);2197 DMAR_IQE_FAULT_RECORD_RET(kDmarDiag_Iqei_Inv_Wait_Dsc_0_1_Rsvd, VTDIQEI_RSVD_FIELD_VIOLATION); 2182 2198 2183 2199 if (fDw == VTD_IQA_REG_DW_256_BIT) … … 2187 2203 { /* likely */ } 2188 2204 else 2189 DMAR_IQE_FAULT_RECORD_RET(kDmarDiag_Iqei_Inv_Wait_Dsc_2_3_Rsvd, kIqei_RsvdFieldViolation);2205 DMAR_IQE_FAULT_RECORD_RET(kDmarDiag_Iqei_Inv_Wait_Dsc_2_3_Rsvd, VTDIQEI_RSVD_FIELD_VIOLATION); 2190 2206 } 2191 2207 … … 2224 2240 /* Stop processing further requests. */ 2225 2241 LogFunc(("Invalid descriptor type: %#x\n", fDscType)); 2226 DMAR_IQE_FAULT_RECORD_RET(kDmarDiag_Iqei_Dsc_Type_Invalid, kIqei_InvalidDescriptorType);2242 DMAR_IQE_FAULT_RECORD_RET(kDmarDiag_Iqei_Dsc_Type_Invalid, VTDIQEI_INVALID_DESCRIPTOR_TYPE); 2227 2243 } 2228 2244 } … … 2366 2382 } 2367 2383 else 2368 dmarIqeFaultRecord(pDevIns, kDmarDiag_IqaReg_Dsc_Fetch_Error, kIqei_FetchDescriptorError);2384 dmarIqeFaultRecord(pDevIns, kDmarDiag_IqaReg_Dsc_Fetch_Error, VTDIQEI_FETCH_DESCRIPTOR_ERR); 2369 2385 } 2370 2386 else 2371 2387 { 2372 2388 if (fTtm == VTD_TTM_RSVD) 2373 dmarIqeFaultRecord(pDevIns, kDmarDiag_Iqei_Ttm_Rsvd, kIqei_InvalidTtm);2389 dmarIqeFaultRecord(pDevIns, kDmarDiag_Iqei_Ttm_Rsvd, VTDIQEI_INVALID_TTM); 2374 2390 else 2375 2391 { 2376 2392 Assert(offQueueTail >= cbQueue); 2377 dmarIqeFaultRecord(pDevIns, kDmarDiag_IqtReg_Qt_Invalid, kIqei_InvalidTailPointer);2393 dmarIqeFaultRecord(pDevIns, kDmarDiag_IqtReg_Qt_Invalid, VTDIQEI_INVALID_TAIL_PTR); 2378 2394 } 2379 2395 }
Note:
See TracChangeset
for help on using the changeset viewer.