Changeset 88333 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Mar 31, 2021 4:29:39 PM (4 years ago)
- Location:
- trunk/src/VBox/Main/src-client
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/BusAssignmentManager.cpp
r87242 r88333 238 238 * to device number 23 when the VM is configured for an AMD IOMMU. 239 239 */ 240 static const DeviceAssignmentRule g_aIch9Iommu LsiRules[] =240 static const DeviceAssignmentRule g_aIch9IommuAmdRules[] = 241 241 { 242 242 /* AMD IOMMU. */ … … 247 247 /* Storage controller */ 248 248 {"lsilogic", 0, 23, 0, 1}, 249 { NULL, -1, -1, -1, 0} 250 }; 251 #endif 252 253 #ifdef VBOX_WITH_IOMMU_INTEL 254 /* 255 * Intel IOMMU. 256 * The VT-d misc, address remapping, system management device is 257 * located at BDF 00:5:0 on real hardware so we mimick the same. 258 * LSI logic remains at 0:20:0. 259 */ 260 static const DeviceAssignmentRule g_aIch9IommuIntelRules[] = 261 { 262 /* Intel IOMMU. */ 263 {"iommu-intel", 0, 5, 0, 0}, 264 265 /* Storage controller */ 266 {"lsilogic", 0, 20, 0, 1}, 249 267 { NULL, -1, -1, -1, 0} 250 268 }; … … 334 352 HRESULT BusAssignmentManager::State::init(ChipsetType_T chipsetType, IommuType_T iommuType) 335 353 { 336 /* Currently we only support AMD IOMMU. */ 337 Assert(iommuType == IommuType_None || iommuType == IommuType_AMD); 354 if (iommuType != IommuType_None) 355 { 356 #if defined(VBOX_WITH_IOMMU_AMD) && defined(VBOX_WITH_IOMMU_INTEL) 357 Assert(iommuType == IommuType_AMD || iommuType == IommuType_Intel); 358 #elif defined(VBOX_WITH_IOMMU_AMD) 359 Assert(iommuType == IommuType_AMD); 360 #elif defined(VBOX_WITH_IOMMU_INTEL) 361 Assert(iommuType == IommuType_Intel); 362 #endif 363 } 338 364 339 365 mChipsetType = chipsetType; … … 405 431 #ifdef VBOX_WITH_IOMMU_AMD 406 432 if (mIommuType == IommuType_AMD) 407 aArrays[2] = g_aIch9IommuLsiRules; 433 aArrays[2] = g_aIch9IommuAmdRules; 434 else 435 #endif 436 #ifdef VBOX_WITH_IOMMU_INTEL 437 if (mIommuType == IommuType_Intel) 438 aArrays[2] = g_aIch9IommuIntelRules; 408 439 else 409 440 #endif -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r88217 r88333 844 844 } 845 845 846 #if def VBOX_WITH_IOMMU_AMD846 #if defined(VBOX_WITH_IOMMU_AMD) || defined(VBOX_WITH_IOMMU_INTEL) 847 847 IommuType_T iommuType; 848 848 hrc = pMachine->COMGETTER(IommuType)(&iommuType); H(); … … 854 854 iommuType = IommuType_AMD; 855 855 else if (ASMIsIntelCpu()) 856 { 856 iommuType = IommuType_Intel; 857 else 858 { 859 /** @todo Should we handle other CPUs like Shanghai, VIA etc. here? */ 860 LogRel(("WARNING! Unrecognized CPU type, IOMMU disabled.\n")); 857 861 iommuType = IommuType_None; 858 LogRel(("WARNING! Intel IOMMU implemention is not yet supported. Disabled IOMMU.\n"));859 }860 else861 {862 /** @todo Should we handle other CPUs like Shanghai, VIA etc. here? */863 LogRel(("WARNING! Unrecognized CPU type. Disabled IOMMU.\n"));864 iommuType = IommuType_None;865 862 } 866 863 } 867 864 868 /* Handle AMD IOMMU specifics. */ 869 if ( iommuType == IommuType_AMD 865 if (iommuType == IommuType_AMD) 866 { 867 #ifndef VBOX_WITH_IOMMU_AMD 868 LogRel(("WARNING! AMD IOMMU not supported, IOMMU disabled.\n")); 869 iommuType = IommuType_None; 870 #endif 871 } 872 if (iommuType != IommuType_Intel) 873 { 874 #ifndef VBOX_WITH_IOMMU_INTEL 875 LogRel(("WARNING! Intel IOMMU not supported, IOMMU disabled.\n")); 876 iommuType = IommuType_None; 877 #endif 878 } 879 if ( (iommuType == IommuType_AMD || iommuType == IommuType_Intel) 870 880 && chipsetType != ChipsetType_ICH9) 871 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 872 N_("AMD IOMMU uses MSIs which requires the ICH9 chipset implementation.")); 873 874 /** @todo Handle Intel IOMMU specifics. */ 881 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, 882 N_("IOMMU uses MSIs which requires the ICH9 chipset implementation.")); 875 883 #else 876 884 IommuType_T const iommuType = IommuType_None; … … 1575 1583 #endif 1576 1584 1577 #ifdef VBOX_WITH_IOMMU_AMD1578 1585 if (iommuType == IommuType_AMD) 1579 1586 { … … 1583 1590 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 1584 1591 InsertConfigNode(pInst, "Config", &pCfg); 1585 hrc = pBusMgr->assignPCIDevice("iommu-amd", pInst); 1592 hrc = pBusMgr->assignPCIDevice("iommu-amd", pInst); H(); 1586 1593 1587 1594 /* … … 1592 1599 hrc = pBusMgr->assignPCIDevice("sb-ioapic", NULL /* pCfg */, PCIAddr, true /*fGuestAddressRequired*/); H(); 1593 1600 } 1594 #endif 1595 } 1596 /** @todo IOMMU: Disallow creating a VM without ICH9 chipset if an IOMMU is 1597 * configured. */ 1601 else if (iommuType == IommuType_Intel) 1602 { 1603 /* Intel IOMMU. */ 1604 InsertConfigNode(pDevices, "iommu-intel", &pDev); 1605 InsertConfigNode(pDev, "0", &pInst); 1606 InsertConfigInteger(pInst, "Trusted", 1); /* boolean */ 1607 InsertConfigNode(pInst, "Config", &pCfg); 1608 hrc = pBusMgr->assignPCIDevice("iommu-intel", pInst); H(); 1609 } 1610 } 1598 1611 1599 1612 /* … … 3361 3374 } 3362 3375 } 3363 #ifdef VBOX_WITH_IOMMU_AMD3364 3376 if (iommuType == IommuType_AMD) 3365 3377 { … … 3369 3381 uint32_t u32IommuAddress = (Address.miDevice << 16) | Address.miFn; 3370 3382 InsertConfigInteger(pCfg, "IommuAmdEnabled", true); 3371 InsertConfigInteger(pCfg, "Iommu AmdPciAddress", u32IommuAddress);3383 InsertConfigInteger(pCfg, "IommuPciAddress", u32IommuAddress); 3372 3384 if (pBusMgr->findPCIAddress("sb-ioapic", 0, Address)) 3373 3385 { … … 3379 3391 } 3380 3392 } 3381 #endif 3393 else if (iommuType == IommuType_Intel) 3394 { 3395 PCIBusAddress Address; 3396 if (pBusMgr->findPCIAddress("iommu-intel", 0, Address)) 3397 { 3398 uint32_t u32IommuAddress = (Address.miDevice << 16) | Address.miFn; 3399 InsertConfigInteger(pCfg, "IommuIntelEnabled", true); 3400 InsertConfigInteger(pCfg, "IommuPciAddress", u32IommuAddress); 3401 } 3402 } 3403 3382 3404 InsertConfigInteger(pCfg, "IocPciAddress", uIocPCIAddress); 3383 3405 if (chipsetType == ChipsetType_ICH9)
Note:
See TracChangeset
for help on using the changeset viewer.