VirtualBox

Changeset 89035 in vbox for trunk/src/VBox/Devices/PC


Ignore:
Timestamp:
May 13, 2021 2:24:30 PM (4 years ago)
Author:
vboxsync
Message:

Intel IOMMU: bugref:9967 DevIoApic: Slight cleanup and don't RT_ZERO MsiOut, the IOMMU remapping callback should guarantee that when it returns success.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevIoApic.cpp

    r89032 r89035  
    611611     * the origin of the interrupt, see @bugref{9654#c74}.
    612612     */
    613     MSIMSG MsiOut;
    614613    MSIMSG MsiIn;
    615     RT_ZERO(MsiOut);
    616614    RT_ZERO(MsiIn);
    617615    ioapicGetMsiFromRte(u64Rte, pThis->enmType, &MsiIn);
     616
     617    MSIMSG MsiOut;
    618618    int const rcRemap = pThisCC->pIoApicHlp->pfnIommuMsiRemap(pDevIns, VBOX_PCI_BDF_SB_IOAPIC, &MsiIn, &MsiOut);
    619619    if (   rcRemap == VERR_IOMMU_NOT_PRESENT
    620620        || rcRemap == VERR_IOMMU_CANNOT_CALL_SELF)
    621         MsiOut = MsiIn;
     621    { /* likely - assuming majority of VMs don't have IOMMU configured. */ }
    622622    else if (RT_SUCCESS(rcRemap))
     623    {
     624        /* Update the APIC interrupt with the remapped data. */
     625        ioapicGetApicIntrFromMsi(&MsiOut, &ApicIntr);
     626
     627        /* Ensure polarity hasn't changed (trigger mode might change with Intel IOMMUs). */
     628        Assert(ApicIntr.u8Polarity == IOAPIC_RTE_GET_POLARITY(u64Rte));
    623629        STAM_COUNTER_INC(&pThis->StatIommuRemappedIntr);
     630    }
    624631    else
    625632    {
     
    627634        return;
    628635    }
    629 
    630     /* Update the APIC interrupt with the remapped data. */
    631     ioapicGetApicIntrFromMsi(&MsiOut, &ApicIntr);
    632 
    633     /* Ensure polarity hasn't changed (trigger mode might change with Intel IOMMUs). */
    634     Assert(ApicIntr.u8Polarity == IOAPIC_RTE_GET_POLARITY(u64Rte));
    635636#endif
    636637
     
    10101011    {
    10111012        MSIMSG MsiOut;
    1012         RT_ZERO(MsiOut);
    10131013        int const rcRemap = pThisCC->pIoApicHlp->pfnIommuMsiRemap(pDevIns, uBusDevFn, pMsi, &MsiOut);
    10141014        if (   rcRemap == VERR_IOMMU_NOT_PRESENT
    10151015            || rcRemap == VERR_IOMMU_CANNOT_CALL_SELF)
    1016             MsiOut = *pMsi;
     1016        { /* likely - assuming majority of VMs don't have IOMMU configured. */ }
    10171017        else if (RT_SUCCESS(rcRemap))
     1018        {
    10181019            STAM_COUNTER_INC(&pThis->StatIommuRemappedMsi);
     1020            ioapicGetApicIntrFromMsi(&MsiOut, &ApicIntr);
     1021        }
    10191022        else
    10201023        {
     
    10221025            return;
    10231026        }
    1024         ioapicGetApicIntrFromMsi(&MsiOut, &ApicIntr);
    10251027    }
    10261028    else
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