Changeset 84237 in vbox
- Timestamp:
- May 10, 2020 7:07:40 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137845
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp
r84236 r84237 4266 4266 iommuAmdInitIotlbe(NIL_RTGCPHYS, 0 /* cShift */, IOMMU_IO_PERM_NONE, &Iotlbe); 4267 4267 4268 uint64_t cbChecked = 0; 4269 uint64_t uBaseIova = uIova & X86_PAGE_4K_BASE_MASK; 4268 uint64_t uBaseIova = uIova & X86_PAGE_4K_BASE_MASK; 4269 uint64_t offIova = uIova & X86_PAGE_4K_OFFSET_MASK; 4270 uint64_t cbRemaining = cbAccess; 4270 4271 for (;;) 4271 4272 { 4272 /* Walk the I/O page tables to translate and get permission bits for the IOVAaccess. */4273 /* Walk the I/O page tables to translate the IOVA and check permission for the access. */ 4273 4274 rc = iommuAmdWalkIoPageTables(pDevIns, uDevId, uBaseIova, fAccess, &Dte, enmOp, &Iotlbe); 4274 4275 if (RT_SUCCESS(rc)) 4275 4276 { 4276 /* Record the translated base address (before continuing to check permission bits of any subsequent pages). */4277 if (cb Checked == 0)4277 /* Store the translated base address before continuing to check permissions for any more pages. */ 4278 if (cbRemaining == cbAccess) 4278 4279 { 4279 4280 RTGCPHYS const offSpa = ~(UINT64_C(0xffffffffffffffff) << Iotlbe.cShift); … … 4284 4285 4285 4286 uint64_t const cbPhysPage = UINT64_C(1) << Iotlbe.cShift; 4286 cbChecked += cbPhysPage; /** @todo IOMMU: We need to consider the offset here. */ 4287 if (cbChecked >= cbAccess) 4287 if (cbRemaining > cbPhysPage - offIova) 4288 { 4289 cbRemaining -= (cbPhysPage - offIova); 4290 uBaseIova += cbPhysPage; 4291 offIova = 0; 4292 } 4293 else 4288 4294 break; 4289 uBaseIova += cbPhysPage;4290 4295 } 4291 4296 else 4292 4297 { 4293 Log((IOMMU_LOG_PFX ": I/O page table walk failed. uIova=%#RX64 uBaseIova=%#RX64 fAccess=%u rc=%Rrc\n", 4294 u Iova, uBaseIova, fAccess, rc));4298 Log((IOMMU_LOG_PFX ": I/O page table walk failed. uIova=%#RX64 uBaseIova=%#RX64 fAccess=%u rc=%Rrc\n", uIova, 4299 uBaseIova, fAccess, rc)); 4295 4300 *pGCPhysSpa = NIL_RTGCPHYS; 4296 4301 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.