VirtualBox

Changeset 84431 in vbox for trunk/src


Ignore:
Timestamp:
May 21, 2020 8:42:19 AM (5 years ago)
Author:
vboxsync
Message:

AMD IOMMU: bugref:9654 IOMMU interrupt remapping callback skeleton.

Location:
trunk/src/VBox
Files:
4 edited

Legend:

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

    r84320 r84431  
    22662266    /** The translated system physical address (SPA) of the page. */
    22672267    RTGCPHYS        GCPhysSpa;
     2268    /** The index of the 4K page within a large page. */
     2269    uint32_t        idxSubPage;
    22682270    /** The I/O access permissions (IOMMU_IO_PERM_XXX). */
    22692271    uint8_t         fIoPerm;
     2272    /** The number of offset bits in the translation indicating page size. */
     2273    uint8_t         cShift;
    22702274    /** Alignment padding. */
    2271     uint8_t         afPadding[7];
     2275    uint8_t         afPadding[2];
    22722276} IOTLBE_T;
    22732277AssertCompileSize(IOTLBE_T, 16);
     
    45134517
    45144518/**
     4519 * Interrupt remap request from a device.
     4520 *
     4521 * @returns VBox status code.
     4522 * @param   pDevIns     The IOMMU device instance.
     4523 * @param   uDevId      The device ID (bus, device, function).
     4524 * @param   GCPhysIn    The source MSI address.
     4525 * @param   uDataIn     The source MSI data.
     4526 * @param   pGCPhysOut  Where to store the remapped MSI address.
     4527 * @param   puDataOut   Where to store the remapped MSI data.
     4528 */
     4529static int iommuAmdDeviceMsiRemap(PPDMDEVINS pDevIns, uint16_t uDevId, RTGCPHYS GCPhysIn, uint32_t uDataIn,
     4530                                  PRTGCPHYS pGCPhysOut, uint32_t *puDataOut)
     4531{
     4532    RT_NOREF(pDevIns, uDevId, GCPhysIn, uDataIn, pGCPhysOut, puDataOut);
     4533    return VERR_NOT_IMPLEMENTED;
     4534}
     4535
     4536
     4537/**
    45154538 * @callback_method_impl{FNIOMMMIONEWWRITE}
    45164539 */
     
    45444567    return rcStrict;
    45454568}
    4546 
    45474569
    45484570# ifdef IN_RING3
     
    56035625    IommuReg.pfnMemRead  = iommuAmdDeviceMemRead;
    56045626    IommuReg.pfnMemWrite = iommuAmdDeviceMemWrite;
     5627    IommuReg.pfnMsiRemap = iommuAmdDeviceMsiRemap;
    56055628    IommuReg.u32TheEnd   = PDM_IOMMUREGCC_VERSION;
    56065629    rc = PDMDevHlpIommuRegister(pDevIns, &IommuReg, &pThisCC->CTX_SUFF(pIommuHlp), &pThis->idxIommu);
     
    58405863    IommuReg.pfnMemRead  = iommuAmdDeviceMemRead;
    58415864    IommuReg.pfnMemWrite = iommuAmdDeviceMemWrite;
     5865    IommuReg.pfnMsiRemap = iommuAmdDeviceMsiRemap;
    58425866    IommuReg.u32TheEnd   = PDM_IOMMUREGCC_VERSION;
    58435867    rc = PDMDevHlpIommuSetUpContext(pDevIns, &IommuReg, &pThisCC->CTX_SUFF(pIommuHlp));
  • trunk/src/VBox/Devices/testcase/tstDevicePdmDevHlp.cpp

    r83296 r84431  
    46564656                    ("%s/%d: u32Version=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pIommuReg->u32Version, PDM_IOMMUREGR3_VERSION),
    46574657                    VERR_INVALID_PARAMETER);
    4658 
    4659     /** @todo IOMMU: Validate other parameters */
    4660 
     4658    AssertPtrReturn(pIommuReg->pfnMemRead, VERR_INVALID_POINTER);
     4659    AssertPtrReturn(pIommuReg->pfnMemWrite, VERR_INVALID_POINTER);
     4660    AssertPtrReturn(pIommuReg->pfnMsiRemap, VERR_INVALID_POINTER);
    46614661    AssertMsgReturn(pIommuReg->u32TheEnd == PDM_IOMMUREGR3_VERSION,
    46624662                    ("%s/%d: u32TheEnd=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pIommuReg->u32TheEnd, PDM_IOMMUREGR3_VERSION),
  • trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp

    r84332 r84431  
    33483348                    ("%s/%d: u32Version=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pIommuReg->u32Version, PDM_IOMMUREGR3_VERSION),
    33493349                    VERR_INVALID_PARAMETER);
    3350     /** @todo IOMMU: Validate other parameters, see also tstDevicePdmDevHlp.cpp. */
     3350    AssertPtrReturn(pIommuReg->pfnMemRead, VERR_INVALID_POINTER);
     3351    AssertPtrReturn(pIommuReg->pfnMemWrite, VERR_INVALID_POINTER);
     3352    AssertPtrReturn(pIommuReg->pfnMsiRemap, VERR_INVALID_POINTER);
    33513353    AssertMsgReturn(pIommuReg->u32TheEnd == PDM_IOMMUREGR3_VERSION,
    33523354                    ("%s/%d: u32TheEnd=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pIommuReg->u32TheEnd, PDM_IOMMUREGR3_VERSION),
     
    33623364     */
    33633365    unsigned idxIommu = 0;
     3366#if 0
    33643367    for (idxIommu = 0; idxIommu < RT_ELEMENTS(pVM->pdm.s.aIommus); idxIommu++)
    33653368        if (!pVM->pdm.s.aIommus[idxIommu].pDevInsR3)
     
    33683371                          ("Too many IOMMUs. Max=%u\n", RT_ELEMENTS(pVM->pdm.s.aIommus)),
    33693372                          VERR_OUT_OF_RESOURCES);
     3373#else
     3374    /* Currently we support only a single IOMMU. */
     3375    AssertMsgReturn(!pVM->pdm.s.aIommus[0].pDevInsR3,
     3376                    ("%s/%u: Only one IOMMU device is supported!\n", pDevIns->pReg->szName, pDevIns->iInstance),
     3377                    VERR_ALREADY_EXISTS);
     3378#endif
    33703379    PPDMIOMMU pIommu = &pVM->pdm.s.aIommus[idxIommu];
    33713380
     
    33773386    pIommu->pfnMemRead  = pIommuReg->pfnMemRead;
    33783387    pIommu->pfnMemWrite = pIommuReg->pfnMemWrite;
     3388    pIommu->pfnMsiRemap = pIommuReg->pfnMsiRemap;
    33793389    Log(("PDM: Registered IOMMU device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
    33803390
  • trunk/src/VBox/VMM/include/PDMInternal.h

    r84170 r84431  
    635635    DECLR3CALLBACKMEMBER(int,   pfnMemWrite,(PPDMDEVINS pDevIns, uint16_t uDevId, uint64_t uDva, size_t cbWrite,
    636636                                             PRTGCPHYS pGCPhysSpa));
     637    /** @copydoc PDMIOMMUREGR3::pfnMsiRemap */
     638    DECLR3CALLBACKMEMBER(int,   pfnMsiRemap,(PPDMDEVINS pDevIns, uint16_t uDevId, RTGCPHYS GCPhysIn, uint32_t uDataIn,
     639                                             PRTGCPHYS pGCPhysOut, uint32_t *puDataOut));
    637640} PDMIOMMU;
    638641
     
    655658    DECLR0CALLBACKMEMBER(int,   pfnMemWrite,(PPDMDEVINS pDevIns, uint16_t uDevId, uint64_t uDva, size_t cbWrite,
    656659                                             PRTGCPHYS pGCPhysSpa));
     660    /** @copydoc PDMIOMMUREGR3::pfnMsiRemap */
     661    DECLR0CALLBACKMEMBER(int,   pfnMsiRemap,(PPDMDEVINS pDevIns, uint16_t uDevId, RTGCPHYS GCPhysIn, uint32_t uDataIn,
     662                                             PRTGCPHYS pGCPhysOut, uint32_t *puDataOut));
    657663} PDMIOMMUR0;
    658664/** Pointer to a ring-0 IOMMU data. */
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