VirtualBox

Changeset 92721 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 2, 2021 10:42:04 PM (3 years ago)
Author:
vboxsync
Message:

VMM: Made driverless adjustments to the halt and cleanup code. bugref:10138

Location:
trunk/src/VBox/VMM/VMMR3
Files:
5 edited

Legend:

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

    r92703 r92721  
    266266GMMR3DECL(int)  GMMR3BalloonedPages(PVM pVM, GMMBALLOONACTION enmAction, uint32_t cBalloonedPages)
    267267{
    268     GMMBALLOONEDPAGESREQ Req;
    269     Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
    270     Req.Hdr.cbReq = sizeof(Req);
    271     Req.enmAction = enmAction;
    272     Req.cBalloonedPages = cBalloonedPages;
    273 
    274     return VMMR3CallR0(pVM, VMMR0_DO_GMM_BALLOONED_PAGES, 0, &Req.Hdr);
     268    int rc;
     269    if (!SUPR3IsDriverless())
     270    {
     271        GMMBALLOONEDPAGESREQ Req;
     272        Req.Hdr.u32Magic = SUPVMMR0REQHDR_MAGIC;
     273        Req.Hdr.cbReq = sizeof(Req);
     274        Req.enmAction = enmAction;
     275        Req.cBalloonedPages = cBalloonedPages;
     276
     277        rc = VMMR3CallR0(pVM, VMMR0_DO_GMM_BALLOONED_PAGES, 0, &Req.Hdr);
     278    }
     279    /*
     280     * Ignore reset and fail all other requests.
     281     */
     282    else if (enmAction == GMMBALLOONACTION_RESET && cBalloonedPages == 0)
     283        rc = VINF_SUCCESS;
     284    else
     285        rc = VERR_SUP_DRIVERLESS;
     286    return rc;
    275287}
    276288
     
    395407GMMR3DECL(int) GMMR3ResetSharedModules(PVM pVM)
    396408{
    397     return VMMR3CallR0(pVM, VMMR0_DO_GMM_RESET_SHARED_MODULES, 0, NULL);
     409    if (!SUPR3IsDriverless())
     410        return VMMR3CallR0(pVM, VMMR0_DO_GMM_RESET_SHARED_MODULES, 0, NULL);
     411    return VINF_SUCCESS;
    398412}
    399413
  • trunk/src/VBox/VMM/VMMR3/GVMMR3.cpp

    r92713 r92721  
    118118 * @returns VBox status code.
    119119 * @param   pUVM    The user mode VM handle.
    120  */
    121 VMMR3_INT_DECL(int) GVMMR3DestroyVM(PUVM pUVM)
    122 {
    123     PVM pVM = pUVM->pVM;
     120 * @param   pVM     The cross context VM structure.
     121 */
     122VMMR3_INT_DECL(int) GVMMR3DestroyVM(PUVM pUVM, PVM pVM)
     123{
    124124    AssertPtrReturn(pVM, VERR_INVALID_VM_HANDLE);
    125125    Assert(pUVM->cCpus == pVM->cCpus);
     126    RT_NOREF(pUVM);
    126127
    127128    int rc;
     
    156157            LogRel(("idCpu=%u rc=%Rrc\n", idCpu, rc));
    157158    }
     159    else
     160        rc = VINF_SUCCESS;
     161    return rc;
     162}
     163
     164
     165/**
     166 * Deregister the calling EMT from GVM.
     167 *
     168 * @returns VBox status code.
     169 * @param   pVM         The cross context VM structure.
     170 * @param   idCpu       The Virtual CPU ID.
     171 * @thread  EMT(idCpu)
     172 * @see     GVMMR0DeregisterVCpu
     173 */
     174VMMR3_INT_DECL(int) GVMMR3DeregisterVCpu(PVM pVM, VMCPUID idCpu)
     175{
     176    Assert(VMMGetCpuId(pVM) == idCpu);
     177    int rc;
     178    if (!SUPR3IsDriverless())
     179        rc = SUPR3CallVMMR0Ex(VMCC_GET_VMR0_FOR_CALL(pVM), idCpu, VMMR0_DO_GVMM_DEREGISTER_VMCPU, 0, NULL);
    158180    else
    159181        rc = VINF_SUCCESS;
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r92703 r92721  
    21742174     * in there.  (Not unlikely if the VM shuts down, apparently.)
    21752175     */
    2176     rc = VMMR3CallR0(pVM, VMMR0_DO_PGM_FLUSH_HANDY_PAGES, 0, NULL);
     2176# ifdef VBOX_WITH_PGM_NEM_MODE
     2177    if (!pVM->pgm.s.fNemMode)
     2178# endif
     2179        rc = VMMR3CallR0(pVM, VMMR0_DO_PGM_FLUSH_HANDY_PAGES, 0, NULL);
    21772180#endif
    21782181
  • trunk/src/VBox/VMM/VMMR3/VM.cpp

    r92703 r92721  
    708708        }
    709709
    710         int rc2 = GVMMR3DestroyVM(pUVM);
     710        int rc2 = GVMMR3DestroyVM(pUVM, pVM);
    711711        AssertRC(rc2);
    712712    }
  • trunk/src/VBox/VMM/VMMR3/VMEmt.cpp

    r90784 r92721  
    2424#include <VBox/vmm/dbgf.h>
    2525#include <VBox/vmm/em.h>
     26#include <VBox/vmm/gvmm.h>
    2627#include <VBox/vmm/nem.h>
    2728#include <VBox/vmm/pdmapi.h>
     
    285286        }
    286287
    287         int rc2 = SUPR3CallVMMR0Ex(VMCC_GET_VMR0_FOR_CALL(pVM), 0 /*idCpu*/, VMMR0_DO_GVMM_DESTROY_VM, 0, NULL);
     288        int rc2 = GVMMR3DestroyVM(pUVM, pVM);
    288289        AssertLogRelRC(rc2);
    289290    }
     
    292293             && (pVM = pUVM->pVM) != NULL)
    293294    {
    294         int rc2 = SUPR3CallVMMR0Ex(VMCC_GET_VMR0_FOR_CALL(pVM), idCpu, VMMR0_DO_GVMM_DEREGISTER_VMCPU, 0, NULL);
     295        int rc2 = GVMMR3DeregisterVCpu(pVM, idCpu);
    295296        AssertLogRelRC(rc2);
    296297    }
     
    13471348            //enmHaltMethod = VMHALTMETHOD_OLD;
    13481349    }
    1349     LogRel(("VMEmt: Halt method %s (%d)\n", vmR3GetHaltMethodName(enmHaltMethod), enmHaltMethod));
     1350
     1351    /*
     1352     * The global halt method doesn't work in driverless mode, so fall back on
     1353     * method #1 instead.
     1354     */
     1355    if (!SUPR3IsDriverless() || enmHaltMethod != VMHALTMETHOD_GLOBAL_1)
     1356        LogRel(("VMEmt: Halt method %s (%d)\n", vmR3GetHaltMethodName(enmHaltMethod), enmHaltMethod));
     1357    else
     1358    {
     1359        LogRel(("VMEmt: Halt method %s (%d) not available in driverless mode, using %s (%d) instead\n",
     1360                vmR3GetHaltMethodName(enmHaltMethod), enmHaltMethod, vmR3GetHaltMethodName(VMHALTMETHOD_1), VMHALTMETHOD_1));
     1361        enmHaltMethod = VMHALTMETHOD_1;
     1362    }
     1363
    13501364
    13511365    /*
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