VirtualBox

Changeset 87499 in vbox


Ignore:
Timestamp:
Feb 1, 2021 1:55:23 PM (4 years ago)
Author:
vboxsync
Message:

AMD IOMMU: bugref:9654 IOTLB cache bits.

File:
1 edited

Legend:

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

    r87496 r87499  
    371371    STAMCOUNTER                 StatCmdInvIommuAll;         /**< Number of Invalidate IOMMU All commands processed. */
    372372
     373    STAMCOUNTER                 StatDteLookupNonContig;     /**< Number of non-contiguous address region translations. */
    373374    STAMPROFILEADV              StatDteLookup;              /**< Profiling of device table entry lookup (uncached). */
    374375    /** @} */
     
    29642965                        uint64_t offIova     = uIova & X86_PAGE_4K_OFFSET_MASK;
    29652966                        uint64_t cbPages     = 0;
     2967#ifdef IOMMU_WITH_IOTLBE_CACHE
     2968                        IOWALKRESULT WalkResultPrev;
     2969                        RT_ZERO(WalkResultPrev);
     2970#endif
    29662971                        for (;;)
    29672972                        {
     
    29762981                                    uint64_t const offSpa  = uIova & offMask;
    29772982                                    GCPhysSpa = WalkResult.GCPhysSpa | offSpa;
     2983#ifdef IOMMU_WITH_IOTLBE_CACHE
     2984                                    /* Store the walk result from the first page. */
     2985                                    WalkResultPrev = WalkResult;
     2986#endif
    29782987                                }
     2988#ifdef IOMMU_WITH_IOTLBE_CACHE
     2989                                /* Check if addresses translated so far result in a physically contiguous region
     2990                                   and that permissions and page sizes are identical for all pages in the access. */
     2991                                else if (   (GCPhysSpa & X86_PAGE_4K_BASE_MASK) + cbPages == WalkResult.GCPhysSpa
     2992                                         && WalkResultPrev.cShift  == WalkResult.cShift
     2993                                         && WalkResultPrev.fIoPerm == WalkResult.fIoPerm)
     2994                                {
     2995                                    /* Paranoia. */
     2996                                    Assert((WalkResultPrev.GCPhysSpa & X86_PAGE_4K_BASE_MASK)
     2997                                           + RT_BIT_64(WalkResultPrev.cShift) == WalkResult.GCPhysSpa);
     2998                                    /* Store the walk result before moving on to the next page. */
     2999                                    WalkResultPrev = WalkResult;
     3000                                }
     3001#else
    29793002                                /* Check if addresses translated so far result in a physically contiguous region. */
    2980                                 else if ((GCPhysSpa & X86_PAGE_4K_BASE_MASK) + cbPages == WalkResult.GCPhysSpa)
     3003                                else if (   (GCPhysSpa & X86_PAGE_4K_BASE_MASK) + cbPages == WalkResult.GCPhysSpa)
    29813004                                { /* likely */ }
     3005#endif
    29823006                                else
     3007                                {
     3008                                    STAM_COUNTER_INC(&pThis->StatDteLookupNonContig);
    29833009                                    break;
     3010                                }
    29843011
    29853012                                /* Check if we need to access more pages. */
    2986                                 uint64_t const cbPage = UINT64_C(1) << WalkResult.cShift;
     3013                                uint64_t const cbPage = RT_BIT_64(WalkResult.cShift);
    29873014                                if (cbRemaining > cbPage - offIova)
    29883015                                {
     
    30183045
    30193046                        /* Paranoia. */
    3020                         Assert(WalkResult.cShift   == 0);
     3047                        Assert(WalkResult.cShift    == 0);
    30213048                        Assert(WalkResult.GCPhysSpa == uIova);
    30223049                        Assert((WalkResult.fIoPerm & fAccess) == fAccess);
     
    51315158    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatCmdCompletePprReq, STAMTYPE_COUNTER, "R3/Commands/CompletePprReq", STAMUNIT_OCCURENCES, "Number of Complete PPR Requests commands processed.");
    51325159    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatCmdInvIommuAll, STAMTYPE_COUNTER, "R3/Commands/InvIommuAll", STAMUNIT_OCCURENCES, "Number of Invalidate IOMMU All commands processed.");
     5160
     5161    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatDteLookupNonContig, STAMTYPE_COUNTER, "DteLookupNonContig", STAMUNIT_OCCURENCES, "Number of non-contiguous translated regions.");
    51335162
    51345163    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatDteLookup, STAMTYPE_PROFILE, "DteLookup", STAMUNIT_TICKS_PER_CALL, "Profiling device table entry lookup (uncached).");
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