Changeset 98354 in vbox
- Timestamp:
- Jan 31, 2023 9:05:38 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp
r98103 r98354 3116 3116 3117 3117 /* 3118 * Finally, initialize guest VMX MSRs.3119 *3120 * This needs to be done -after- exploding guest features and sanitizing CPUID leaves3121 * as constructing VMX capabilities MSRs rely on CPU feature bits like long mode,3122 * unrestricted-guest execution, CR4 feature bits and possibly more in the future.3123 */3124 /** @todo r=bird: given that long mode never used to be enabled before the3125 * VMINITCOMPLETED_RING0 state, and we're a lot earlier here in ring-33126 * init, the above comment cannot be entirely accurate. */3127 if (pVM->cpum.s.GuestFeatures.fVmx)3128 {3129 Assert(Config.fNestedHWVirt);3130 cpumR3InitVmxGuestFeaturesAndMsrs(pVM, pCpumCfg, &pHostMsrs->hwvirt.vmx, &GuestMsrs.hwvirt.vmx);3131 3132 /* Copy MSRs to all VCPUs */3133 PCVMXMSRS pVmxMsrs = &GuestMsrs.hwvirt.vmx;3134 for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)3135 {3136 PVMCPU pVCpu = pVM->apCpusR3[idCpu];3137 memcpy(&pVCpu->cpum.s.Guest.hwvirt.vmx.Msrs, pVmxMsrs, sizeof(*pVmxMsrs));3138 }3139 }3140 3141 /*3142 3118 * Some more configuration that we're applying at the end of everything 3143 3119 * via the CPUMR3SetGuestCpuIdFeature API. … … 3217 3193 LogRel(("CPUM: Set SSBD not required flag for AMD to work around some buggy Linux kernels!\n")); 3218 3194 } 3195 } 3196 } 3197 3198 /* 3199 * Finally, initialize guest VMX MSRs. 3200 * 3201 * This needs to be done -after- exploding guest features and sanitizing CPUID leaves 3202 * as constructing VMX capabilities MSRs rely on CPU feature bits like long mode, 3203 * unrestricted-guest execution, CR4 feature bits and possibly more in the future. 3204 */ 3205 /** @todo r=bird: given that long mode never used to be enabled before the 3206 * VMINITCOMPLETED_RING0 state, and we're a lot earlier here in ring-3 3207 * init, the above comment cannot be entirely accurate. */ 3208 if (pVM->cpum.s.GuestFeatures.fVmx) 3209 { 3210 Assert(Config.fNestedHWVirt); 3211 cpumR3InitVmxGuestFeaturesAndMsrs(pVM, pCpumCfg, &pHostMsrs->hwvirt.vmx, &GuestMsrs.hwvirt.vmx); 3212 3213 /* Copy MSRs to all VCPUs */ 3214 PCVMXMSRS pVmxMsrs = &GuestMsrs.hwvirt.vmx; 3215 for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++) 3216 { 3217 PVMCPU pVCpu = pVM->apCpusR3[idCpu]; 3218 memcpy(&pVCpu->cpum.s.Guest.hwvirt.vmx.Msrs, pVmxMsrs, sizeof(*pVmxMsrs)); 3219 3219 } 3220 3220 }
Note:
See TracChangeset
for help on using the changeset viewer.