VirtualBox

Changeset 87559 in vbox


Ignore:
Timestamp:
Feb 3, 2021 11:32:52 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
142586
Message:

VMM/HMVMX: Tidied up HM::vmx and HM::svm a little. bugref:9217

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMR0.cpp

    r87557 r87559  
    11721172    if (pVM->hm.s.vmx.fSupported)
    11731173    {
    1174         pVM->hmr0.s.vmx.fUsePreemptTimer    = pVM->hm.s.vmx.fUsePreemptTimerCfg && g_fHmVmxUsePreemptTimer;
    1175         pVM->hm.s.vmx.fUsePreemptTimerCfg   = pVM->hmr0.s.vmx.fUsePreemptTimer;
    1176         pVM->hm.s.vmx.cPreemptTimerShift    = g_cHmVmxPreemptTimerShift;
    1177         pVM->hm.s.vmx.u64HostCr4            = g_uHmVmxHostCr4;
    1178         pVM->hm.s.vmx.u64HostMsrEfer        = g_uHmVmxHostMsrEfer;
    1179         pVM->hm.s.vmx.u64HostSmmMonitorCtl  = g_uHmVmxHostSmmMonitorCtl;
     1174        pVM->hmr0.s.vmx.fUsePreemptTimer            = pVM->hm.s.vmx.fUsePreemptTimerCfg && g_fHmVmxUsePreemptTimer;
     1175        pVM->hm.s.vmx.fUsePreemptTimerCfg           = pVM->hmr0.s.vmx.fUsePreemptTimer;
     1176        pVM->hm.s.vmx.cPreemptTimerShift            = g_cHmVmxPreemptTimerShift;
     1177        pVM->hm.s.vmx.u64HostCr4ForRing3            = g_uHmVmxHostCr4;
     1178        pVM->hm.s.vmx.u64HostMsrEferForRing3        = g_uHmVmxHostMsrEfer;
     1179        pVM->hm.s.vmx.u64HostSmmMonitorCtlForRing3  = g_uHmVmxHostSmmMonitorCtl;
    11801180        HMGetVmxMsrsFromHwvirtMsrs(&g_HmMsrs, &pVM->hm.s.vmx.MsrsForRing3);
    11811181        /* If you need to tweak host MSRs for testing VMX R0 code, do it here. */
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r87558 r87559  
    15061506    LogRel(("HM: Using VT-x implementation 3.0\n"));
    15071507    LogRel(("HM: Max resume loops                  = %u\n",     pVM->hm.s.cMaxResumeLoopsCfg));
    1508     LogRel(("HM: Host CR4                          = %#RX64\n", pVM->hm.s.vmx.u64HostCr4));
    1509     LogRel(("HM: Host EFER                         = %#RX64\n", pVM->hm.s.vmx.u64HostMsrEfer));
    1510     LogRel(("HM: MSR_IA32_SMM_MONITOR_CTL          = %#RX64\n", pVM->hm.s.vmx.u64HostSmmMonitorCtl));
     1508    LogRel(("HM: Host CR4                          = %#RX64\n", pVM->hm.s.vmx.u64HostCr4ForRing3));
     1509    LogRel(("HM: Host EFER                         = %#RX64\n", pVM->hm.s.vmx.u64HostMsrEferForRing3));
     1510    LogRel(("HM: MSR_IA32_SMM_MONITOR_CTL          = %#RX64\n", pVM->hm.s.vmx.u64HostSmmMonitorCtlForRing3));
    15111511
    15121512    hmR3VmxReportFeatCtlMsr(pVM->hm.s.vmx.MsrsForRing3.u64FeatCtrl);
  • trunk/src/VBox/VMM/include/HMInternal.h

    r87558 r87559  
    491491        /** Set when we've enabled VMX. */
    492492        bool                        fEnabled;
    493         /** Set if VPID is supported (ring-3 copy). */
    494         bool                        fVpidForRing3;
     493        /** The shift mask employed by the VMX-Preemption timer (set by ring-0). */
     494        uint8_t                     cPreemptTimerShift;
     495        bool                        afAlignment1[5];
     496
     497        /** Pause-loop exiting (PLE) gap in ticks. */
     498        uint32_t                    cPleGapTicks;
     499        /** Pause-loop exiting (PLE) window in ticks. */
     500        uint32_t                    cPleWindowTicks;
     501
     502        /** Virtual address of the TSS page used for real mode emulation. */
     503        R3PTRTYPE(PVBOXTSS)         pRealModeTSS;
     504        /** Virtual address of the identity page table used for real mode and protected
     505         *  mode without paging emulation in EPT mode. */
     506        R3PTRTYPE(PX86PD)           pNonPagingModeEPTPageTable;
     507
     508        /** @name Configuration (gets copied if problematic)
     509         * @{ */
     510        /** Set if Last Branch Record (LBR) is enabled. */
     511        bool                        fLbrCfg;
    495512        /** Set if VT-x VPID is allowed. */
    496513        bool                        fAllowVpid;
     
    501518         * quietly clears this if the hardware doesn't support the preemption timer. */
    502519        bool                        fUsePreemptTimerCfg;
    503         /** The shift mask employed by the VMX-Preemption timer (set by ring-0). */
    504         uint8_t                     cPreemptTimerShift;
    505         bool                        fAlignment1;
    506 
    507         /** Pause-loop exiting (PLE) gap in ticks. */
    508         uint32_t                    cPleGapTicks;
    509         /** Pause-loop exiting (PLE) window in ticks. */
    510         uint32_t                    cPleWindowTicks;
    511 
    512         /** Host CR4 value (set by ring-0 VMX init, for logging). */
    513         uint64_t                    u64HostCr4;
    514         /** Host SMM monitor control (set by ring-0 VMX init, for logging). */
    515         uint64_t                    u64HostSmmMonitorCtl;
    516         /** Host EFER value (set by ring-0 VMX init, for logging and guest NX). */
    517         uint64_t                    u64HostMsrEfer;
     520        /** @} */
     521
     522        /** @name For ring-3 consumption
     523         * @{ */
     524        /** Set if VPID is supported (ring-3 copy). */
     525        bool                        fVpidForRing3;
    518526        /** Whether the CPU supports VMCS fields for swapping EFER (set by ring-0 VMX
    519527         *  init, for logging). */
     
    521529        /** Whether to use VMCS shadowing. */
    522530        bool                        fUseVmcsShadowingForRing3;
    523         /** Set if Last Branch Record (LBR) is enabled. */
    524         bool                        fLbrCfg;
    525         bool                        afAlignment2[5];
     531        bool                        fAlignment2;
     532
     533        /** Host CR4 value (set by ring-0 VMX init, for logging). */
     534        uint64_t                    u64HostCr4ForRing3;
     535        /** Host SMM monitor control (set by ring-0 VMX init, for logging). */
     536        uint64_t                    u64HostSmmMonitorCtlForRing3;
     537        /** Host EFER value (set by ring-0 VMX init, for logging and guest NX). */
     538        uint64_t                    u64HostMsrEferForRing3;
    526539
    527540        /** The first valid host LBR branch-from-IP stack range. */
     
    539552        /** VMX MSR values (only for ring-3 consumption). */
    540553        VMXMSRS                     MsrsForRing3;
     554
    541555        /** Tagged-TLB flush type (only for ring-3 consumption). */
    542556        VMXTLBFLUSHTYPE             enmTlbFlushTypeForRing3;
     
    545559        /** Flush type to use for INVVPID (only for ring-3 consumption). */
    546560        VMXTLBFLUSHVPID             enmTlbFlushVpidForRing3;
    547         uint32_t                    u32Alignment2;
    548 
    549         /** Virtual address of the TSS page used for real mode emulation. */
    550         R3PTRTYPE(PVBOXTSS)         pRealModeTSS;
    551         /** Virtual address of the identity page table used for real mode and protected
    552          *  mode without paging emulation in EPT mode. */
    553         R3PTRTYPE(PX86PD)           pNonPagingModeEPTPageTable;
     561        /** @} */
    554562    } vmx;
    555563
     
    569577        /** Whether to use LBR virtualization feature. */
    570578        bool                        fLbrVirt;
    571         uint8_t                     u8Alignment0[2];
    572 
    573         /** HWCR MSR (for diagnostics). */
    574         uint64_t                    u64MsrHwcr;
    575 
     579        bool                        afAlignment1[2];
     580
     581        /** Pause filter counter. */
     582        uint16_t                    cPauseFilter;
     583        /** Pause filter treshold in ticks. */
     584        uint16_t                    cPauseFilterThresholdTicks;
     585        uint32_t                    u32Alignment2;
     586
     587        /** @name For ring-3 consumption
     588         * @{ */
    576589        /** SVM revision. */
    577590        uint32_t                    u32Rev;
    578591        /** SVM feature bits from cpuid 0x8000000a, ring-3 copy. */
    579592        uint32_t                    fFeaturesForRing3;
    580 
    581         /** Pause filter counter. */
    582         uint16_t                    cPauseFilter;
    583         /** Pause filter treshold in ticks. */
    584         uint16_t                    cPauseFilterThresholdTicks;
    585         uint32_t                    u32Alignment0;
     593        /** HWCR MSR (for diagnostics). */
     594        uint64_t                    u64MsrHwcr;
     595        /** @} */
    586596    } svm;
    587597
Note: See TracChangeset for help on using the changeset viewer.

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