Changeset 89499 in vbox for trunk/src/VBox
- Timestamp:
- Jun 4, 2021 9:36:58 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144856
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuIntel.cpp
r89498 r89499 354 354 uint64_t fHawBaseMask; 355 355 /** Maximum guest-address width (MGAW) invalid address mask. */ 356 uint64_t f InvMgawMask;356 uint64_t fMgawInvMask; 357 357 /** Maximum supported paging level (3, 4 or 5). */ 358 358 uint8_t cMaxPagingLevel; … … 555 555 uint8_t cPagingLevel; 556 556 uint8_t afPadding[5]; 557 /** The first-level page-table pointer (base). */557 /** The first-level page-table pointer. */ 558 558 uint64_t uFlptPtr; 559 /** The second-level page-table pointer (base). */559 /** The second-level page-table pointer. */ 560 560 uint64_t uSlptPtr; 561 561 } DMARMEMREQAUX; … … 582 582 typedef DMARMEMREQREMAP const *PCDMARMEMREQREMAP; 583 583 584 typedef DECLCALLBACKTYPE(int, FNDMA ADDRTRANSLATE,(PPDMDEVINS pDevIns, PCDMARMEMREQIN pMemReqIn, PCDMARMEMREQAUX pMemReqAux,585 586 typedef FNDMA ADDRTRANSLATE *PFNDMAADDRTRANSLATE;584 typedef DECLCALLBACKTYPE(int, FNDMADDRLOOKUP,(PPDMDEVINS pDevIns, PCDMARMEMREQIN pMemReqIn, PCDMARMEMREQAUX pMemReqAux, 585 PDMARIOPAGE pIoPageOut)); 586 typedef FNDMADDRLOOKUP *PFNDMADDRLOOKUP; 587 587 588 588 … … 2093 2093 * Performs second level translation. 2094 2094 * 2095 * This is a DMA address lookup callback function which performs the translation 2096 * (and access control) as part of the lookup. 2097 * 2095 2098 * @returns VBox status code. 2096 2099 * @param pDevIns The IOMMU device instance. … … 2122 2125 2123 2126 /* Second-level translations restricts input address to an implementation-specific MGAW. */ 2124 uint64_t const u DmaAddr= pMemReqIn->AddrRange.uAddr;2125 if (!(u DmaAddr & pThis->fInvMgawMask))2127 uint64_t const uAddrIn = pMemReqIn->AddrRange.uAddr; 2128 if (!(uAddrIn & pThis->fMgawInvMask)) 2126 2129 { /* likely */ } 2127 2130 else … … 2227 2230 */ 2228 2231 { 2229 uint16_t const idxPte = (u DmaAddr>> cLevelShift) & UINT64_C(0x1ff);2232 uint16_t const idxPte = (uAddrIn >> cLevelShift) & UINT64_C(0x1ff); 2230 2233 uint64_t const offPte = idxPte << 3; 2231 2234 RTGCPHYS const GCPhysPtEntity = uPtEntity | offPte; … … 2280 2283 * @returns VBox status code. 2281 2284 * @param pDevIns The IOMMU device instance. 2282 * @param pfn Translate The DMA address translationfunction.2285 * @param pfnLookup The DMA address lookup function. 2283 2286 * @param pMemReqRemap The DMA memory request remapping info. 2284 2287 */ 2285 static int dmarDrMemRangeLookup(PPDMDEVINS pDevIns, PFNDMA ADDRTRANSLATE pfnTranslate, PDMARMEMREQREMAP pMemReqRemap)2288 static int dmarDrMemRangeLookup(PPDMDEVINS pDevIns, PFNDMADDRLOOKUP pfnLookup, PDMARMEMREQREMAP pMemReqRemap) 2286 2289 { 2287 2290 RTGCPHYS GCPhysAddr = NIL_RTGCPHYS; … … 2300 2303 /* Update the input memory request with the next address in our range that needs translation. */ 2301 2304 MemReqIn.AddrRange.uAddr = uAddrInBase; 2302 MemReqIn.AddrRange.cb = cbRemaining; /* Not currently accessed by pfn Translate, but keep things consistent. */2305 MemReqIn.AddrRange.cb = cbRemaining; /* Not currently accessed by pfnLookup, but keep things consistent. */ 2303 2306 2304 2307 DMARIOPAGE IoPage; 2305 rc = pfn Translate(pDevIns, &MemReqIn, &pMemReqRemap->Aux, &IoPage);2308 rc = pfnLookup(pDevIns, &MemReqIn, &pMemReqRemap->Aux, &IoPage); 2306 2309 if (RT_SUCCESS(rc)) 2307 2310 { … … 3717 3720 3718 3721 pThis->fHawBaseMask = ~(UINT64_MAX << cGstPhysAddrBits) & X86_PAGE_4K_BASE_MASK; 3719 pThis->f InvMgawMask = UINT64_MAX << cGstPhysAddrBits;3722 pThis->fMgawInvMask = UINT64_MAX << cGstPhysAddrBits; 3720 3723 pThis->cMaxPagingLevel = vtdCapRegGetMaxPagingLevel(fSagaw); 3721 3724 } … … 3980 3983 * Log some of the features exposed to software. 3981 3984 */ 3982 uint32_t const uVerReg = pThis->uVerReg; 3983 uint8_t const cMgawBits = RT_BF_GET(pThis->fCapReg, VTD_BF_CAP_REG_MGAW) + 1; 3984 uint8_t const fSagaw = RT_BF_GET(pThis->fCapReg, VTD_BF_CAP_REG_SAGAW); 3985 uint16_t const offFrcd = RT_BF_GET(pThis->fCapReg, VTD_BF_CAP_REG_FRO); 3986 uint16_t const offIva = RT_BF_GET(pThis->fExtCapReg, VTD_BF_ECAP_REG_IRO); 3987 LogRel(("%s: VER=%u.%u CAP=%#RX64 ECAP=%#RX64 (MGAW=%u bits, SAGAW=%#x HAW_Base=%#RX64 MGAW_Inv=%#RX64 FRO=%#x IRO=%#x cMaxPagingLevel=%u) mapped at %#RGp\n", 3988 DMAR_LOG_PFX, RT_BF_GET(uVerReg, VTD_BF_VER_REG_MAX), RT_BF_GET(uVerReg, VTD_BF_VER_REG_MIN), 3989 pThis->fCapReg, pThis->fExtCapReg, cMgawBits, fSagaw, pThis->fHawBaseMask, pThis->fInvMgawMask, offFrcd, offIva, 3990 pThis->cMaxPagingLevel, DMAR_MMIO_BASE_PHYSADDR)); 3991 3985 uint8_t const uVerMax = RT_BF_GET(pThis->uVerReg, VTD_BF_VER_REG_MAX); 3986 uint8_t const uVerMin = RT_BF_GET(pThis->uVerReg, VTD_BF_VER_REG_MIN); 3987 uint8_t const cMgawBits = RT_BF_GET(pThis->fCapReg, VTD_BF_CAP_REG_MGAW) + 1; 3988 uint8_t const fSagaw = RT_BF_GET(pThis->fCapReg, VTD_BF_CAP_REG_SAGAW); 3989 uint16_t const offFrcd = RT_BF_GET(pThis->fCapReg, VTD_BF_CAP_REG_FRO); 3990 uint16_t const offIva = RT_BF_GET(pThis->fExtCapReg, VTD_BF_ECAP_REG_IRO); 3991 LogRel(("%s: Mapped at %#RGp (%u-level page-table supported)\n", 3992 DMAR_LOG_PFX, DMAR_MMIO_BASE_PHYSADDR, pThis->cMaxPagingLevel)); 3993 LogRel(("%s: Version=%u.%u Cap=%#RX64 ExtCap=%#RX64 Mgaw=%u bits Sagaw=%#x HawBaseMask=%#RX64 MgawInvMask=%#RX64 FRO=%#x IRO=%#x\n", 3994 DMAR_LOG_PFX, uVerMax, uVerMin, pThis->fCapReg, pThis->fExtCapReg, cMgawBits, fSagaw, pThis->fHawBaseMask, 3995 pThis->fMgawInvMask, offFrcd, offIva)); 3992 3996 return VINF_SUCCESS; 3993 3997 }
Note:
See TracChangeset
for help on using the changeset viewer.