VirtualBox

Changeset 98354 in vbox


Ignore:
Timestamp:
Jan 31, 2023 9:05:38 AM (2 years ago)
Author:
vboxsync
Message:

VMM/CPUM: Nested VMX: bugref:10318 Postpone initializing VMX features and MSRs after guest features like PAE are enabled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp

    r98103 r98354  
    31163116
    31173117        /*
    3118          * Finally, initialize guest VMX MSRs.
    3119          *
    3120          * This needs to be done -after- exploding guest features and sanitizing CPUID leaves
    3121          * 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 the
    3125          *        VMINITCOMPLETED_RING0 state, and we're a lot earlier here in ring-3
    3126          *        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         /*
    31423118         * Some more configuration that we're applying at the end of everything
    31433119         * via the CPUMR3SetGuestCpuIdFeature API.
     
    32173193                    LogRel(("CPUM: Set SSBD not required flag for AMD to work around some buggy Linux kernels!\n"));
    32183194                }
     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));
    32193219            }
    32203220        }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette