VirtualBox

Changeset 83263 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Mar 11, 2020 4:34:33 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
136414
Message:

AMD IOMMU: bugref:9654 Skeletal bits.

Location:
trunk/src/VBox/VMM/VMMR3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp

    r82968 r83263  
    32453245    return VINF_SUCCESS;
    32463246}
     3247
     3248
     3249/** @interface_method_impl{PDMDEVHLPR3,pfnIommuRegister} */
     3250static DECLCALLBACK(int) pdmR3DevHlp_IommuRegister(PPDMDEVINS pDevIns, PPDMIOMMUREGR3 pIommuReg, PCPDMIOMMUHLPR3 *ppIommuHlp)
     3251{
     3252    PDMDEV_ASSERT_DEVINS(pDevIns);
     3253    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
     3254    LogFlow(("pdmR3DevHlp_IommuRegister: caller='%s'/%d: pIommuReg=%p:{.u32Version=%#x, .u32TheEnd=%#x } ppIommuHlp=%p\n",
     3255             pDevIns->pReg->szName, pDevIns->iInstance, pIommuReg, pIommuReg->u32Version, pIommuReg->u32TheEnd, ppIommuHlp));
     3256    PVM pVM = pDevIns->Internal.s.pVMR3;
     3257
     3258    /*
     3259     * Validate input.
     3260     */
     3261    AssertMsgReturn(pIommuReg->u32Version == PDM_IOMMUREGR3_VERSION,
     3262                    ("%s/%d: u32Version=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pIommuReg->u32Version, PDM_IOMMUREGR3_VERSION),
     3263                    VERR_INVALID_PARAMETER);
     3264    /** @todo IOMMU: Validate other parameters, see also tstDevicePdmDevHlp.cpp. */
     3265    AssertMsgReturn(pIommuReg->u32TheEnd == PDM_IOMMUREGR3_VERSION,
     3266                    ("%s/%d: u32TheEnd=%#x expected %#x\n", pDevIns->pReg->szName, pDevIns->iInstance, pIommuReg->u32TheEnd, PDM_IOMMUREGR3_VERSION),
     3267                    VERR_INVALID_PARAMETER);
     3268    AssertPtrReturn(ppIommuHlp, VERR_INVALID_POINTER);
     3269
     3270    VM_ASSERT_STATE_RETURN(pVM, VMSTATE_CREATING, VERR_WRONG_ORDER);
     3271    VM_ASSERT_EMT0_RETURN(pVM, VERR_VM_THREAD_NOT_EMT);
     3272
     3273    /*
     3274     * Find free IOMMU slot.
     3275     */
     3276    unsigned idxIommu = 0;
     3277    for (idxIommu = 0; idxIommu < RT_ELEMENTS(pVM->pdm.s.aIommus); idxIommu++)
     3278        if (!pVM->pdm.s.aIommus[idxIommu].pDevInsR3)
     3279            break;
     3280    AssertLogRelMsgReturn(idxIommu < RT_ELEMENTS(pVM->pdm.s.aIommus),
     3281                          ("Too many IOMMUs. Max=%u\n", RT_ELEMENTS(pVM->pdm.s.aIommus)),
     3282                          VERR_OUT_OF_RESOURCES);
     3283    PPDMIOMMU pIommu = &pVM->pdm.s.aIommus[idxIommu];
     3284
     3285    /*
     3286     * Init the R3 bits.
     3287     */
     3288    pIommu->idxIommu = idxIommu;
     3289    pIommu->pDevInsR3 = pDevIns;
     3290    Log(("PDM: Registered IOMMU device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
     3291
     3292    /* Set the helper pointer and return. */
     3293    *ppIommuHlp = &g_pdmR3DevIommuHlp;
     3294    LogFlow(("pdmR3DevHlp_IommuRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, VINF_SUCCESS));
     3295    return VINF_SUCCESS;
     3296}
     3297
    32473298
    32483299
     
    41184169    pdmR3DevHlp_RTCRegister,
    41194170    pdmR3DevHlp_PCIBusRegister,
     4171    pdmR3DevHlp_IommuRegister,
    41204172    pdmR3DevHlp_PICRegister,
    41214173    pdmR3DevHlp_ApicRegister,
     
    46024654    pdmR3DevHlp_RTCRegister,
    46034655    pdmR3DevHlp_PCIBusRegister,
     4656    pdmR3DevHlp_IommuRegister,
    46044657    pdmR3DevHlp_PICRegister,
    46054658    pdmR3DevHlp_ApicRegister,
  • trunk/src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp

    r82968 r83263  
    236236
    237237
     238/**
     239 * IOMMU Device Helpers.
     240 */
     241const PDMIOMMUHLPR3 g_pdmR3DevIommuHlp =
     242{
     243    PDM_IOMMUHLPR3_VERSION,
     244    PDM_IOMMUHLPR3_VERSION /* the end */
     245};
    238246
    239247
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