VirtualBox

Changeset 75588 in vbox


Ignore:
Timestamp:
Nov 19, 2018 6:07:03 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
126756
Message:

VBoxGuest: Make use of new IRQ ACK port when present.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxGuestLib.h

    r75547 r75588  
    107107 * @return VBox status code.
    108108 */
    109 DECLR0VBGL(int)     VbglR0InitPrimary(RTIOPORT portVMMDev, struct VMMDevMemory *pVMMDevMemory);
     109DECLR0VBGL(int)     VbglR0InitPrimary(RTIOPORT portVMMDev, VMMDevMemory *pVMMDevMemory, uint32_t *pfFeatures);
    110110
    111111/**
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp

    r75547 r75588  
    986986    pDevExt->hGuestMappings = NIL_RTR0MEMOBJ;
    987987    pDevExt->EventSpinlock = NIL_RTSPINLOCK;
     988    pDevExt->fHostFeatures = 0;
    988989    pDevExt->pIrqAckEvents = NULL;
    989990    pDevExt->PhysIrqAckEvents = NIL_RTCCPHYS;
     
    11271128     */
    11281129    pDevExt->IOPortBase = IOPortBase;
    1129     rc = VbglR0InitPrimary(pDevExt->IOPortBase, (VMMDevMemory *)pDevExt->pVMMDevMemory);
     1130    rc = VbglR0InitPrimary(pDevExt->IOPortBase, (VMMDevMemory *)pDevExt->pVMMDevMemory, &pDevExt->fHostFeatures);
    11301131    if (RT_SUCCESS(rc))
    11311132    {
    1132         rc = VbglR0GRAlloc((VMMDevRequestHeader **)&pDevExt->pIrqAckEvents, sizeof(VMMDevEvents), VMMDevReq_AcknowledgeEvents);
     1133        VMMDevRequestHeader *pAckReq = NULL;
     1134        rc = VbglR0GRAlloc(&pAckReq, sizeof(VMMDevEvents), VMMDevReq_AcknowledgeEvents);
    11331135        if (RT_SUCCESS(rc))
    11341136        {
    1135             pDevExt->PhysIrqAckEvents = VbglR0PhysHeapGetPhysAddr(pDevExt->pIrqAckEvents);
     1137            pDevExt->PhysIrqAckEvents = VbglR0PhysHeapGetPhysAddr(pAckReq);
    11361138            Assert(pDevExt->PhysIrqAckEvents != 0);
     1139            ASMCompilerBarrier(); /* linux + solaris already have IRQs hooked up at this point, so take care. */
     1140            pDevExt->pIrqAckEvents = (VMMDevEvents *)pAckReq;
    11371141
    11381142            rc = vgdrvReportGuestInfo(enmOSType);
     
    12621266
    12631267    /*
     1268     * No more IRQs.
     1269     */
     1270    pDevExt->pIrqAckEvents = NULL; /* Will be freed by VbglR0TerminatePrimary. */
     1271    ASMAtomicWriteU32(&pDevExt->fHostFeatures, 0);
     1272
     1273    /*
    12641274     * Cleanup all the other resources.
    12651275     */
     
    12791289    pDevExt->pVMMDevMemory = NULL;
    12801290    pDevExt->IOPortBase = 0;
    1281     pDevExt->pIrqAckEvents = NULL; /* Freed by VbglR0TerminatePrimary. */
    12821291}
    12831292
     
    15831592 * Destroys the VBoxGuest device extension.
    15841593 *
    1585  * The native code should call this before the driver is loaded,
     1594 * The native code should call this before the driver is unloaded,
    15861595 * but don't call this on shutdown.
    15871596 *
     
    43624371bool VGDrvCommonISR(PVBOXGUESTDEVEXT pDevExt)
    43634372{
    4364     VMMDevEvents volatile  *pReq                  = pDevExt->pIrqAckEvents;
     4373    VMMDevEvents volatile  *pReq;
    43654374    bool                    fMousePositionChanged = false;
    43664375    int                     rc                    = 0;
     
    43714380     * Make sure we've initialized the device extension.
    43724381     */
    4373     if (RT_UNLIKELY(!pReq))
     4382    if (RT_LIKELY(pDevExt->fHostFeatures & VMMDEV_HVF_FAST_IRQ_ACK))
     4383        pReq = NULL;
     4384    else if (RT_LIKELY((pReq = pDevExt->pIrqAckEvents) != NULL))
     4385    { /* likely */ }
     4386    else
    43744387        return false;
    43754388
     
    43834396    {
    43844397        /*
    4385          * Acknowlegde events.
     4398         * Acknowledge events.
    43864399         * We don't use VbglR0GRPerform here as it may take another spinlocks.
    43874400         */
    4388         pReq->header.rc = VERR_INTERNAL_ERROR;
    4389         pReq->events    = 0;
    4390         ASMCompilerBarrier();
    4391         ASMOutU32(pDevExt->IOPortBase + VMMDEV_PORT_OFF_REQUEST, (uint32_t)pDevExt->PhysIrqAckEvents);
    4392         ASMCompilerBarrier();   /* paranoia */
    4393         if (RT_SUCCESS(pReq->header.rc))
    4394         {
    4395             uint32_t        fEvents = pReq->events;
    4396 
     4401        uint32_t fEvents;
     4402        if (!pReq)
     4403        {
     4404            fEvents = ASMInU32(pDevExt->IOPortBase + VMMDEV_PORT_OFF_REQUEST_FAST);
     4405            ASMCompilerBarrier();   /* paranoia */
     4406            rc = fEvents != UINT32_MAX ? VINF_SUCCESS : VERR_INTERNAL_ERROR;
     4407        }
     4408        else
     4409        {
     4410            pReq->header.rc = VERR_INTERNAL_ERROR;
     4411            pReq->events    = 0;
     4412            ASMCompilerBarrier();
     4413            ASMOutU32(pDevExt->IOPortBase + VMMDEV_PORT_OFF_REQUEST, (uint32_t)pDevExt->PhysIrqAckEvents);
     4414            ASMCompilerBarrier();   /* paranoia */
     4415            fEvents = pReq->events;
     4416            rc = pReq->header.rc;
     4417        }
     4418        if (RT_SUCCESS(rc))
     4419        {
    43974420            Log3(("VGDrvCommonISR: acknowledge events succeeded %#RX32\n", fEvents));
    43984421
     
    44424465        }
    44434466        else /* something is serious wrong... */
    4444             Log(("VGDrvCommonISR: acknowledge events failed rc=%Rrc (events=%#x)!!\n",
    4445                  pReq->header.rc, pReq->events));
     4467            Log(("VGDrvCommonISR: acknowledge events failed rc=%Rrc (events=%#x)!!\n", rc, fEvents));
    44464468    }
    44474469    else
     
    44794501    }
    44804502
    4481     Assert(rc == 0);
    4482     NOREF(rc);
     4503    AssertMsg(rc == 0, ("rc=%#x (%d)\n", rc, rc));
    44834504    return fOurIrq;
    44844505}
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h

    r70873 r75588  
    151151     * semaphores as well as the event acking in the ISR. */
    152152    RTSPINLOCK                  EventSpinlock;
     153    /** Host feature flags (VMMDEV_HVF_XXX).   */
     154    uint32_t                    fHostFeatures;
    153155    /** Preallocated VMMDevEvents for the IRQ handler. */
    154156    VMMDevEvents               *pIrqAckEvents;
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibInit.cpp

    r72627 r75588  
    184184#ifdef VBGL_VBOXGUEST
    185185
    186 DECLVBGL(int) VbglR0InitPrimary(RTIOPORT portVMMDev, VMMDevMemory *pVMMDevMemory)
     186DECLR0VBGL(int) VbglR0InitPrimary(RTIOPORT portVMMDev, VMMDevMemory *pVMMDevMemory, uint32_t *pfFeatures)
    187187{
    188188    int rc;
     
    209209
    210210        vbglR0QueryHostVersion();
     211        *pfFeatures = g_vbgldata.hostVersion.features;
    211212        return VINF_SUCCESS;
    212213    }
     
    216217}
    217218
    218 DECLVBGL(void) VbglR0TerminatePrimary(void)
     219DECLR0VBGL(void) VbglR0TerminatePrimary(void)
    219220{
    220221    vbglR0TerminateCommon();
     
    224225#else /* !VBGL_VBOXGUEST */
    225226
    226 DECLVBGL(int) VbglR0InitClient(void)
     227DECLR0VBGL(int) VbglR0InitClient(void)
    227228{
    228229    int rc;
     
    269270}
    270271
    271 DECLVBGL(void) VbglR0TerminateClient(void)
     272DECLR0VBGL(void) VbglR0TerminateClient(void)
    272273{
    273274# ifdef VBOX_WITH_HGCM
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