VirtualBox

Changeset 16021 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Jan 19, 2009 12:34:50 AM (16 years ago)
Author:
vboxsync
Message:

PDM: Add new flags which will make the device notified first if the VM is suspended if set

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PDM.cpp

    r14072 r16021  
    976976    for (PPDMDEVINS pDevIns = pVM->pdm.s.pDevInstances; pDevIns; pDevIns = pDevIns->Internal.s.pNextR3)
    977977    {
     978        /*
     979         * Some devices need to be notified first that the VM is suspended to ensure that that there are no pending
     980         * requests from the guest which are still processed. Calling the drivers before these requests are finished
     981         * might lead to errors otherwise. One example is the SATA controller which might still have I/O requests
     982         * pending. But DrvVD sets the files into readonly mode and every request will fail then.
     983         */
     984        if (pDevIns->pDevReg->pfnSuspend && (pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION))
     985        {
     986            LogFlow(("PDMR3Suspend: Notifying - device '%s'/%d\n",
     987                     pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));
     988            pDevIns->pDevReg->pfnSuspend(pDevIns);
     989        }
     990
    978991        for (PPDMLUN pLun = pDevIns->Internal.s.pLunsR3; pLun; pLun = pLun->pNext)
    979992            for (PPDMDRVINS pDrvIns = pLun->pTop; pDrvIns; pDrvIns = pDrvIns->Internal.s.pDown)
     
    985998                }
    986999
    987         if (pDevIns->pDevReg->pfnSuspend)
     1000        /* Don't call the suspend notification again if it was already called. */
     1001        if (pDevIns->pDevReg->pfnSuspend && !(pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION))
    9881002        {
    9891003            LogFlow(("PDMR3Suspend: Notifying - device '%s'/%d\n",
     
    11021116    for (PPDMDEVINS pDevIns = pVM->pdm.s.pDevInstances; pDevIns; pDevIns = pDevIns->Internal.s.pNextR3)
    11031117    {
     1118
     1119        if (pDevIns->pDevReg->pfnPowerOff && (pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION))
     1120        {
     1121            LogFlow(("PDMR3PowerOff: Notifying - device '%s'/%d\n",
     1122                     pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));
     1123            pDevIns->pDevReg->pfnPowerOff(pDevIns);
     1124        }
     1125
    11041126        for (PPDMLUN pLun = pDevIns->Internal.s.pLunsR3; pLun; pLun = pLun->pNext)
    11051127            for (PPDMDRVINS pDrvIns = pLun->pTop; pDrvIns; pDrvIns = pDrvIns->Internal.s.pDown)
     
    11111133                }
    11121134
    1113         if (pDevIns->pDevReg->pfnPowerOff)
     1135        if (pDevIns->pDevReg->pfnPowerOff && !(pDevIns->pDevReg->fFlags & PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION))
    11141136        {
    11151137            LogFlow(("PDMR3PowerOff: Notifying - device '%s'/%d\n",
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