VirtualBox

Changeset 37466 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Jun 15, 2011 12:44:16 PM (14 years ago)
Author:
vboxsync
Message:

VMM,Devices: Automatically use a per-device lock instead of the giant IOM lock. With exception of the PIC, APIC, IOAPIC and PCI buses which are all using the PDM crit sect, there should be no calls between devices. So, this change should be relatively safe.

Location:
trunk/include/VBox/vmm
Files:
3 edited

Legend:

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

    r37452 r37466  
    264264VMMR3_INT_DECL(int)  IOMR3MmioDeregister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange);
    265265
    266 VMMR3DECL(PPDMCRITSECT) IOMR3GetCritSect(PVM pVM);
    267 
    268266/** @} */
    269267#endif /* IN_RING3 */
  • trunk/include/VBox/vmm/pdmapi.h

    r35361 r37466  
    122122VMMR3DECL(int)  PDMR3DeviceAttach(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags, PPDMIBASE *ppBase);
    123123VMMR3DECL(int)  PDMR3DeviceDetach(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, uint32_t fFlags);
     124VMMR3_INT_DECL(PPDMCRITSECT) PDMR3DevGetCritSect(PVM pVM, PPDMDEVINS pDevIns);
    124125VMMR3DECL(int)  PDMR3DriverAttach(PVM pVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, uint32_t fFlags, PPPDMIBASE ppBase);
    125126VMMR3DECL(int)  PDMR3DriverDetach(PVM pVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
  • trunk/include/VBox/vmm/pdmdev.h

    r37443 r37466  
    29432943
    29442944    /**
     2945     * Changes the device level critical section from the automatically created
     2946     * default to one desired by the device constructor.
     2947     *
     2948     * @returns VBox status code.
     2949     * @param   pDevIns             The device instance.
     2950     * @param   pCritSect           The critical section to use.  NULL is not
     2951     *                              valid, instead use the NOP critical
     2952     *                              section.
     2953     */
     2954    DECLR3CALLBACKMEMBER(int, pfnSetDeviceCritSect,(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect));
     2955
     2956    /**
    29452957     * Creates a PDM thread.
    29462958     *
     
    34223434
    34233435/** Current PDMDEVHLPR3 version number. */
    3424 #define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE(0xffe7, 5, 0)
     3436#define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE(0xffe7, 7, 0)
    34253437
    34263438
     
    38303842    /** Pointer to device instance data. */
    38313843    RTRCPTR                     pvInstanceDataRC;
    3832     /** The critical section for the device, see pCritSectR3.
    3833      * This is automatically resolved by PDM when pCritSectR3 is set by the
    3834      * constructor. */
    3835     RCPTRTYPE(PPDMCRITSECT)     pCritSectRC;
     3844    /** The critical section for the device, see pCritSectXR3. */
     3845    RCPTRTYPE(PPDMCRITSECT)     pCritSectRoRC;
    38363846    /** Alignment padding.  */
    38373847    RTRCPTR                     pAlignmentRC;
     
    38413851    /** Pointer to device instance data (R0). */
    38423852    RTR0PTR                     pvInstanceDataR0;
    3843     /** The critical section for the device, see pCritSectR3.
    3844     * This is automatically resolved by PDM when pCritSectR3 is set by the
    3845     * constructor. */
    3846     R0PTRTYPE(PPDMCRITSECT)     pCritSectR0;
     3853    /** The critical section for the device, see pCritSectXR3. */
     3854    R0PTRTYPE(PPDMCRITSECT)     pCritSectRoR0;
    38473855
    38483856    /** Pointer the HC PDM Device API. */
     
    38503858    /** Pointer to device instance data. */
    38513859    RTR3PTR                     pvInstanceDataR3;
    3852     /** The critical section for the device. (Optional)
    3853      *
    3854      * The device constructor initializes this if it has a critical section for
    3855      * the device and desires it to be taken automatically by MMIO, I/O port
    3856      * and timer callbacks to the device.  The advantages using this locking
    3857      * approach is both less code and avoiding the global IOM lock.
    3858      *
    3859      * @remarks Will not yet be taken by SSM.
    3860      */
    3861     R3PTRTYPE(PPDMCRITSECT)     pCritSectR3;
     3860    /** The critical section for the device.
     3861     *
     3862     * TM and IOM will enter this critical section before calling into the
     3863     * device code.  SSM will currently not, but this will be changed later on.
     3864     *
     3865     * The device gets a critical section automatically assigned to it before
     3866     * the constructor is called.  If the constructor wishes to use a different
     3867     * critical section, it calls PDMDevHlpSetDeviceCritSect() to change it
     3868     * very early on.
     3869     */
     3870    R3PTRTYPE(PPDMCRITSECT)     pCritSectRoR3;
    38623871
    38633872    /** Pointer to device registration structure.  */
     
    45624571
    45634572/**
     4573 * @copydoc PDMDEVHLPR3::pfnSetDeviceCritSect
     4574 */
     4575DECLINLINE(int) PDMDevHlpSetDeviceCritSect(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect)
     4576{
     4577    return pDevIns->pHlpR3->pfnSetDeviceCritSect(pDevIns, pCritSect);
     4578}
     4579
     4580/**
    45644581 * @copydoc PDMDEVHLPR3::pfnThreadCreate
    45654582 */
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