app-emulation/virtualbox: Upstream patch to fix some SAS timeouts.

Package-Manager: portage-2.3.3
This commit is contained in:
Lars Wendler
2016-12-09 23:28:41 +01:00
parent d4ca3e414f
commit 2b91777aca
2 changed files with 95 additions and 0 deletions

View File

@@ -0,0 +1,94 @@
Index: vbox/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
===================================================================
--- vbox/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp (revision 64807)
+++ vbox/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp (revision 64808)
@@ -286,6 +286,12 @@
PDMCRITSECT ReplyPostQueueCritSect;
/** Critical section protecting the reply free queue. */
PDMCRITSECT ReplyFreeQueueCritSect;
+ /** Critical section protecting the request queue against
+ * concurrent access from the guest. */
+ PDMCRITSECT RequestQueueCritSect;
+ /** Critical section protecting the reply free queue against
+ * concurrent write access from the guest. */
+ PDMCRITSECT ReplyFreeQueueWriteCritSect;
/** Pointer to the start of the reply free queue - R3. */
R3PTRTYPE(volatile uint32_t *) pReplyFreeQueueBaseR3;
@@ -1275,14 +1281,22 @@
{
case LSILOGIC_REG_REPLY_QUEUE:
{
+ int rc = PDMCritSectEnter(&pThis->ReplyFreeQueueWriteCritSect, VINF_IOM_R3_MMIO_WRITE);
+ if (rc != VINF_SUCCESS)
+ return rc;
/* Add the entry to the reply free queue. */
ASMAtomicWriteU32(&pThis->CTX_SUFF(pReplyFreeQueueBase)[pThis->uReplyFreeQueueNextEntryFreeWrite], u32);
pThis->uReplyFreeQueueNextEntryFreeWrite++;
pThis->uReplyFreeQueueNextEntryFreeWrite %= pThis->cReplyQueueEntries;
+ PDMCritSectLeave(&pThis->ReplyFreeQueueWriteCritSect);
break;
}
case LSILOGIC_REG_REQUEST_QUEUE:
{
+ int rc = PDMCritSectEnter(&pThis->RequestQueueCritSect, VINF_IOM_R3_MMIO_WRITE);
+ if (rc != VINF_SUCCESS)
+ return rc;
+
uint32_t uNextWrite = ASMAtomicReadU32(&pThis->uRequestQueueNextEntryFreeWrite);
ASMAtomicWriteU32(&pThis->CTX_SUFF(pRequestQueueBase)[uNextWrite], u32);
@@ -1296,6 +1310,7 @@
uNextWrite++;
uNextWrite %= pThis->cRequestQueueEntries;
ASMAtomicWriteU32(&pThis->uRequestQueueNextEntryFreeWrite, uNextWrite);
+ PDMCritSectLeave(&pThis->RequestQueueCritSect);
/* Send notification to R3 if there is not one sent already. Do this
* only if the worker thread is not sleeping or might go sleeping. */
@@ -1309,7 +1324,7 @@
PDMQueueInsert(pThis->CTX_SUFF(pNotificationQueue), pNotificationItem);
#else
LogFlowFunc(("Signal event semaphore\n"));
- int rc = SUPSemEventSignal(pThis->pSupDrvSession, pThis->hEvtProcess);
+ rc = SUPSemEventSignal(pThis->pSupDrvSession, pThis->hEvtProcess);
AssertRC(rc);
#endif
}
@@ -5304,6 +5319,8 @@
PDMR3CritSectDelete(&pThis->ReplyFreeQueueCritSect);
PDMR3CritSectDelete(&pThis->ReplyPostQueueCritSect);
+ PDMR3CritSectDelete(&pThis->RequestQueueCritSect);
+ PDMR3CritSectDelete(&pThis->ReplyFreeQueueWriteCritSect);
RTMemFree(pThis->paDeviceStates);
pThis->paDeviceStates = NULL;
@@ -5470,6 +5487,14 @@
if (RT_FAILURE(rc))
return PDMDEV_SET_ERROR(pDevIns, rc, N_("LsiLogic: cannot create critical section for reply post queue"));
+ rc = PDMDevHlpCritSectInit(pDevIns, &pThis->RequestQueueCritSect, RT_SRC_POS, "%sRQ", szDevTag);
+ if (RT_FAILURE(rc))
+ return PDMDEV_SET_ERROR(pDevIns, rc, N_("LsiLogic: cannot create critical section for request queue"));
+
+ rc = PDMDevHlpCritSectInit(pDevIns, &pThis->ReplyFreeQueueWriteCritSect, RT_SRC_POS, "%sRFQW", szDevTag);
+ if (RT_FAILURE(rc))
+ return PDMDEV_SET_ERROR(pDevIns, rc, N_("LsiLogic: cannot create critical section for reply free queue write access"));
+
/*
* Register the PCI device, it's I/O regions.
*/
Index: vbox/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
===================================================================
--- vbox/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp (revision 64807)
+++ vbox/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp (revision 64808)
@@ -1744,6 +1744,8 @@
GEN_CHECK_OFF(LSILOGICSCSI, cRequestQueueEntries);
GEN_CHECK_OFF(LSILOGICSCSI, ReplyPostQueueCritSect);
GEN_CHECK_OFF(LSILOGICSCSI, ReplyFreeQueueCritSect);
+ GEN_CHECK_OFF(LSILOGICSCSI, RequestQueueCritSect);
+ GEN_CHECK_OFF(LSILOGICSCSI, ReplyFreeQueueWriteCritSect);
GEN_CHECK_OFF(LSILOGICSCSI, pReplyFreeQueueBaseR3);
GEN_CHECK_OFF(LSILOGICSCSI, pReplyPostQueueBaseR3);
GEN_CHECK_OFF(LSILOGICSCSI, pRequestQueueBaseR3);

View File

@@ -183,6 +183,7 @@ src_prepare() {
fi
eapply "${WORKDIR}/patches"
eapply "${FILESDIR}/${P}-sas_timeouts.patch"
eapply_user
}