Changeset 89275 in vbox for trunk/src/VBox/Devices/Bus
- Timestamp:
- May 25, 2021 2:59:30 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144621
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuIntel.cpp
r89257 r89275 143 143 /** The current saved state version. */ 144 144 #define DMAR_SAVED_STATE_VERSION 1 145 146 /** @name DMAR_IO_PERM_XXX: DMAR I/O permissions. 147 * These are not according to the spec. other than the value of the READ and WRITE 148 * permissions. */ 149 #define DMAR_IO_PERM_READ RT_BIT(0) 150 #define DMAR_IO_PERM_WRITE RT_BIT(1) 151 #define DMAR_IO_PERM_EXECUTE RT_BIT(2) 152 #define DMAR_IO_PERM_SUPERVISOR RT_BIT(3) 153 /** @} */ 145 154 146 155 … … 418 427 } DMAREVENTTYPE; 419 428 420 421 429 /** 422 430 * DMA address map. … … 434 442 /** The size of the DMA access (in bytes). */ 435 443 size_t cbDma; 444 436 445 /** The translated system-physical address (HPA). */ 437 446 RTGCPHYS GCPhysSpa; … … 1890 1899 * @param pDevIns The IOMMU device instance. 1891 1900 * @param uRtaddrReg The current RTADDR_REG value. 1901 * @param enmAddrType The PCI memory request address type. 1892 1902 * @param pAddrRemap The DMA address remap info. 1893 1903 */ 1894 static int dmarDrLegacyModeRemapAddr(PPDMDEVINS pDevIns, uint64_t uRtaddrReg, P DMARADDRMAP pAddrRemap)1904 static int dmarDrLegacyModeRemapAddr(PPDMDEVINS pDevIns, uint64_t uRtaddrReg, PCIADDRTYPE enmAddrType, PDMARADDRMAP pAddrRemap) 1895 1905 { 1896 1906 uint8_t const idxRootEntry = RT_HI_U8(pAddrRemap->idDevice); … … 1921 1931 && !(uCtxEntryQword1 & ~VTD_CONTEXT_ENTRY_1_VALID_MASK)) 1922 1932 { 1923 /** @todo Handle context entry validation and processing. */ 1924 return VERR_NOT_IMPLEMENTED; 1933 PCDMAR pThis = PDMDEVINS_2_DATA(pDevIns, PCDMAR); 1934 uint8_t const fTt = RT_BF_GET(uCtxEntryQword0, VTD_BF_0_CONTEXT_ENTRY_TT); 1935 switch (fTt) 1936 { 1937 case 0: 1938 { 1939 if (enmAddrType == PCIADDRTYPE_UNTRANSLATED) 1940 { 1941 /** @todo perform second-level translation. */ 1942 return VERR_NOT_IMPLEMENTED; 1943 } 1944 Log4Func(("Translation type blocks translated and translation requests\n")); 1945 return VERR_IOMMU_ADDR_TRANSLATION_FAILED; 1946 } 1947 1948 case 2: 1949 { 1950 if (pThis->fExtCapReg & VTD_BF_ECAP_REG_PT_MASK) 1951 { 1952 pAddrRemap->GCPhysSpa = pAddrRemap->uDmaAddr; 1953 pAddrRemap->cbContiguous = pAddrRemap->cbDma; 1954 return VINF_SUCCESS; 1955 } 1956 RT_FALL_THRU(); 1957 } 1958 1959 case 1: 1960 { 1961 Assert(!(pThis->fExtCapReg & VTD_BF_ECAP_REG_DT_MASK)); 1962 RT_FALL_THRU(); 1963 } 1964 1965 default: 1966 { 1967 dmarAtFaultQualifiedRecord(pDevIns, kDmarDiag_Atf_Lct_4_2, VTDATFAULT_LCT_4_2, 1968 pAddrRemap->idDevice, pAddrRemap->uDmaAddr, pAddrRemap->enmReqType, 1969 uCtxEntryQword0); 1970 break; 1971 } 1972 } 1925 1973 } 1926 1974 else 1927 1975 dmarAtFaultQualifiedRecord(pDevIns, kDmarDiag_Atf_Lct_3, VTDATFAULT_LCT_3, pAddrRemap->idDevice, 1928 1976 pAddrRemap->uDmaAddr, pAddrRemap->enmReqType, uCtxEntryQword0); 1929 1977 } 1930 1978 else … … 1957 2005 * @param pDevIns The IOMMU device instance. 1958 2006 * @param uRtaddrReg The current RTADDR_REG value. 2007 * @param enmAddrType The PCI memory request address type. 1959 2008 * @param pAddrRemap The DMA address remap info. 1960 2009 */ 1961 static int dmarDrScalableModeRemapAddr(PPDMDEVINS pDevIns, uint64_t uRtaddrReg, PDMARADDRMAP pAddrRemap) 1962 { 2010 static int dmarDrScalableModeRemapAddr(PPDMDEVINS pDevIns, uint64_t uRtaddrReg, PCIADDRTYPE enmAddrType, PDMARADDRMAP pAddrRemap) 2011 { 2012 RT_NOREF(enmAddrType); 1963 2013 PCDMAR pThis = PDMDEVINS_2_DATA(pDevIns, PDMAR); 1964 2014 if (pThis->fExtCapReg & VTD_BF_ECAP_REG_SMTS_MASK) … … 2056 2106 case VTD_TTM_LEGACY_MODE: 2057 2107 { 2058 rc = dmarDrLegacyModeRemapAddr(pDevIns, uRtaddrReg, &AddrRemap);2108 rc = dmarDrLegacyModeRemapAddr(pDevIns, uRtaddrReg, PCIADDRTYPE_UNTRANSLATED, &AddrRemap); 2059 2109 break; 2060 2110 } … … 2062 2112 case VTD_TTM_SCALABLE_MODE: 2063 2113 { 2064 rc = dmarDrScalableModeRemapAddr(pDevIns, uRtaddrReg, &AddrRemap);2114 rc = dmarDrScalableModeRemapAddr(pDevIns, uRtaddrReg, PCIADDRTYPE_UNTRANSLATED, &AddrRemap); 2065 2115 break; 2066 2116 }
Note:
See TracChangeset
for help on using the changeset viewer.