VirtualBox

Changeset 86319 in vbox


Ignore:
Timestamp:
Sep 28, 2020 1:43:49 PM (4 years ago)
Author:
vboxsync
Message:

AMD IOMMU: bugref:9654 Merge the page offset bits from the original IOVA into the translated SPA.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp

    r86313 r86319  
    30273027                if (cbRemaining == cbAccess)
    30283028                {
    3029                     RTGCPHYS const offSpa = ~(UINT64_C(0xffffffffffffffff) << WalkResult.cShift);
     3029                    uint64_t const offMask = ~(UINT64_C(0xffffffffffffffff) << WalkResult.cShift);
     3030                    uint64_t const offSpa  = uIova & offMask;
    30303031                    *pGCPhysSpa = WalkResult.GCPhysSpa | offSpa;
    30313032                }
    30323033
     3034                /* If the access exceeds the page size, check permissions for the subsequent page. */
    30333035                uint64_t const cbPhysPage = UINT64_C(1) << WalkResult.cShift;
    30343036                if (cbRemaining > cbPhysPage - offIova)
    30353037                {
    30363038                    cbRemaining -= (cbPhysPage - offIova);
    3037                     uBaseIova   += cbPhysPage;
     3039                    uBaseIova   += cbPhysPage;      /** @todo r=ramshankar: Should we mask the offset based on page size here? */
    30383040                    offIova      = 0;
    30393041                }
     
    30853087    {
    30863088        STAM_COUNTER_INC(&pThis->CTX_SUFF_Z(StatMemRead));
    3087         LogFlowFunc(("uDevId=%#x uIova=%#RX64 cbRead=%u\n", uDevId, uIova, cbRead));
     3089        LogFunc(("uDevId=%#x uIova=%#RX64 cbRead=%u\n", uDevId, uIova, cbRead));
    30883090
    30893091        /** @todo IOMMU: IOTLB cache lookup. */
    30903092
    30913093        /* Lookup the IOVA from the device table. */
    3092         return iommuAmdLookupDeviceTable(pDevIns, uDevId, uIova, cbRead, IOMMU_IO_PERM_READ, IOMMUOP_MEM_READ, pGCPhysSpa);
     3094        int rc = iommuAmdLookupDeviceTable(pDevIns, uDevId, uIova, cbRead, IOMMU_IO_PERM_READ, IOMMUOP_MEM_READ, pGCPhysSpa);
     3095        if (RT_SUCCESS(rc))
     3096            LogFlowFunc(("uDevId=%#x uIova=%#RX64 cRead=%u pGCPhysSpa=%#RGp\n", uDevId, uIova, cbRead, *pGCPhysSpa));
     3097        else
     3098            LogFunc(("Failed! uDevId=%#x uIova=%#RX64 cbWrite=%u rc=%Rrc\n", uDevId, uIova, cbRead, rc));
     3099        return rc;
    30933100    }
    30943101
     
    31253132    {
    31263133        STAM_COUNTER_INC(&pThis->CTX_SUFF_Z(StatMemWrite));
    3127         LogFlowFunc(("uDevId=%#x uIova=%#RX64 cbWrite=%u\n", uDevId, uIova, cbWrite));
    31283134
    31293135        /** @todo IOMMU: IOTLB cache lookup. */
    31303136
    31313137        /* Lookup the IOVA from the device table. */
    3132         return iommuAmdLookupDeviceTable(pDevIns, uDevId, uIova, cbWrite, IOMMU_IO_PERM_WRITE, IOMMUOP_MEM_WRITE, pGCPhysSpa);
     3138        int rc = iommuAmdLookupDeviceTable(pDevIns, uDevId, uIova, cbWrite, IOMMU_IO_PERM_WRITE, IOMMUOP_MEM_WRITE, pGCPhysSpa);
     3139        if (RT_SUCCESS(rc))
     3140            LogFlowFunc(("uDevId=%#x uIova=%#RX64 cbWrite=%u pGCPhysSpa=%#RGp\n", uDevId, uIova, cbWrite, *pGCPhysSpa));
     3141        else
     3142            LogFunc(("Failed! uDevId=%#x uIova=%#RX64 cbWrite=%u rc=%Rrc\n", uDevId, uIova, cbWrite, rc));
     3143        return rc;
    31333144    }
    31343145
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette