VirtualBox

Changeset 87521 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Feb 1, 2021 9:48:09 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
142546
Message:

VMM/HM: Moved HM::fHostKernelFeatures to HMR0PERVM. Use the ring-0 uMaxAsid variable (made it a separate global variable), the one in the HM structure is just for ring-3 release logging. bugref:9217

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

Legend:

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

    r87519 r87521  
    144144            } svm;
    145145        } u;
    146         /** Maximum allowed ASID/VPID (inclusive). */
    147         uint32_t                    uMaxAsid;
    148146        /** MSRs. */
    149147        SUPHWVIRTMSRS               Msrs;
     
    168166    RTONCE                          EnableAllCpusOnce;
    169167} g_HmR0;
     168
     169/** Maximum allowed ASID/VPID (inclusive).
     170 * @todo r=bird: This is exclusive for VT-x according to source code comment.
     171 *       Couldn't immediately find any docs on AMD-V, but suspect it is
     172 *       exclusive there as well given how hmR0SvmFlushTaggedTlb() use it. */
     173uint32_t    g_uHmMaxAsid;
    170174
    171175
     
    345349
    346350        /* Initialize VPID - 16 bits ASID. */
    347         g_HmR0.hwvirt.uMaxAsid = 0x10000; /* exclusive */
     351        g_uHmMaxAsid = 0x10000; /* exclusive */
    348352
    349353        /*
     
    487491    /* Query AMD features. */
    488492    uint32_t u32Dummy;
    489     ASMCpuId(0x8000000a, &g_HmR0.hwvirt.u.svm.u32Rev, &g_HmR0.hwvirt.uMaxAsid, &u32Dummy, &g_HmR0.hwvirt.u.svm.u32Features);
     493    ASMCpuId(0x8000000a, &g_HmR0.hwvirt.u.svm.u32Rev, &g_uHmMaxAsid, &u32Dummy, &g_HmR0.hwvirt.u.svm.u32Features);
    490494
    491495    /*
     
    11791183    }
    11801184    pVM->hm.s.rcInit              = g_HmR0.rcInit;
    1181     pVM->hm.s.uMaxAsid            = g_HmR0.hwvirt.uMaxAsid;
     1185    pVM->hm.s.uMaxAsidForLog      = g_uHmMaxAsid;
    11821186
    11831187    /*
     
    12181222     * but it shouldn't be done later than this point so we do it here.
    12191223     */
    1220     pVM->hm.s.fHostKernelFeatures = SUPR0GetKernelFeatures();
     1224    pVM->hmr0.s.fHostKernelFeatures = SUPR0GetKernelFeatures();
    12211225
    12221226    /*
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r87519 r87521  
    13461346
    13471347                bool fHitASIDLimit = false;
    1348                 if (pHostCpu->uCurrentAsid >= pVM->hm.s.uMaxAsid)
     1348                if (pHostCpu->uCurrentAsid >= g_uHmMaxAsid)
    13491349                {
    13501350                    pHostCpu->uCurrentAsid = 1;      /* Wraparound at 1; host uses 0 */
     
    13871387    AssertMsg(pVCpu->hmr0.s.cTlbFlushes == pHostCpu->cTlbFlushes,
    13881388              ("Flush count mismatch for cpu %u (%u vs %u)\n", pHostCpu->idCpu, pVCpu->hmr0.s.cTlbFlushes, pHostCpu->cTlbFlushes));
    1389     AssertMsg(pHostCpu->uCurrentAsid >= 1 && pHostCpu->uCurrentAsid < pVM->hm.s.uMaxAsid,
     1389    AssertMsg(pHostCpu->uCurrentAsid >= 1 && pHostCpu->uCurrentAsid < g_uHmMaxAsid,
    13901390              ("cpu%d uCurrentAsid = %x\n", pHostCpu->idCpu, pHostCpu->uCurrentAsid));
    1391     AssertMsg(pVCpu->hmr0.s.uCurrentAsid >= 1 && pVCpu->hmr0.s.uCurrentAsid < pVM->hm.s.uMaxAsid,
     1391    AssertMsg(pVCpu->hmr0.s.uCurrentAsid >= 1 && pVCpu->hmr0.s.uCurrentAsid < g_uHmMaxAsid,
    13921392              ("cpu%d VM uCurrentAsid = %x\n", pHostCpu->idCpu, pVCpu->hmr0.s.uCurrentAsid));
    13931393
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r87519 r87521  
    30403040    {
    30413041        ++pHostCpu->uCurrentAsid;
    3042         if (pHostCpu->uCurrentAsid >= pVM->hm.s.uMaxAsid)
     3042        if (pHostCpu->uCurrentAsid >= g_uHmMaxAsid)
    30433043        {
    30443044            pHostCpu->uCurrentAsid = 1;            /* Wraparound to 1; host uses 0. */
     
    30973097    AssertMsg(pVCpu->hmr0.s.cTlbFlushes == pHostCpu->cTlbFlushes,
    30983098              ("Flush count mismatch for cpu %d (%u vs %u)\n", pHostCpu->idCpu, pVCpu->hmr0.s.cTlbFlushes, pHostCpu->cTlbFlushes));
    3099     AssertMsg(pHostCpu->uCurrentAsid >= 1 && pHostCpu->uCurrentAsid < pVM->hm.s.uMaxAsid,
     3099    AssertMsg(pHostCpu->uCurrentAsid >= 1 && pHostCpu->uCurrentAsid < g_uHmMaxAsid,
    31003100              ("Cpu[%u] uCurrentAsid=%u cTlbFlushes=%u pVCpu->idLastCpu=%u pVCpu->cTlbFlushes=%u\n", pHostCpu->idCpu,
    31013101               pHostCpu->uCurrentAsid, pHostCpu->cTlbFlushes, pVCpu->hmr0.s.idLastCpu, pVCpu->hmr0.s.cTlbFlushes));
    3102     AssertMsg(pVCpu->hmr0.s.uCurrentAsid >= 1 && pVCpu->hmr0.s.uCurrentAsid < pVM->hm.s.uMaxAsid,
     3102    AssertMsg(pVCpu->hmr0.s.uCurrentAsid >= 1 && pVCpu->hmr0.s.uCurrentAsid < g_uHmMaxAsid,
    31033103              ("Cpu[%u] pVCpu->uCurrentAsid=%u\n", pHostCpu->idCpu, pVCpu->hmr0.s.uCurrentAsid));
    31043104
     
    32203220    {
    32213221        ++pHostCpu->uCurrentAsid;
    3222         if (pHostCpu->uCurrentAsid >= pVM->hm.s.uMaxAsid)
     3222        if (pHostCpu->uCurrentAsid >= g_uHmMaxAsid)
    32233223        {
    32243224            pHostCpu->uCurrentAsid        = 1;     /* Wraparound to 1; host uses 0 */
     
    32493249    AssertMsg(pVCpu->hmr0.s.cTlbFlushes == pHostCpu->cTlbFlushes,
    32503250              ("Flush count mismatch for cpu %d (%u vs %u)\n", pHostCpu->idCpu, pVCpu->hmr0.s.cTlbFlushes, pHostCpu->cTlbFlushes));
    3251     AssertMsg(pHostCpu->uCurrentAsid >= 1 && pHostCpu->uCurrentAsid < pVM->hm.s.uMaxAsid,
     3251    AssertMsg(pHostCpu->uCurrentAsid >= 1 && pHostCpu->uCurrentAsid < g_uHmMaxAsid,
    32523252              ("Cpu[%u] uCurrentAsid=%u cTlbFlushes=%u pVCpu->idLastCpu=%u pVCpu->cTlbFlushes=%u\n", pHostCpu->idCpu,
    32533253               pHostCpu->uCurrentAsid, pHostCpu->cTlbFlushes, pVCpu->hmr0.s.idLastCpu, pVCpu->hmr0.s.cTlbFlushes));
    3254     AssertMsg(pVCpu->hmr0.s.uCurrentAsid >= 1 && pVCpu->hmr0.s.uCurrentAsid < pVM->hm.s.uMaxAsid,
     3254    AssertMsg(pVCpu->hmr0.s.uCurrentAsid >= 1 && pVCpu->hmr0.s.uCurrentAsid < g_uHmMaxAsid,
    32553255              ("Cpu[%u] pVCpu->uCurrentAsid=%u\n", pHostCpu->idCpu, pVCpu->hmr0.s.uCurrentAsid));
    32563256
     
    48124812
    48134813        /* If the host has made GDT read-only, we would need to temporarily toggle CR0.WP before writing the GDT. */
    4814         PVM pVM = pVCpu->CTX_SUFF(pVM);
    4815         if (pVM->hm.s.fHostKernelFeatures & SUPKERNELFEATURES_GDT_READ_ONLY)
     4814        PVMCC pVM = pVCpu->CTX_SUFF(pVM);
     4815        if (pVM->hmr0.s.fHostKernelFeatures & SUPKERNELFEATURES_GDT_READ_ONLY)
    48164816            fRestoreHostFlags |= VMX_RESTORE_HOST_GDT_READ_ONLY;
    4817         if (pVM->hm.s.fHostKernelFeatures & SUPKERNELFEATURES_GDT_NEED_WRITABLE)
     4817        if (pVM->hmr0.s.fHostKernelFeatures & SUPKERNELFEATURES_GDT_NEED_WRITABLE)
    48184818        {
    48194819            /* The GDT is read-only but the writable GDT is available. */
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