VirtualBox

Ignore:
Timestamp:
Mar 4, 2021 5:23:02 AM (4 years ago)
Author:
vboxsync
Message:

AMD IOMMU: bugref:9654 Lookup IOVAs from the IOTLB cache for bulk access requests as well.

File:
1 edited

Legend:

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

    r87926 r87943  
    40874087
    40884088/**
    4089  * Lookups a memory access from the IOMMU cache.
     4089 * Lookups a memory access from the IOTLB cache.
    40904090 *
    40914091 * @returns VBox status code.
     
    41084108 *                          and permission-checked.
    41094109 */
    4110 static int iommuAmdCacheLookup(PPDMDEVINS pDevIns, uint16_t idDevice, uint64_t uIova, size_t cbIova, uint8_t fPerm, IOMMUOP enmOp,
    4111                                PRTGCPHYS pGCPhysSpa, size_t *pcbContiguous)
     4110static int iommuAmdIotlbCacheLookup(PPDMDEVINS pDevIns, uint16_t idDevice, uint64_t uIova, size_t cbIova, uint8_t fPerm,
     4111                                    IOMMUOP enmOp, PRTGCPHYS pGCPhysSpa, size_t *pcbContiguous)
    41124112{
    41134113    int rc;
     
    42674267#ifdef IOMMU_WITH_IOTLBE_CACHE
    42684268        /* Lookup the IOVA from the cache. */
    4269         rc = iommuAmdCacheLookup(pDevIns, idDevice, uIova, cbIova, fPerm, enmOp, pGCPhysSpa, pcbContiguous);
     4269        rc = iommuAmdIotlbCacheLookup(pDevIns, idDevice, uIova, cbIova, fPerm, enmOp, pGCPhysSpa, pcbContiguous);
    42704270        if (rc == VINF_SUCCESS)
    42714271        {
     
    42744274            Assert(*pGCPhysSpa != NIL_RTGCPHYS);
    42754275            STAM_COUNTER_INC(&pThis->StatAccessCacheHitFull);
    4276             return rc;
     4276            return VINF_SUCCESS;
    42774277        }
    42784278        if (rc != VERR_OUT_OF_RANGE)
     
    43514351        LogFlowFunc(("%s: idDevice=%#x cIovas=%zu\n", iommuAmdMemAccessGetPermName(fPerm), idDevice, cIovas));
    43524352
    4353         /** @todo IOMMU: IOTLB cache lookup. */
    4354 
    4355         /* Lookup each IOVA from the device table. */
    43564353        for (size_t i = 0; i < cIovas; i++)
    43574354        {
     4355            int    rc;
    43584356            size_t cbContig;
    4359             int rc = iommuAmdDteLookup(pDevIns, idDevice, pauIovas[i], X86_PAGE_SIZE, fPerm, enmOp, &paGCPhysSpa[i], &cbContig);
     4357
     4358#ifdef IOMMU_WITH_IOTLBE_CACHE
     4359            /* Lookup the IOVA from the IOTLB cache. */
     4360            rc = iommuAmdIotlbCacheLookup(pDevIns, idDevice, pauIovas[i], X86_PAGE_SIZE, fPerm, enmOp, &paGCPhysSpa[i],
     4361                                          &cbContig);
     4362            if (rc == VINF_SUCCESS)
     4363            {
     4364                Assert(cbContig == X86_PAGE_SIZE);
     4365                Assert(paGCPhysSpa[i] != NIL_RTGCPHYS);
     4366                STAM_COUNTER_INC(&pThis->StatAccessCacheHitFull);
     4367                continue;
     4368            }
     4369            Assert(rc == VERR_NOT_FOUND || rc == VERR_IOMMU_ADDR_ACCESS_DENIED);
     4370            STAM_COUNTER_INC(&pThis->StatAccessCacheMiss);
     4371#endif
     4372
     4373            /* Lookup the IOVA from the device table. */
     4374            rc = iommuAmdDteLookup(pDevIns, idDevice, pauIovas[i], X86_PAGE_SIZE, fPerm, enmOp, &paGCPhysSpa[i], &cbContig);
    43604375            if (RT_SUCCESS(rc))
    43614376            { /* likely */ }
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