VirtualBox

Changeset 87494 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Feb 1, 2021 5:47:40 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
142518
Message:

AMD IOMMU: bugref:9654 PDM IOMMU code de-duplication and cleanup, part 3.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PDMAllIommu.cpp

    r87483 r87494  
    6363#endif
    6464    return PCIBDF_MAKE(pBus->iBus, pPciDev->uDevFn);
     65}
     66
     67
     68/** @copydoc PDMIOMMUREGR3::pfnMsiRemap */
     69int pdmIommuMsiRemap(PPDMDEVINS pDevIns, uint16_t uDeviceId, PCMSIMSG pMsiIn, PMSIMSG pMsiOut)
     70{
     71    PPDMIOMMU  pIommu       = PDMDEVINS_TO_IOMMU(pDevIns);
     72    PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns);
     73    if (   pDevInsIommu
     74        && pDevInsIommu != pDevIns)
     75    {
     76        int rc = pIommu->pfnMsiRemap(pDevInsIommu, uDeviceId, pMsiIn, pMsiOut);
     77        if (RT_FAILURE(rc))
     78        {
     79            LogFunc(("MSI remap failed. uDeviceId=%#x pMsiIn=(%#RX64, %#RU32) rc=%Rrc\n", uDeviceId, pMsiIn->Addr.u64,
     80                     pMsiIn->Data.u32, rc));
     81        }
     82        return rc;
     83    }
     84    return VERR_IOMMU_NOT_PRESENT;
    6585}
    6686
     
    178198
    179199
     200#ifdef IN_RING3
    180201/**
    181202 * Requests the mapping of a guest page into ring-3 in preparation for a bus master
     
    196217 *                      pfnPhysReleasePageMappingLock needs.
    197218 */
    198 int pdmIommuMemAccessReadCCPtr(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys, uint32_t fFlags, void const **ppv,
    199                                PPGMPAGEMAPLOCK pLock)
    200 {
    201 #if defined(IN_RING3)
     219int pdmR3IommuMemAccessReadCCPtr(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys, uint32_t fFlags, void const **ppv,
     220                                 PPGMPAGEMAPLOCK pLock)
     221{
    202222    PPDMIOMMU  pIommu       = PDMDEVINS_TO_IOMMU(pDevIns);
    203223    PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns);
     
    221241    }
    222242    return VERR_IOMMU_NOT_PRESENT;
    223 #else
    224     RT_NOREF6(pDevIns, pPciDev, GCPhys, fFlags, ppv, pLock);
    225     return VERR_NOT_IMPLEMENTED;
    226 #endif
    227243}
    228244
     
    246262 *                      pfnPhysReleasePageMappingLock needs.
    247263 */
    248 int pdmIommuMemAccessWriteCCPtr(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys, uint32_t fFlags, void **ppv,
    249                                 PPGMPAGEMAPLOCK pLock)
    250 {
    251 #if defined(IN_RING3)
     264int pdmR3IommuMemAccessWriteCCPtr(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys, uint32_t fFlags, void **ppv,
     265                                  PPGMPAGEMAPLOCK pLock)
     266{
    252267    PPDMIOMMU  pIommu       = PDMDEVINS_TO_IOMMU(pDevIns);
    253268    PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns);
     
    271286    }
    272287    return VERR_IOMMU_NOT_PRESENT;
    273 #else
    274     RT_NOREF6(pDevIns, pPciDev, GCPhys, fFlags, ppv, pLock);
    275     return VERR_NOT_IMPLEMENTED;
    276 #endif
    277288}
    278289
     
    299310 *                              in length).
    300311 */
    301 int pdmIommuMemAccessBulkReadCCPtr(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t cPages, PCRTGCPHYS paGCPhysPages,
    302                                    uint32_t fFlags, const void **papvPages, PPGMPAGEMAPLOCK paLocks)
    303 {
    304 #ifdef IN_RING3
     312int pdmR3IommuMemAccessBulkReadCCPtr(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t cPages, PCRTGCPHYS paGCPhysPages,
     313                                     uint32_t fFlags, const void **papvPages, PPGMPAGEMAPLOCK paLocks)
     314{
    305315    PPDMIOMMU  pIommu       = PDMDEVINS_TO_IOMMU(pDevIns);
    306316    PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns);
     
    339349    }
    340350    return VERR_IOMMU_NOT_PRESENT;
    341 #else
    342     RT_NOREF7(pDevIns, pPciDev, cPages, paGCPhysPages, fFlags, papvPages, paLocks);
    343     return VERR_NOT_IMPLEMENTED;
    344 #endif
    345351}
    346352
     
    367373 *                              in length).
    368374 */
    369 int pdmIommuMemAccessBulkWriteCCPtr(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t cPages, PCRTGCPHYS paGCPhysPages,
    370                                     uint32_t fFlags, void **papvPages, PPGMPAGEMAPLOCK paLocks)
    371 {
    372 #ifdef IN_RING3
     375int pdmR3IommuMemAccessBulkWriteCCPtr(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t cPages, PCRTGCPHYS paGCPhysPages,
     376                                      uint32_t fFlags, void **papvPages, PPGMPAGEMAPLOCK paLocks)
     377{
    373378    PPDMIOMMU  pIommu       = PDMDEVINS_TO_IOMMU(pDevIns);
    374379    PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns);
     
    407412    }
    408413    return VERR_IOMMU_NOT_PRESENT;
    409 #else
    410     RT_NOREF7(pDevIns, pPciDev, cPages, paGCPhysPages, fFlags, papvPages, paLocks);
    411     return VERR_NOT_IMPLEMENTED;
    412 #endif
    413 }
    414 
    415 
    416 /** @copydoc PDMIOMMUREGR3::pfnMsiRemap */
    417 int pdmIommuMsiRemap(PPDMDEVINS pDevIns, uint16_t uDeviceId, PCMSIMSG pMsiIn, PMSIMSG pMsiOut)
    418 {
    419     PPDMIOMMU  pIommu       = PDMDEVINS_TO_IOMMU(pDevIns);
    420     PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns);
    421     if (   pDevInsIommu
    422         && pDevInsIommu != pDevIns)
    423     {
    424         int rc = pIommu->pfnMsiRemap(pDevInsIommu, uDeviceId, pMsiIn, pMsiOut);
    425         if (RT_FAILURE(rc))
    426         {
    427             LogFunc(("MSI remap failed. uDeviceId=%#x pMsiIn=(%#RX64, %#RU32) rc=%Rrc\n", uDeviceId, pMsiIn->Addr.u64,
    428                      pMsiIn->Data.u32, rc));
    429         }
    430         return rc;
    431     }
    432     return VERR_IOMMU_NOT_PRESENT;
    433 }
    434 
     414}
     415#endif /* IN_RING3 */
     416
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