Changeset 83263 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Mar 11, 2020 4:34:33 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 136414
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
r82968 r83263 3245 3245 return VINF_SUCCESS; 3246 3246 } 3247 3248 3249 /** @interface_method_impl{PDMDEVHLPR3,pfnIommuRegister} */ 3250 static 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 3247 3298 3248 3299 … … 4118 4169 pdmR3DevHlp_RTCRegister, 4119 4170 pdmR3DevHlp_PCIBusRegister, 4171 pdmR3DevHlp_IommuRegister, 4120 4172 pdmR3DevHlp_PICRegister, 4121 4173 pdmR3DevHlp_ApicRegister, … … 4602 4654 pdmR3DevHlp_RTCRegister, 4603 4655 pdmR3DevHlp_PCIBusRegister, 4656 pdmR3DevHlp_IommuRegister, 4604 4657 pdmR3DevHlp_PICRegister, 4605 4658 pdmR3DevHlp_ApicRegister, -
trunk/src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp
r82968 r83263 236 236 237 237 238 /** 239 * IOMMU Device Helpers. 240 */ 241 const PDMIOMMUHLPR3 g_pdmR3DevIommuHlp = 242 { 243 PDM_IOMMUHLPR3_VERSION, 244 PDM_IOMMUHLPR3_VERSION /* the end */ 245 }; 238 246 239 247 -
trunk/src/VBox/VMM/include/PDMInternal.h
r82968 r83263 107 107 /** Pointer to a PDM PCI Bus instance. */ 108 108 typedef struct PDMPCIBUS *PPDMPCIBUS; 109 /** Pointer to a PDM IOMMU instance. */ 110 typedef struct PDMIOMMU *PPDMIOMMU; 109 111 /** Pointer to a DMAC instance. */ 110 112 typedef struct PDMDMAC *PPDMDMAC; … … 617 619 618 620 /** 621 * PDM registered IOMMU device. 622 */ 623 typedef struct PDMIOMMU 624 { 625 /** IOMMU index. */ 626 uint32_t idxIommu; 627 uint32_t uPadding0; /**< Alignment padding.*/ 628 629 /** Pointer to the IOMMU device instance - R3. */ 630 PPDMDEVINSR3 pDevInsR3; 631 632 /** Pointer to the IOMMU device instance - R0. */ 633 PPDMDEVINSR0 pDevInsR0; 634 635 /** Pointer to the IOMMU device instance - RC. */ 636 PPDMDEVINSRC pDevInsRC; 637 RTRCPTR RCPtrPadding; 638 } PDMIOMMU; 639 640 641 /** 619 642 * PDM registered PIC device. 620 643 */ … … 695 718 696 719 /** Maximum number of PCI busses for a VM. */ 697 #define PDM_PCI_BUSSES_MAX 8 720 #define PDM_PCI_BUSSES_MAX 8 721 /** Maximum number of IOMMUs (at most one per PCI bus). */ 722 #define PDM_IOMMUS_MAX PDM_PCI_BUSSES_MAX 698 723 699 724 … … 1225 1250 /** PCI Buses. */ 1226 1251 PDMPCIBUS aPciBuses[PDM_PCI_BUSSES_MAX]; 1252 /** IOMMU devices. */ 1253 PDMIOMMU aIommus[PDM_IOMMUS_MAX]; 1227 1254 /** The register PIC device. */ 1228 1255 PDMPIC Pic; … … 1394 1421 extern const PDMFWHLPR3 g_pdmR3DevFirmwareHlp; 1395 1422 extern const PDMPCIHLPR3 g_pdmR3DevPciHlp; 1423 extern const PDMIOMMUHLPR3 g_pdmR3DevIommuHlp; 1396 1424 extern const PDMDMACHLP g_pdmR3DevDmacHlp; 1397 1425 extern const PDMRTCHLP g_pdmR3DevRtcHlp;
Note:
See TracChangeset
for help on using the changeset viewer.