VirtualBox

Changeset 55970 in vbox


Ignore:
Timestamp:
May 20, 2015 3:16:16 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
100475
Message:

VMM/PDM: Change PDMR3PowerOff to always call the power off notification for all devices and attached drivers even if they were suspended with PDMR3Suspend before (see xTracker #6567)

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmdev.h

    r55952 r55970  
    161161 * Power Off notification.
    162162 *
    163  * This is only called when the VMR3PowerOff call is made on a running VM.  This
    164  * means that there is no notification if the VM was suspended before being
    165  * powered off.  There will also be no callback when hot plugging devices.
     163 * This is always called when VMR3PowerOff is called.
     164 * There will be no callback when hot plugging devices.
    166165 *
    167166 * @param   pDevIns     The device instance data.
  • trunk/include/VBox/vmm/pdmdrv.h

    r55952 r55970  
    175175 * Power Off notification.
    176176 *
    177  * This is only called when the VMR3PowerOff call is made on a running VM. This
    178  * means that there is no notification if the VM was suspended before being
    179  * powered of.  There will also be no callback when hot plugging devices or when
    180  * replumbing the driver stack.
     177 * This is always called when VMR3PowerOff is called.
     178 * There will be no callback when hot plugging devices or when replumbing the driver
     179 * stack.
    181180 *
    182181 * @param   pDrvIns     The driver instance data.
  • trunk/src/VBox/VMM/VMMR3/PDM.cpp

    r54385 r55970  
    21012101    LogFlow(("PDMR3PowerOff:\n"));
    21022102    uint64_t cNsElapsed = RTTimeNanoTS();
     2103
     2104    /*
     2105     * Clear the suspended flags on all devices and drivers first because they
     2106     * might have been set during a suspend but the power off callbacks should
     2107     * be called in any case.
     2108     */
     2109    for (PPDMDEVINS pDevIns = pVM->pdm.s.pDevInstances; pDevIns; pDevIns = pDevIns->Internal.s.pNextR3)
     2110    {
     2111        pDevIns->Internal.s.fIntFlags &= ~PDMDEVINSINT_FLAGS_SUSPENDED;
     2112
     2113        for (PPDMLUN pLun = pDevIns->Internal.s.pLunsR3; pLun; pLun = pLun->pNext)
     2114            for (PPDMDRVINS pDrvIns = pLun->pTop; pDrvIns; pDrvIns = pDrvIns->Internal.s.pDown)
     2115                pDrvIns->Internal.s.fVMSuspended = false;
     2116    }
     2117
     2118#ifdef VBOX_WITH_USB
     2119    for (PPDMUSBINS pUsbIns = pVM->pdm.s.pUsbInstances; pUsbIns; pUsbIns = pUsbIns->Internal.s.pNext)
     2120    {
     2121        pUsbIns->Internal.s.fVMSuspended = false;
     2122
     2123        for (PPDMLUN pLun = pUsbIns->Internal.s.pLuns; pLun; pLun = pLun->pNext)
     2124            for (PPDMDRVINS pDrvIns = pLun->pTop; pDrvIns; pDrvIns = pDrvIns->Internal.s.pDown)
     2125                pDrvIns->Internal.s.fVMSuspended = false;
     2126    }
     2127#endif
    21032128
    21042129    /*
  • trunk/src/VBox/VMM/include/PDMInternal.h

    r52670 r55970  
    176176 * to make sure each device gets exactly one notification for each of those
    177177 * events.  PDMR3Resume and PDMR3PowerOn also makes use of it to bail out on
    178  * a failure (already resumed/powered-on devices are suspended). */
     178 * a failure (already resumed/powered-on devices are suspended).
     179 * PDMR3PowerOff resets this flag once before going through the devices to make sure
     180 * every device gets the power off notification even if it was suspended before with
     181 * PDMR3Suspend.
     182 */
    179183#define PDMDEVINSINT_FLAGS_SUSPENDED     RT_BIT_32(1)
    180184/** Indicates that the device has been reset already.  Used by PDMR3Reset. */
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