VirtualBox

Changeset 86084 in vbox for trunk/src/VBox/Devices/Bus


Ignore:
Timestamp:
Sep 10, 2020 1:12:30 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
140313
Message:

AMD IOMMU: bugref:9654 Don't forget to multiply the size of each DTE entry when indexing into the DTE!
Also when device segmentation is used we need to shift by 15, 14 or 13 bits,
shifting always by 13 would include erroneous bits from the device ID.

File:
1 edited

Legend:

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

    r86080 r86084  
    403403
    404404/**
     405 * An array of the shift values to select the device table segment index from a
     406 * device ID.
     407 */
     408static uint8_t const g_auDevTabSegShifts[] = { 0, 15, 14, 13 };
     409
     410/**
    405411 * The maximum size (inclusive) of each device table segment (0 to 7).
    406412 * Indexed by the device table segment index.
     
    19741980
    19751981    uint8_t const idxSegsEn = Ctrl.n.u3DevTabSegEn;
     1982    Assert(idxSegsEn < RT_ELEMENTS(g_auDevTabSegShifts));
    19761983    Assert(idxSegsEn < RT_ELEMENTS(g_auDevTabSegMasks));
    19771984
    1978     uint8_t const idxSeg = uDevId & g_auDevTabSegMasks[idxSegsEn] >> 13;
     1985    uint8_t const idxSeg = (uDevId & g_auDevTabSegMasks[idxSegsEn]) >> g_auDevTabSegShifts[idxSegsEn];
    19791986    Assert(idxSeg < RT_ELEMENTS(pThis->aDevTabBaseAddrs));
    19801987
    19811988    RTGCPHYS const GCPhysDevTab = pThis->aDevTabBaseAddrs[idxSeg].n.u40Base << X86_PAGE_4K_SHIFT;
    1982     uint16_t const offDte       = uDevId & ~g_auDevTabSegMasks[idxSegsEn];
     1989    uint16_t const offDte       = (uDevId & ~g_auDevTabSegMasks[idxSegsEn]) * sizeof(DTE_T);
    19831990    RTGCPHYS const GCPhysDte    = GCPhysDevTab + offDte;
    19841991
Note: See TracChangeset for help on using the changeset viewer.

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