VirtualBox

Changeset 69068 in vbox for trunk


Ignore:
Timestamp:
Oct 13, 2017 9:14:48 AM (7 years ago)
Author:
vboxsync
Message:

VMM/HMSVMR0: Flush all tagged TLB entries on ASID wrap-around or while enabling SVM on a CPU.

File:
1 edited

Legend:

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

    r69046 r69068  
    403403     * Theoretically, other hypervisors may have used ASIDs, ideally we should flush all non-zero ASIDs
    404404     * when enabling SVM. AMD doesn't have an SVM instruction to flush all ASIDs (flushing is done
    405      * upon VMRUN). Therefore, just set the fFlushAsidBeforeUse flag which instructs hmR0SvmSetupTLB()
    406      * to flush the TLB with before using a new ASID.
     405     * upon VMRUN). Therefore, flag that we need to flush the TLB entirely with before executing any
     406     * guest code.
    407407     */
    408408    pCpu->fFlushAsidBeforeUse = true;
     
    958958            {
    959959                ++pCpu->uCurrentAsid;
     960
    960961                bool fHitASIDLimit = false;
    961962                if (pCpu->uCurrentAsid >= pVM->hm.s.uMaxAsid)
     
    964965                    pCpu->cTlbFlushes++;         /* All VCPUs that run on this host CPU must use a new ASID. */
    965966                    fHitASIDLimit      = true;
    966 
    967                     if (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_FLUSH_BY_ASID)
    968                     {
    969                         pVmcb->ctrl.TLBCtrl.n.u8TLBFlush = SVM_TLB_FLUSH_SINGLE_CONTEXT;
    970                         pCpu->fFlushAsidBeforeUse = true;
    971                     }
    972                     else
    973                     {
    974                         pVmcb->ctrl.TLBCtrl.n.u8TLBFlush = SVM_TLB_FLUSH_ENTIRE;
    975                         pCpu->fFlushAsidBeforeUse = false;
    976                     }
    977967                }
    978968
    979                 if (   !fHitASIDLimit
    980                     && pCpu->fFlushAsidBeforeUse)
     969                if (   fHitASIDLimit
     970                    || pCpu->fFlushAsidBeforeUse)
    981971                {
    982                     if (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_FLUSH_BY_ASID)
    983                         pVmcb->ctrl.TLBCtrl.n.u8TLBFlush = SVM_TLB_FLUSH_SINGLE_CONTEXT;
    984                     else
    985                     {
    986                         pVmcb->ctrl.TLBCtrl.n.u8TLBFlush = SVM_TLB_FLUSH_ENTIRE;
    987                         pCpu->fFlushAsidBeforeUse = false;
    988                     }
     972                    pVmcb->ctrl.TLBCtrl.n.u8TLBFlush = SVM_TLB_FLUSH_ENTIRE;
     973                    pCpu->fFlushAsidBeforeUse = false;
    989974                }
    990975
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