This commit is contained in:
Andy Ritger
2022-11-10 08:39:33 -08:00
parent 7c345b838b
commit 758b4ee818
1323 changed files with 262135 additions and 60754 deletions

View File

@@ -28,6 +28,12 @@
#include "rmflcncmdif_nvswitch.h"
#include "common_nvswitch.h"
//
// Yield the CPU temporarily after openWrite() in _flcnQueueCmdWrite_IMPL()
// fails this many times in a row.
//
#define FLCN_QUEUE_CMD_WRITE_SLEEP_TRIES 1024
/*!
* @file flcnqueue_nvswitch.c
* @brief Provides all the fundamental logic for reading/writing queues.
@@ -437,6 +443,7 @@ _flcnQueueCmdWrite_IMPL
PFLCNQUEUE pQueue;
PFALCON_QUEUE_INFO pQueueInfo = pFlcn->pQueueInfo;
NvBool bKeepPolling;
NvU32 nTries = 0;
NVSWITCH_ASSERT(pTimeout != NULL);
NVSWITCH_ASSERT(pQueueInfo != NULL);
@@ -464,6 +471,17 @@ _flcnQueueCmdWrite_IMPL
__FUNCTION__, pQueue->queueLogId);
return NV_ERR_FLCN_ERROR;
}
if (++nTries < 4)
{
NVSWITCH_PRINT(device, INFO,
"%s: queue is too full to write data (write-size=0x%x).\n",
__FUNCTION__, pCmd->cmdGen.hdr.size);
}
else if ((nTries % FLCN_QUEUE_CMD_WRITE_SLEEP_TRIES) == 0)
{
nvswitch_os_sleep(1);
}
}
else
{
@@ -474,29 +492,27 @@ _flcnQueueCmdWrite_IMPL
if (status == NV_ERR_INSUFFICIENT_RESOURCES)
{
#if defined(DEBUG)
RM_FLCN_CMD FlcnCmd;
NV_STATUS dumpStatus;
dumpStatus = flcnRtosDumpCmdQueue_nvswitch(device, pFlcn, queueLogId, &FlcnCmd);
if (dumpStatus != NV_OK)
{
NVSWITCH_PRINT(device, ERROR,
"%s: Dumping Falcon Command queue completed with status 0x%x \n",
__FUNCTION__ , dumpStatus);
}
#endif // DEBUG
NVSWITCH_PRINT(device, ERROR,
"%s: Timeout while waiting for space (queueLogId=0x%x).\n",
__FUNCTION__, pQueue->queueLogId);
"%s: Timeout after %d tries while waiting for space (queueLogId=0x%x).\n"
"Command queue:\n",
__FUNCTION__, nTries, pQueue->queueLogId);
return NV_ERR_TIMEOUT;
}
//
// if failed to write Command due to no space,
// dump the queue contents if debug flag is on
//
#if defined(DEBUG)
if (status == NV_ERR_INSUFFICIENT_RESOURCES)
{
RM_FLCN_CMD FlcnCmd;
NV_STATUS dumpstatus;
dumpstatus = flcnRtosDumpCmdQueue_nvswitch(device, pFlcn, queueLogId, &FlcnCmd);
NVSWITCH_PRINT(device, ERROR,
"%s: Dumping Falcon Command queue completed with status =0x%x \n",
__FUNCTION__ , dumpstatus );
}
#endif
if (status != NV_OK)
{
NVSWITCH_PRINT(device, WARN,
@@ -516,7 +532,7 @@ _flcnQueueCmdWrite_IMPL
status = pQueue->close(device, pFlcn, pQueue, NV_TRUE);
if (status == NV_OK)
{
NVSWITCH_PRINT(device, INFO,
NVSWITCH_PRINT(device, MMIO,
"%s: command queued (unit-id=0x%x).\n",
__FUNCTION__, pCmd->cmdGen.hdr.unitId);
}
@@ -1563,7 +1579,7 @@ _flcnQueueCmdValidate
* @return NV_ERR_TIMEOUT
* A timeout occurred before the command completed.
*/
NV_STATUS
static NV_STATUS
_flcnQueueCmdWait_IMPL
(
nvswitch_device *device,
@@ -1628,4 +1644,3 @@ flcnQueueSetupHal
pHal->queueCmdPostNonBlocking = _flcnQueueCmdPostNonBlocking_IMPL;
pHal->queueCmdWait = _flcnQueueCmdWait_IMPL;
}