Changeset 72419 in vbox
- Timestamp:
- Jun 3, 2018 12:49:33 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/NEMR3Native-win.cpp
r72415 r72419 1084 1084 1085 1085 /** 1086 * Makes sure APIC and firmware will not allow X2APIC mode. 1087 * 1088 * This is rather ugly. 1089 * 1090 * @returns VBox status code 1091 * @param pVM The cross context VM structure. 1092 */ 1093 static int nemR3WinDisableX2Apic(PVM pVM) 1094 { 1095 /* 1096 * First make sure the 'Mode' config value of the APIC isn't set to X2APIC. 1097 * This defaults to APIC, so no need to change unless it's X2APIC. 1098 */ 1099 // /Devices/apic/0/Config/ 1100 PCFGMNODE pCfg = CFGMR3GetChild(CFGMR3GetRoot(pVM), "/Devices/apic/0/Config"); 1101 if (pCfg) 1102 { 1103 uint8_t bMode = 0; 1104 int rc = CFGMR3QueryU8(pCfg, "Mode", &bMode); 1105 AssertLogRelMsgReturn(RT_SUCCESS(rc) || rc == VERR_CFGM_VALUE_NOT_FOUND, ("%Rrc\n", rc), rc); 1106 if (RT_SUCCESS(rc) && bMode == PDMAPICMODE_X2APIC) 1107 { 1108 LogRel(("NEM: Adjusting APIC configuration from X2APIC to APIC max mode. X2APIC is not supported by the WinHvPlatform API!\n")); 1109 LogRel(("NEM: Disable Hyper-V if you need X2APIC for your guests!\n")); 1110 rc = CFGMR3RemoveValue(pCfg, "Mode"); 1111 rc = CFGMR3InsertInteger(pCfg, "Mode", PDMAPICMODE_APIC); 1112 AssertLogRelRCReturn(rc, rc); 1113 } 1114 } 1115 1116 /* 1117 * Now the firmwares. 1118 * These also defaults to APIC and only needs adjusting if configured to X2APIC (2). 1119 */ 1120 static const char * const s_apszFirmwareConfigs[] = 1121 { 1122 "/Devices/efi/0/Config", 1123 "/Devices/pcbios/0/Config", 1124 }; 1125 for (unsigned i = 0; i < RT_ELEMENTS(s_apszFirmwareConfigs); i++) 1126 { 1127 pCfg = CFGMR3GetChild(CFGMR3GetRoot(pVM), "/Devices/APIC/0/Config"); 1128 if (pCfg) 1129 { 1130 uint8_t bMode = 0; 1131 int rc = CFGMR3QueryU8(pCfg, "APIC", &bMode); 1132 AssertLogRelMsgReturn(RT_SUCCESS(rc) || rc == VERR_CFGM_VALUE_NOT_FOUND, ("%Rrc\n", rc), rc); 1133 if (RT_SUCCESS(rc) && bMode == 2) 1134 { 1135 LogRel(("NEM: Adjusting %s/Mode from 2 (X2APIC) to 1 (APIC).\n", s_apszFirmwareConfigs[i])); 1136 rc = CFGMR3RemoveValue(pCfg, "APIC"); 1137 rc = CFGMR3InsertInteger(pCfg, "APIC", 1); 1138 AssertLogRelRCReturn(rc, rc); 1139 } 1140 } 1141 } 1142 1143 return VINF_SUCCESS; 1144 } 1145 1146 1147 /** 1086 1148 * Try initialize the native API. 1087 1149 * … … 1144 1206 VM_SET_MAIN_EXECUTION_ENGINE(pVM, VM_EXEC_ENGINE_NATIVE_API); 1145 1207 Log(("NEM: Marked active!\n")); 1208 nemR3WinDisableX2Apic(pVM); 1146 1209 1147 1210 /* Register release statistics */ … … 1357 1420 /* 1358 1421 * Adjust features. 1422 * Note! We've already disabled X2APIC via CFGM during the first init call. 1359 1423 */ 1360 /** @todo Figure out how to get X2APIC working on AMD (and possible1361 * intel), but first figure how to disable it dynamically. */1362 /*CPUMR3ClearGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_X2APIC);*/1363 1364 1424 return VINF_SUCCESS; 1365 1425 }
Note:
See TracChangeset
for help on using the changeset viewer.