VirtualBox

Ignore:
Timestamp:
Apr 18, 2011 2:58:46 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
71233
Message:

PCI: experimental code for shared interrupts support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxPci/VBoxPci.c

    r36678 r36717  
    7474    return NULL;
    7575}
    76 
    77 DECLINLINE(int) vboxPciDevLock(PVBOXRAWPCIINS pThis)
    78 {
     76DECLINLINE(int) vboxPciDevLock(PVBOXRAWPCIINS pThis,
     77                               PRTSPINLOCKTMP pTmp)
     78{
     79#ifdef VBOX_WITH_SHARED_PCI_INTERRUPTS
     80    RTSpinlockAcquireNoInts(pThis->hSpinlock, pTmp);
     81    return VINF_SUCCESS;
     82#else   
    7983    int rc = RTSemFastMutexRequest(pThis->hFastMtx);
     84
     85    NOREF(pTmp);
    8086    AssertRC(rc);
    8187    return rc;
    82 }
    83 
    84 DECLINLINE(void) vboxPciDevUnlock(PVBOXRAWPCIINS pThis)
    85 {
     88#endif
     89}
     90
     91DECLINLINE(void) vboxPciDevUnlock(PVBOXRAWPCIINS pThis,
     92                                  PRTSPINLOCKTMP pTmp)
     93{
     94#ifdef VBOX_WITH_SHARED_PCI_INTERRUPTS
     95    RTSpinlockReleaseNoInts(pThis->hSpinlock, pTmp);
     96#else
     97    NOREF(pTmp);
    8698    RTSemFastMutexRelease(pThis->hFastMtx);
     99#endif
    87100}
    88101
     
    171184    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    172185    int rc;
    173 
    174     vboxPciDevLock(pThis);
     186    RTSPINLOCKTMP aTmp;
     187
     188    vboxPciDevLock(pThis, &aTmp);
    175189
    176190    rc = vboxPciOsDevInit(pThis, fFlags);
    177191
    178     vboxPciDevUnlock(pThis);
     192    vboxPciDevUnlock(pThis, &aTmp);
    179193
    180194    return rc;
     
    187201{
    188202    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    189     int rc;
    190 
    191     vboxPciDevLock(pThis);
     203    int            rc;
     204    RTSPINLOCKTMP  aTmp;
     205
     206    vboxPciDevLock(pThis, &aTmp);
    192207
    193208    if (pThis->IrqHandler.pfnIrqHandler)
     
    200215    rc = vboxPciOsDevDeinit(pThis, fFlags);
    201216
    202     vboxPciDevUnlock(pThis);
     217    vboxPciDevUnlock(pThis, &aTmp);
    203218
    204219    return rc;
     
    249264{
    250265    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    251     int rc;
    252 
    253     vboxPciDevLock(pThis);
     266    int            rc;
     267    RTSPINLOCKTMP  aTmp;
     268
     269    vboxPciDevLock(pThis, &aTmp);
    254270
    255271    rc = vboxPciOsDevGetRegionInfo(pThis, iRegion,
    256272                                   pRegionStart, pu64RegionSize,
    257273                                   pfPresent, pfFlags);
    258     vboxPciDevUnlock(pThis);
     274    vboxPciDevUnlock(pThis, &aTmp);
    259275
    260276    return rc;
     
    272288{
    273289    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    274     int rc;
    275 
    276     vboxPciDevLock(pThis);
     290    int            rc;
     291    RTSPINLOCKTMP  aTmp;
     292
     293    vboxPciDevLock(pThis, &aTmp);
    277294
    278295    rc = vboxPciOsDevMapRegion(pThis, iRegion, RegionStart, u64RegionSize, fFlags, pRegionBase);
    279296
    280     vboxPciDevUnlock(pThis);
     297    vboxPciDevUnlock(pThis, &aTmp);
    281298
    282299    return rc;
     
    293310{
    294311    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    295     int rc;
    296 
    297     vboxPciDevLock(pThis);
     312    int            rc;
     313    RTSPINLOCKTMP  aTmp;
     314
     315    vboxPciDevLock(pThis, &aTmp);
    298316
    299317    rc = vboxPciOsDevUnmapRegion(pThis, iRegion, RegionStart, u64RegionSize, RegionBase);
    300318
    301     vboxPciDevUnlock(pThis);
     319    vboxPciDevUnlock(pThis, &aTmp);
    302320
    303321    return rc;
     
    312330{
    313331    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    314 
    315     int rc;
    316 
    317     vboxPciDevLock(pThis);
     332    RTSPINLOCKTMP  aTmp;
     333    int            rc;
     334
     335    vboxPciDevLock(pThis, &aTmp);
    318336
    319337    rc = vboxPciOsDevPciCfgRead(pThis, Register, pValue);
    320338
    321     vboxPciDevUnlock(pThis);
     339    vboxPciDevUnlock(pThis, &aTmp);
    322340
    323341    return rc;
     
    332350{
    333351    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    334     int rc;
    335 
    336     vboxPciDevLock(pThis);
     352    int            rc;
     353    RTSPINLOCKTMP  aTmp;
     354
     355    vboxPciDevLock(pThis, &aTmp);
    337356
    338357    rc = vboxPciOsDevPciCfgWrite(pThis, Register, pValue);
    339358
    340     vboxPciDevUnlock(pThis);
     359    vboxPciDevUnlock(pThis, &aTmp);
    341360
    342361    return rc;
     
    349368{
    350369    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    351     int     rc;
    352     int32_t iHostIrq = 0;
     370    int            rc;
     371    int32_t        iHostIrq = 0;
     372    RTSPINLOCKTMP  aTmp;
    353373
    354374    if (pfnHandler == NULL)
    355375        return VERR_INVALID_PARAMETER;
    356376
    357     vboxPciDevLock(pThis);
     377    vboxPciDevLock(pThis, &aTmp);
    358378
    359379    if (pThis->IrqHandler.pfnIrqHandler)
     
    373393    }
    374394
    375     vboxPciDevUnlock(pThis);
     395    vboxPciDevUnlock(pThis, &aTmp);
    376396
    377397    return rc;
     
    382402{
    383403    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    384     int rc;
     404    int            rc;
     405    RTSPINLOCKTMP  aTmp;
    385406
    386407    if (hIsr != 0xcafe0000)
    387408        return VERR_INVALID_PARAMETER;
    388409
    389     vboxPciDevLock(pThis);
     410    vboxPciDevLock(pThis, &aTmp);
    390411
    391412    rc = vboxPciOsDevUnregisterIrqHandler(pThis, pThis->IrqHandler.iHostIrq);
     
    396417        pThis->IrqHandler.iHostIrq = 0;
    397418    }
    398     vboxPciDevUnlock(pThis);
     419    vboxPciDevUnlock(pThis, &aTmp);
    399420
    400421    return rc;
     
    406427{
    407428    PVBOXRAWPCIINS pThis = DEVPORT_2_VBOXRAWPCIINS(pPort);
    408     int rc;
    409 
    410     vboxPciDevLock(pThis);
     429    int            rc;
     430    RTSPINLOCKTMP  aTmp;
     431
     432    vboxPciDevLock(pThis, &aTmp);
    411433
    412434    rc = vboxPciOsDevPowerStateChange(pThis, aState);
     
    426448
    427449
    428     vboxPciDevUnlock(pThis);
     450    vboxPciDevUnlock(pThis, &aTmp);
    429451
    430452    return rc;
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