VirtualBox

Changeset 108867 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Apr 7, 2025 10:32:44 AM (5 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
168317
Message:

VMM/GIC: bugref:10877 GIC ITS command-queue, work-in-progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/GITSAll.cpp

    r108865 r108867  
    5151#define GITS_IS_REG_IN_RANGE(a_offReg, a_offFirst, a_cbRegion)    ((uint32_t)(a_offReg) - (a_offFirst) < (a_cbRegion))
    5252
     53/** Acquire the device critical section. */
     54#define GITS_CRIT_SECT_ENTER(a_pDevIns) \
     55    do \
     56    { \
     57        int const rcLock = PDMDevHlpCritSectEnter(pDevIns, pDevIns->pCritSectRoR3, VINF_SUCCESS); \
     58        PDM_CRITSECT_RELEASE_ASSERT_RC_DEV(pDevIns, pDevIns->pCritSectRoR3, rcLock); \
     59    } while(0)
     60
     61/** Release the device critical section. */
     62#define GITS_CRIT_SECT_LEAVE(a_pDevIns)         PDMDevHlpCritSectLeave((a_pDevIns), (a_pDevIns)->CTX_SUFF(pCritSectRo))
     63
     64/** Returns whether the critical section is held. */
     65#define GITS_CRIT_SECT_IS_OWNER(a_pDevIns)      PDMDevHlpCritSectIsOwner((a_pDevIns), (a_pDevIns)->CTX_SUFF(pCritSectRo))
     66
    5367
    5468/*********************************************************************************************************************************
     
    162176static void gitsCmdQueueThreadWakeUpIfNeeded(PPDMDEVINS pDevIns, PGITSDEV pGitsDev)
    163177{
    164     Assert(PDMDevHlpCritSectIsOwner(pDevIns, pDevIns->CTX_SUFF(pCritSectRo)));
     178    Assert(GITS_CRIT_SECT_IS_OWNER(pDevIns));
    165179    if (    gitsCmdQueueCanProcessRequests(pGitsDev)
    166180        && !gitsCmdQueueIsEmpty(pGitsDev))
     
    454468{
    455469    /* Hold the critical section as we could be accessing the device state simultaneously with MMIO accesses. */
    456     int const rcLock = PDMDevHlpCritSectEnter(pDevIns, pDevIns->pCritSectRoR3, VINF_SUCCESS);
    457     PDM_CRITSECT_RELEASE_ASSERT_RC_DEV(pDevIns, pDevIns->pCritSectRoR3, rcLock);
     470    GITS_CRIT_SECT_ENTER(pDevIns);
    458471
    459472    if (gitsCmdQueueCanProcessRequests(pGitsDev))
     
    474487
    475488            /* Temporarily leave the critical section while reading (a potentially large number of) commands from guest memory. */
    476             PDMDevHlpCritSectLeave(pDevIns, pDevIns->pCritSectRoR3);
     489            GITS_CRIT_SECT_LEAVE(pDevIns);
    477490
    478491            int      rc;
     
    500513
    501514            /* Re-acquire the critical section as we now need to modify device state. */
    502             int const rcLock2 = PDMDevHlpCritSectEnter(pDevIns, pDevIns->pCritSectRoR3, VINF_SUCCESS);
    503             PDM_CRITSECT_RELEASE_ASSERT_RC_DEV(pDevIns, pDevIns->pCritSectRoR3, rcLock2);
     515            GITS_CRIT_SECT_ENTER(pDevIns);
    504516
    505517            /*
     
    515527                }
    516528
    517                 PDMDevHlpCritSectLeave(pDevIns, pDevIns->pCritSectRoR3);
     529                GITS_CRIT_SECT_LEAVE(pDevIns);
    518530                return VINF_SUCCESS;
    519531            }
     
    525537    }
    526538
    527     PDMDevHlpCritSectLeave(pDevIns, pDevIns->pCritSectRoR3);
     539    GITS_CRIT_SECT_LEAVE(pDevIns);
    528540    return VINF_SUCCESS;
    529541}
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