- Timestamp:
- Jan 31, 2022 8:25:32 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r93449 r93511 841 841 } 842 842 843 /* Get the CPU profile name. */ 844 Bstr bstrCpuProfile; 845 hrc = pMachine->COMGETTER(CPUProfile)(bstrCpuProfile.asOutParam()); H(); 846 847 /* 848 * Figure out the IOMMU config. 849 */ 843 850 #if defined(VBOX_WITH_IOMMU_AMD) || defined(VBOX_WITH_IOMMU_INTEL) 844 IommuType_T iommuType;845 hrc = pMachine->COMGETTER(IommuType)(& iommuType);H();851 IommuType_T enmIommuType; 852 hrc = pMachine->COMGETTER(IommuType)(&enmIommuType); H(); 846 853 847 854 /* Resolve 'automatic' type to an Intel or AMD IOMMU based on the host CPU. */ 848 if ( iommuType == IommuType_Automatic)855 if (enmIommuType == IommuType_Automatic) 849 856 { 850 if (ASMIsAmdCpu()) 851 iommuType = IommuType_AMD; 857 if ( bstrCpuProfile.startsWith("AMD") 858 || bstrCpuProfile.startsWith("Quad-Core AMD") 859 || bstrCpuProfile.startsWith("Hygon")) 860 enmIommuType = IommuType_AMD; 861 else if (bstrCpuProfile.startsWith("Intel")) 862 { 863 if ( bstrCpuProfile.equals("Intel 8086") 864 || bstrCpuProfile.equals("Intel 80186") 865 || bstrCpuProfile.equals("Intel 80286") 866 || bstrCpuProfile.equals("Intel 80386") 867 || bstrCpuProfile.equals("Intel 80486")) 868 enmIommuType = IommuType_None; 869 else 870 enmIommuType = IommuType_Intel; 871 } 872 # if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) 873 else if (ASMIsAmdCpu()) 874 enmIommuType = IommuType_AMD; 852 875 else if (ASMIsIntelCpu()) 853 iommuType = IommuType_Intel; 876 enmIommuType = IommuType_Intel; 877 # endif 854 878 else 855 879 { 856 880 /** @todo Should we handle other CPUs like Shanghai, VIA etc. here? */ 857 881 LogRel(("WARNING! Unrecognized CPU type, IOMMU disabled.\n")); 858 iommuType = IommuType_None;882 enmIommuType = IommuType_None; 859 883 } 860 884 } 861 885 862 if ( iommuType == IommuType_AMD)886 if (enmIommuType == IommuType_AMD) 863 887 { 864 # ifdef VBOX_WITH_IOMMU_AMD888 # ifdef VBOX_WITH_IOMMU_AMD 865 889 /* 866 890 * Reserve the specific PCI address of the "SB I/O APIC" when using … … 868 892 */ 869 893 uIoApicPciAddress = VBOX_PCI_BDF_SB_IOAPIC; 870 # else894 # else 871 895 LogRel(("WARNING! AMD IOMMU not supported, IOMMU disabled.\n")); 872 iommuType = IommuType_None;873 # endif896 enmIommuType = IommuType_None; 897 # endif 874 898 } 875 899 876 if ( iommuType == IommuType_Intel)900 if (enmIommuType == IommuType_Intel) 877 901 { 878 # ifdef VBOX_WITH_IOMMU_INTEL902 # ifdef VBOX_WITH_IOMMU_INTEL 879 903 /* 880 904 * Reserve a unique PCI address for the I/O APIC when using … … 883 907 */ 884 908 uIoApicPciAddress = VBOX_PCI_BDF_SB_IOAPIC; 885 # else909 # else 886 910 LogRel(("WARNING! Intel IOMMU not supported, IOMMU disabled.\n")); 887 iommuType = IommuType_None;888 # endif911 enmIommuType = IommuType_None; 912 # endif 889 913 } 890 914 891 if ( iommuType == IommuType_AMD892 || iommuType == IommuType_Intel)915 if ( enmIommuType == IommuType_AMD 916 || enmIommuType == IommuType_Intel) 893 917 { 894 918 if (chipsetType != ChipsetType_ICH9) … … 900 924 } 901 925 #else 902 IommuType_T const iommuType = IommuType_None;926 IommuType_T const enmIommuType = IommuType_None; 903 927 #endif 904 Assert(iommuType != IommuType_Automatic); 905 BusAssignmentManager *pBusMgr = mBusMgr = BusAssignmentManager::createInstance(pVMM, chipsetType, iommuType); 928 929 /* Instantiate the bus assignment manager. */ 930 Assert(enmIommuType != IommuType_Automatic); 931 BusAssignmentManager *pBusMgr = mBusMgr = BusAssignmentManager::createInstance(pVMM, chipsetType, enmIommuType); 906 932 907 933 ULONG cCpus = 1; … … 1079 1105 1080 1106 /* CPUM profile name. */ 1081 hrc = pMachine->COMGETTER(CPUProfile)(bstr.asOutParam()); H(); 1082 InsertConfigString(pCPUM, "GuestCpuName", bstr); 1107 InsertConfigString(pCPUM, "GuestCpuName", bstrCpuProfile); 1083 1108 1084 1109 /* … … 1088 1113 * dead wrong on 8086 (see http://www.os2museum.com/wp/undocumented-8086-opcodes/). 1089 1114 */ 1090 if ( bstr .equals("Intel 80386") /* just for now */1091 || bstr .equals("Intel 80286")1092 || bstr .equals("Intel 80186")1093 || bstr .equals("Nec V20")1094 || bstr .equals("Intel 8086") )1115 if ( bstrCpuProfile.equals("Intel 80386") /* just for now */ 1116 || bstrCpuProfile.equals("Intel 80286") 1117 || bstrCpuProfile.equals("Intel 80186") 1118 || bstrCpuProfile.equals("Nec V20") 1119 || bstrCpuProfile.equals("Intel 8086") ) 1095 1120 { 1096 1121 InsertConfigInteger(pEM, "IemExecutesAll", true); 1097 if (!bstr .equals("Intel 80386"))1122 if (!bstrCpuProfile.equals("Intel 80386")) 1098 1123 { 1099 1124 fEnableAPIC = false; … … 1591 1616 #endif 1592 1617 1593 if ( iommuType == IommuType_AMD)1618 if (enmIommuType == IommuType_AMD) 1594 1619 { 1595 1620 /* AMD IOMMU. */ … … 1616 1641 hrc = pBusMgr->assignPCIDevice("sb-ioapic", NULL /* pCfg */, PCIAddr, true /*fGuestAddressRequired*/); H(); 1617 1642 } 1618 else if ( iommuType == IommuType_Intel)1643 else if (enmIommuType == IommuType_Intel) 1619 1644 { 1620 1645 /* Intel IOMMU. */ … … 1774 1799 InsertConfigNode(pInst, "Config", &pCfg); 1775 1800 InsertConfigInteger(pCfg, "NumCPUs", cCpus); 1776 if (iommuType == IommuType_Intel) 1801 if (enmIommuType == IommuType_AMD) 1802 InsertConfigInteger(pCfg, "PCIAddress", uIoApicPciAddress); 1803 else if (enmIommuType == IommuType_Intel) 1777 1804 { 1778 1805 InsertConfigString(pCfg, "ChipType", "DMAR"); 1779 1806 InsertConfigInteger(pCfg, "PCIAddress", uIoApicPciAddress); 1780 1807 } 1781 else if (iommuType == IommuType_AMD)1782 InsertConfigInteger(pCfg, "PCIAddress", uIoApicPciAddress);1783 1808 } 1784 1809 } … … 3509 3534 } 3510 3535 } 3511 if ( iommuType == IommuType_AMD)3536 if (enmIommuType == IommuType_AMD) 3512 3537 { 3513 3538 PCIBusAddress Address; … … 3527 3552 } 3528 3553 } 3529 else if ( iommuType == IommuType_Intel)3554 else if (enmIommuType == IommuType_Intel) 3530 3555 { 3531 3556 PCIBusAddress Address;
Note:
See TracChangeset
for help on using the changeset viewer.