VirtualBox

Changeset 102020 in vbox


Ignore:
Timestamp:
Nov 9, 2023 11:27:42 AM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
160120
Message:

VMM: Nested VMX: bugref:10318 Discard unused VMCS launch-state bits and update 'VMCLEAR' VMCS launch-state bit to be 0.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/hm_vmx.h

    r101449 r102020  
    38163816/** @name VMX_V_VMCS_STATE_XXX - Virtual VMCS launch state.
    38173817 * @{ */
     3818/** VMCS launch state clear legacy value -- deprecated!!!. */
     3819#define VMX_V_VMCS_LAUNCH_STATE_CLEAR_LEGACY                    RT_BIT(0)
    38183820/** VMCS launch state clear. */
    3819 #define VMX_V_VMCS_LAUNCH_STATE_CLEAR                           RT_BIT(0)
    3820 /** VMCS launch state active. */
    3821 #define VMX_V_VMCS_LAUNCH_STATE_ACTIVE                          RT_BIT(1)
    3822 /** VMCS launch state current. */
    3823 #define VMX_V_VMCS_LAUNCH_STATE_CURRENT                         RT_BIT(2)
     3821#define VMX_V_VMCS_LAUNCH_STATE_CLEAR                           (0)
     3822/* Bit 1 used to be "active", no longer used. */
     3823/* Bit 2 used to be "current", no longer used. */
    38243824/** VMCS launch state launched. */
    38253825#define VMX_V_VMCS_LAUNCH_STATE_LAUNCHED                        RT_BIT(3)
    3826 /** The mask of valid VMCS launch states. */
    3827 #define VMX_V_VMCS_LAUNCH_STATE_MASK                            (  VMX_V_VMCS_LAUNCH_STATE_CLEAR \
    3828                                                                  | VMX_V_VMCS_LAUNCH_STATE_ACTIVE \
    3829                                                                  | VMX_V_VMCS_LAUNCH_STATE_CURRENT \
    3830                                                                  | VMX_V_VMCS_LAUNCH_STATE_LAUNCHED)
    38313826/** @} */
    38323827
  • trunk/include/VBox/vmm/hmvmxinline.h

    r98103 r102020  
    289289    switch (fVmcsState)
    290290    {
    291         case VMX_V_VMCS_LAUNCH_STATE_CLEAR:     return "Clear";
    292         case VMX_V_VMCS_LAUNCH_STATE_LAUNCHED:  return "Launched";
    293         default:                                return "Unknown";
     291        case VMX_V_VMCS_LAUNCH_STATE_CLEAR:            return "Clear";
     292        case VMX_V_VMCS_LAUNCH_STATE_CLEAR_LEGACY:     return "Clear (Legacy(";
     293        case VMX_V_VMCS_LAUNCH_STATE_LAUNCHED:         return "Launched";
     294        default:                                       return "Unknown";
    294295    }
    295296}
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp

    r101487 r102020  
    24492449            Assert(VMXINSTRID_IS_VALID(uInstrId));
    24502450            Assert(VMXINSTRID_GET_ID(uInstrId) == (uInstrId & 0x3));
     2451            Assert(GCPtrDisp == 0);
    24512452            Assert(ExitInstrInfo.RdrandRdseed.u2OperandSize != 3);
    24522453            ExitInstrInfo.RdrandRdseed.u3Undef0  = 0;
     
    78227823
    78237824    /* Current VMCS is not a shadow VMCS. */
    7824     if (!pVCpu->cpum.GstCtx.hwvirt.vmx.Vmcs.u32VmcsRevId.n.fIsShadowVmcs)
     7825    PVMXVVMCS pVmcs = &pVCpu->cpum.GstCtx.hwvirt.vmx.Vmcs;
     7826    if (!pVmcs->u32VmcsRevId.n.fIsShadowVmcs)
    78257827    { /* likely */ }
    78267828    else
     
    78477849    {
    78487850        /* VMLAUNCH with non-clear VMCS. */
    7849         if (pVCpu->cpum.GstCtx.hwvirt.vmx.Vmcs.fVmcsState == VMX_V_VMCS_LAUNCH_STATE_CLEAR)
     7851        if (pVmcs->fVmcsState == VMX_V_VMCS_LAUNCH_STATE_CLEAR)
    78507852        { /* likely */ }
     7853        else if (pVmcs->fVmcsState == VMX_V_VMCS_LAUNCH_STATE_CLEAR_LEGACY)
     7854        {
     7855            /* Convert legacy launch-state value to current value, see @bugref{10318#c114} for reasons.*/
     7856            pVmcs->fVmcsState = VMX_V_VMCS_LAUNCH_STATE_CLEAR;
     7857            Log(("vmlaunch: Updated legacy 'VMCLEAR' VMCS launch-state bit to current\n"));
     7858        }
    78517859        else
    78527860        {
    7853             Log(("vmlaunch: VMLAUNCH with non-clear VMCS -> VMFail\n"));
     7861            Log(("vmlaunch: VMLAUNCH with non-clear VMCS %RGp -> VMFail\n", pVCpu->cpum.GstCtx.hwvirt.vmx.GCPhysVmcs));
    78547862            pVCpu->cpum.GstCtx.hwvirt.vmx.enmDiag = kVmxVDiag_Vmentry_VmcsClear;
    78557863            iemVmxVmFail(pVCpu, VMXINSTRERR_VMLAUNCH_NON_CLEAR_VMCS);
     
    78607868    {
    78617869        /* VMRESUME with non-launched VMCS. */
    7862         if (pVCpu->cpum.GstCtx.hwvirt.vmx.Vmcs.fVmcsState == VMX_V_VMCS_LAUNCH_STATE_LAUNCHED)
     7870        if (pVmcs->fVmcsState == VMX_V_VMCS_LAUNCH_STATE_LAUNCHED)
    78637871        { /* likely */ }
    78647872        else
     
    79037911             */
    79047912            iemVmxVmentrySaveNmiBlockingFF(pVCpu);
    7905 
    7906             PVMXVVMCS pVmcs = &pVCpu->cpum.GstCtx.hwvirt.vmx.Vmcs;
    7907             Assert(pVmcs);
    79087913
    79097914            rc = iemVmxVmentryCheckGuestState(pVCpu, pszInstr);
     
    89979002            if (VM_IS_HM_ENABLED(pVCpu->CTX_SUFF(pVM)))
    89989003                HMNotifyVmxNstGstCurrentVmcsChanged(pVCpu);
     9004
     9005            /* Convert legacy launch-state value to current value, see @bugref{10318#c114} for reasons.*/
     9006            if (pVCpu->cpum.GstCtx.hwvirt.vmx.Vmcs.fVmcsState == VMX_V_VMCS_LAUNCH_STATE_CLEAR_LEGACY)
     9007            {
     9008                pVCpu->cpum.GstCtx.hwvirt.vmx.Vmcs.fVmcsState = VMX_V_VMCS_LAUNCH_STATE_CLEAR;
     9009                Log(("vmptrld: Updated legacy 'VMCLEAR' VMCS launch-state bit to current\n"));
     9010            }
    89999011        }
    90009012        else
     
    90059017            return rc;
    90069018        }
     9019    }
     9020    else if (   IEM_VMX_HAS_CURRENT_VMCS(pVCpu)
     9021             && pVCpu->cpum.GstCtx.hwvirt.vmx.Vmcs.fVmcsState == VMX_V_VMCS_LAUNCH_STATE_CLEAR_LEGACY)
     9022    {
     9023        /* Convert legacy launch-state value to current value, see @bugref{10318#c114} for reasons.*/
     9024        pVCpu->cpum.GstCtx.hwvirt.vmx.Vmcs.fVmcsState = VMX_V_VMCS_LAUNCH_STATE_CLEAR;
     9025        Log(("vmptrld: Updated legacy VMCLEAR launch-state bit to current\n"));
    90079026    }
    90089027
  • trunk/src/VBox/VMM/VMMAll/VMXAllTemplate.cpp.h

    r101060 r102020  
    934934    Assert(pVmcsInfo->HCPhysShadowVmcs != 0 && pVmcsInfo->HCPhysShadowVmcs != NIL_RTHCPHYS);
    935935
    936     int rc = VMXLoadVmcs(pVmcsInfo->HCPhysShadowVmcs);
    937     if (RT_SUCCESS(rc))
    938         pVmcsInfo->fShadowVmcsState |= VMX_V_VMCS_LAUNCH_STATE_CURRENT;
    939     return rc;
     936    return VMXLoadVmcs(pVmcsInfo->HCPhysShadowVmcs);
    940937}
    941938
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r100993 r102020  
    285285    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
    286286
    287     int rc = VMXLoadVmcs(pVmcsInfo->HCPhysVmcs);
    288     if (RT_SUCCESS(rc))
    289         pVmcsInfo->fVmcsState |= VMX_V_VMCS_LAUNCH_STATE_CURRENT;
    290     return rc;
     287    return VMXLoadVmcs(pVmcsInfo->HCPhysVmcs);
    291288}
    292289
     
    30133010        }
    30143011        else
    3015             LogRelFunc(("Failed to load the %s. rc=%Rrc\n", rc, pszVmcs));
     3012            LogRelFunc(("Failed to load the %s. rc=%Rrc\n", pszVmcs, rc));
    30163013    }
    30173014    else
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