Changeset 88694 in vbox
- Timestamp:
- Apr 24, 2021 6:07:05 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144011
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/iommu-intel.h
r88627 r88694 1358 1358 1359 1359 /** IQH_REG.QH: Gets the queue head. */ 1360 #define VTD_IQ T_REG_GET_QH(a) ((a) & (VTD_BF_IQH_REG_QH_MASK | VTD_BF_IQH_REG_RSVD_3_0_MASK))1360 #define VTD_IQH_REG_GET_QH(a) ((a) & (VTD_BF_IQH_REG_QH_MASK | VTD_BF_IQH_REG_RSVD_3_0_MASK)) 1361 1361 /** @} */ 1362 1362 -
trunk/src/VBox/Devices/Bus/DevIommuIntel.cpp
r88682 r88694 50 50 } while (0) 51 51 52 /** Checks whetherthe MMIO offset is valid. */52 /** Checks if the MMIO offset is valid. */ 53 53 #define DMAR_IS_MMIO_OFF_VALID(a_off) ( (a_off) < DMAR_MMIO_GROUP_0_OFF_END \ 54 54 || (a_off) - DMAR_MMIO_GROUP_1_OFF_FIRST < DMAR_MMIO_GROUP_1_SIZE) … … 855 855 856 856 /** 857 * Checks whetherthe invalidation-queue is empty.857 * Checks if the invalidation-queue is empty. 858 858 * 859 859 * @returns @c true if empty, @c false otherwise. … … 862 862 static bool dmarInvQueueIsEmpty(PCDMAR pThis) 863 863 { 864 uint64_t const uIqtReg = dmarRegRead64(pThis, VTD_MMIO_OFF_IQT_REG); 865 uint32_t const offQueueTail = VTD_IQT_REG_GET_QT(uIqtReg); 866 867 uint64_t const uIqhReg = dmarRegRead64(pThis, VTD_MMIO_OFF_IQH_REG); 868 uint32_t const offQueueHead = VTD_IQT_REG_GET_QH(uIqhReg); 869 870 return offQueueTail == offQueueHead; 871 } 872 873 874 /** 875 * Checks whether the invalidation-queue is capable of processing requests. 864 uint64_t const uIqtReg = dmarRegReadRaw64(pThis, VTD_MMIO_OFF_IQT_REG); 865 uint64_t const uIqhReg = dmarRegReadRaw64(pThis, VTD_MMIO_OFF_IQH_REG); 866 867 uint32_t const offQt = VTD_IQT_REG_GET_QT(uIqtReg); 868 uint32_t const offQh = VTD_IQH_REG_GET_QH(uIqhReg); 869 return offQt == offQh; 870 } 871 872 873 /** 874 * Checks if the invalidation-queue is capable of processing requests. 876 875 * 877 876 * @returns @c true if the invalidation-queue can process requests, @c false … … 882 881 { 883 882 /* Check if queued-invalidation is enabled. */ 884 uint32_t const uGstsReg = dmarRegRead 32(pThis, VTD_MMIO_OFF_GSTS_REG);883 uint32_t const uGstsReg = dmarRegReadRaw32(pThis, VTD_MMIO_OFF_GSTS_REG); 885 884 if (uGstsReg & VTD_BF_GSTS_REG_QIES_MASK) 886 885 { 887 886 /* Check if there are no invalidation-queue or timeout errors. */ 888 uint32_t const uFstsReg = dmarRegRead 32(pThis, VTD_MMIO_OFF_FSTS_REG);887 uint32_t const uFstsReg = dmarRegReadRaw32(pThis, VTD_MMIO_OFF_FSTS_REG); 889 888 if (!(uFstsReg & (VTD_BF_FSTS_REG_IQE_MASK | VTD_BF_FSTS_REG_ITE_MASK))) 890 889 return true; … … 928 927 #ifdef RT_STRICT 929 928 { 930 uint32_t const uFstsReg = dmarRegRead 32(pThis, VTD_MMIO_OFF_FSTS_REG);929 uint32_t const uFstsReg = dmarRegReadRaw32(pThis, VTD_MMIO_OFF_FSTS_REG); 931 930 uint32_t const fFaultMask = VTD_BF_FSTS_REG_PPF_MASK | VTD_BF_FSTS_REG_PFO_MASK 932 931 /* | VTD_BF_FSTS_REG_APF_MASK | VTD_BF_FSTS_REG_AFO_MASK */ /* AFL not supported */ … … 937 936 #endif 938 937 939 uint32_t uFectlReg = dmarRegRead 32(pThis, VTD_MMIO_OFF_FECTL_REG);938 uint32_t uFectlReg = dmarRegReadRaw32(pThis, VTD_MMIO_OFF_FECTL_REG); 940 939 if (!(uFectlReg & VTD_BF_FECTL_REG_IM_MASK)) 941 940 { 942 941 /* Software has unmasked the interrupt, raise it. */ 943 942 MSIMSG Msi; 944 Msi.Addr.u64 = RT_MAKE_U64(dmarRegRead 32(pThis, VTD_MMIO_OFF_FEADDR_REG),945 dmarRegRead 32(pThis, VTD_MMIO_OFF_FEUADDR_REG));946 Msi.Data.u32 = dmarRegRead 32(pThis, VTD_MMIO_OFF_FEDATA_REG);943 Msi.Addr.u64 = RT_MAKE_U64(dmarRegReadRaw32(pThis, VTD_MMIO_OFF_FEADDR_REG), 944 dmarRegReadRaw32(pThis, VTD_MMIO_OFF_FEUADDR_REG)); 945 Msi.Data.u32 = dmarRegReadRaw32(pThis, VTD_MMIO_OFF_FEDATA_REG); 947 946 948 947 /** @todo Assert Msi.Addr is in the MSR_IA32_APICBASE_ADDR range and ensure on … … 953 952 /* Clear interrupt pending bit. */ 954 953 uFectlReg &= ~VTD_BF_FECTL_REG_IP_MASK; 955 dmarRegWrite 32(pThis, VTD_MMIO_OFF_FECTL_REG, uFectlReg);954 dmarRegWriteRaw32(pThis, VTD_MMIO_OFF_FECTL_REG, uFectlReg); 956 955 } 957 956 else … … 959 958 /* Interrupt is masked, set the interrupt pending bit. */ 960 959 uFectlReg |= VTD_BF_FECTL_REG_IP_MASK; 961 dmarRegWrite 32(pThis, VTD_MMIO_OFF_FECTL_REG, uFectlReg);960 dmarRegWriteRaw32(pThis, VTD_MMIO_OFF_FECTL_REG, uFectlReg); 962 961 } 963 962 } … … 966 965 #if 0 967 966 /** 968 * Checks whethera primary fault can be recorded.967 * Checks if a primary fault can be recorded. 969 968 * 970 969 * @returns @c true if the fault can be recorded, @c false otherwise. … … 973 972 static bool dmarPrimaryFaultCanRecord(PDMAR pThis) 974 973 { 975 uint32_t uFstsReg = dmarRegRead 32(pThis, VTD_MMIO_OFF_FSTS_REG);974 uint32_t uFstsReg = dmarRegReadRaw32(pThis, VTD_MMIO_OFF_FSTS_REG); 976 975 if (uFstsReg & VTD_BF_FSTS_REG_PFO_MASK) 977 976 return false; … … 985 984 */ 986 985 AssertCompile(DMAR_FRCD_REG_COUNT == 1); 987 uint64_t const uFrcdRegHi = dmarRegRead 64(pThis, DMAR_MMIO_OFF_FRCD_HI_REG);986 uint64_t const uFrcdRegHi = dmarRegReadRaw64(pThis, DMAR_MMIO_OFF_FRCD_HI_REG); 988 987 if (uFrcdRegHi & VTD_BF_1_FRCD_REG_F_MASK) 989 988 { … … 1013 1012 DMAR_ASSERT_LOCK_IS_OWNER(pDevIns, pThisCC); 1014 1013 1015 /* Always update the latestdiagnostic reason. */1014 /* Update the diagnostic reason. */ 1016 1015 pThis->enmDiag = enmDiag; 1017 1016 … … 1038 1037 { 1039 1038 PDMAR pThis = PDMDEVINS_2_DATA(pDevIns, PDMAR); 1040 uint32_t const uGstsReg = dmarRegRead 32(pThis, VTD_MMIO_OFF_GSTS_REG);1039 uint32_t const uGstsReg = dmarRegReadRaw32(pThis, VTD_MMIO_OFF_GSTS_REG); 1041 1040 uint32_t const fChanged = uGstsReg ^ uGcmdReg; 1042 if (pThis->fExtCap & VTD_BF_ECAP_REG_QI_MASK) 1043 { 1044 if (fChanged & VTD_BF_GCMD_REG_QIE_MASK) 1041 1042 Assert(pThis->fExtCap & VTD_BF_ECAP_REG_QI_MASK); 1043 if (fChanged & VTD_BF_GCMD_REG_QIE_MASK) 1044 { 1045 if (uGcmdReg & VTD_BF_GCMD_REG_QIE_MASK) 1045 1046 { 1046 if (uGcmdReg & VTD_BF_GCMD_REG_QIE_MASK) 1047 { 1048 /* Enable the invalidation-queue. */ 1049 dmarRegChangeRaw32(pThis, VTD_MMIO_OFF_GSTS_REG, UINT32_MAX /* fAndMask */, 1050 VTD_BF_GSTS_REG_QIES_MASK /* fOrMask */); 1051 dmarInvQueueThreadWakeUpIfNeeded(pDevIns); 1052 } 1053 else 1054 { 1055 /* Disable the invalidation-queue and reset the queue head offset. */ 1056 dmarRegChangeRaw32(pThis, VTD_MMIO_OFF_GSTS_REG, ~VTD_BF_GSTS_REG_QIES_MASK /* fAndMask */, 0 /* fOrMask */); 1057 dmarRegWriteRaw32(pThis, VTD_MMIO_OFF_IQH_REG, 0); 1058 } 1047 /* Enable the invalidation-queue. */ 1048 dmarRegChangeRaw32(pThis, VTD_MMIO_OFF_GSTS_REG, UINT32_MAX /* fAndMask */, VTD_BF_GSTS_REG_QIES_MASK /* fOrMask */); 1049 dmarInvQueueThreadWakeUpIfNeeded(pDevIns); 1059 1050 } 1060 } 1061 1062 /** @todo Rest of the bits? */ 1051 else 1052 { 1053 /* Disable the invalidation-queue. */ 1054 dmarRegChangeRaw32(pThis, VTD_MMIO_OFF_GSTS_REG, ~VTD_BF_GSTS_REG_QIES_MASK /* fAndMask */, 0 /* fOrMask */); 1055 dmarRegWriteRaw32(pThis, VTD_MMIO_OFF_IQH_REG, 0); 1056 } 1057 } 1058 1059 /** @todo Rest of the bits. */ 1063 1060 1064 1061 return VINF_SUCCESS; … … 1122 1119 1123 1120 uint32_t const offQt = VTD_IQT_REG_GET_QT(uIqtReg); 1124 uint64_t const uIqaReg = dmarRegRead 64(pThis, VTD_MMIO_OFF_IQA_REG);1121 uint64_t const uIqaReg = dmarRegReadRaw64(pThis, VTD_MMIO_OFF_IQA_REG); 1125 1122 uint8_t const fDw = RT_BF_GET(uIqaReg, VTD_BF_IQA_REG_DW); 1126 1123 … … 1487 1484 | RT_BF_MAKE(VTD_BF_CAP_REG_PI, 0) /* Posted Interrupts not supported. */ 1488 1485 | RT_BF_MAKE(VTD_BF_CAP_REG_FL5LP, fFlts & fFl5lp) 1489 | RT_BF_MAKE(VTD_BF_CAP_REG_ESIRTPS, 0) /* Whetherwe invalidate interrupt cache on SIRTP flow. */1490 | RT_BF_MAKE(VTD_BF_CAP_REG_ESRTPS, 0); /* Whetherwe invalidate translation cache on SRTP flow. */1486 | RT_BF_MAKE(VTD_BF_CAP_REG_ESIRTPS, 0) /* If we invalidate interrupt cache on SIRTP flow. */ 1487 | RT_BF_MAKE(VTD_BF_CAP_REG_ESRTPS, 0); /* If we invalidate translation cache on SRTP flow. */ 1491 1488 dmarRegWriteRaw64(pThis, VTD_MMIO_OFF_CAP_REG, pThis->fCap); 1492 1489 }
Note:
See TracChangeset
for help on using the changeset viewer.