Changeset 89375 in vbox for trunk/src/VBox/Devices
- Timestamp:
- May 29, 2021 5:51:55 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuIntel.cpp
r89366 r89375 312 312 /** @} */ 313 313 314 /** Host-address width (HAW) valid mask. */ 315 uint64_t fHawMask; 316 /** Maximum guest-address width (MGAW) valid mask (remove if it turns out we 317 * don't need this). */ 318 uint64_t fMgawMask; 314 /** Host-address width (HAW) base address mask. */ 315 uint64_t fHawBaseMask; 316 /** Maximum guest-address width (MGAW) base address mask. */ 317 uint64_t fMgawBaseMask; 319 318 /** Maximum supported paging level (3, 4 or 5). */ 320 319 uint8_t uMaxPagingLevel; … … 1936 1935 * Unlike AMD IOMMU paging, here there is no feature for "skipping" levels. 1937 1936 */ 1938 uint64_t uPtEntity = SlpEntry;1939 uint64_t const uDmaAddr = pAddrRemap->uDmaAddr;1940 uint64_t const fHaw Mask = pThis->fHawMask;1937 uint64_t uPtEntity = SlpEntry; 1938 uint64_t const uDmaAddr = pAddrRemap->uDmaAddr & pThis->fMgawBaseMask; 1939 uint64_t const fHawBaseMask = pThis->fHawBaseMask; 1941 1940 for (int8_t iLevel = uPagingLevel - 1; iLevel >= 0; iLevel--) 1942 1941 { 1943 1942 /* Read the paging entry for the current level. */ 1944 1943 { 1945 uint8_t const c Shift= 12 + ((iLevel - 1) * 9);1946 uint16_t const idxPte = (uDmaAddr >> c Shift) & UINT64_C(0x1ff);1944 uint8_t const cLevelShift = 12 + ((iLevel - 1) * 9); 1945 uint16_t const idxPte = (uDmaAddr >> cLevelShift) & UINT64_C(0x1ff); 1947 1946 uint64_t const offPte = idxPte << 3; 1948 RTGCPHYS const GCPhysPtEntity = (uPtEntity & fHawMask) | offPte; 1947 /** @todo if we validate 63:HAW (since hardware treats it as reserved and we should fault if that's the case, we might not need to & fHawbaseMask here. */ 1948 RTGCPHYS const GCPhysPtEntity = (uPtEntity & fHawBaseMask) | offPte; 1949 1949 int const rc = PDMDevHlpPhysReadMeta(pDevIns, GCPhysPtEntity, &uPtEntity, sizeof(uPtEntity)); 1950 1950 if (RT_SUCCESS(rc)) … … 1956 1956 * available in pAddrRemap->fTtm, but how cleanly we can handle this is 1957 1957 * something to be decided later. For now we just use legacy mode error 1958 * codes below. Assertedbelow. */1958 * codes. Asserted as such below. */ 1959 1959 Assert(pAddrRemap->fTtm == VTD_TTM_LEGACY_MODE); 1960 1960 dmarAtFaultRecord(pDevIns, kDmarDiag_Atf_Lsl_1, VTDATFAULT_LSL_1, pAddrRemap); … … 3321 3321 dmarRegWriteRaw64(pThis, VTD_MMIO_OFF_CAP_REG, pThis->fCapReg); 3322 3322 3323 pThis->fHaw Mask = ~(UINT64_MAX << cGstPhysAddrBits) & UINT64_C(0xfffffffffffff000);3324 pThis->fMgaw Mask = pThis->fHawMask;3323 pThis->fHawBaseMask = ~(UINT64_MAX << cGstPhysAddrBits) & X86_PAGE_4K_BASE_MASK; 3324 pThis->fMgawBaseMask = pThis->fHawBaseMask; 3325 3325 pThis->uMaxPagingLevel = vtdCapRegGetMaxPagingLevel(fSagaw); 3326 3326 } … … 3585 3585 uint16_t const offFrcd = RT_BF_GET(pThis->fCapReg, VTD_BF_CAP_REG_FRO); 3586 3586 uint16_t const offIva = RT_BF_GET(pThis->fExtCapReg, VTD_BF_ECAP_REG_IRO); 3587 LogRel(("%s: VER=%u.%u CAP=%#RX64 ECAP=%#RX64 (MGAW=%u bits, SAGAW=%#x HAW _Mask=%#RX64 FRO=%#x,IRO=%#x) mapped at %#RGp\n",3587 LogRel(("%s: VER=%u.%u CAP=%#RX64 ECAP=%#RX64 (MGAW=%u bits, SAGAW=%#x HAW=%#RX64 MGAW=%#RX64 FRO=%#x IRO=%#x) mapped at %#RGp\n", 3588 3588 DMAR_LOG_PFX, RT_BF_GET(uVerReg, VTD_BF_VER_REG_MAX), RT_BF_GET(uVerReg, VTD_BF_VER_REG_MIN), 3589 pThis->fCapReg, pThis->fExtCapReg, cMgawBits, fSagaw, pThis->fHawMask, offFrcd, offIva, DMAR_MMIO_BASE_PHYSADDR)); 3589 pThis->fCapReg, pThis->fExtCapReg, cMgawBits, fSagaw, pThis->fHawBaseMask, pThis->fMgawBaseMask, offFrcd, offIva, 3590 DMAR_MMIO_BASE_PHYSADDR)); 3590 3591 3591 3592 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.