struct nvkm_falcon_msgq *msgq;
struct nvkm_msgqueue *queue;
+ struct completion wpr_ready;
+
struct {
u32 base;
u32 size;
struct nvkm_msgqueue_queue *queue;
int ret;
- if (wait_init && !wait_for_completion_timeout(&priv->init_done,
- msecs_to_jiffies(1000)))
- return -ETIMEDOUT;
-
queue = priv->func->cmd_queue(priv, prio);
if (IS_ERR(queue))
return PTR_ERR(queue);
+ if (!wait_for_completion_timeout(&queue->ready,
+ msecs_to_jiffies(1000))) {
+ FLCNQ_ERR(queue, "timeout waiting for queue ready");
+ return -ETIMEDOUT;
+ }
+
seq = nvkm_falcon_qmgr_seq_acquire(queue->qmgr);
if (IS_ERR(seq))
return PTR_ERR(seq);
void
nvkm_falcon_cmdq_fini(struct nvkm_falcon_cmdq *cmdq)
{
+ reinit_completion(&cmdq->ready);
}
void
cmdq->tail_reg = func->cmdq.tail + index * func->cmdq.stride;
cmdq->offset = offset;
cmdq->size = size;
+ complete_all(&cmdq->ready);
FLCNQ_DBG(cmdq, "initialised @ index %d offset 0x%08x size 0x%08x",
index, cmdq->offset, cmdq->size);
cmdq->qmgr = qmgr;
cmdq->name = name;
mutex_init(&cmdq->mutex);
+ init_completion(&cmdq->ready);
return 0;
}
return 0;
queue->init_msg_received = false;
- reinit_completion(&queue->init_done);
-
return 0;
}
{
queue->func = func;
queue->falcon = falcon;
-
- init_completion(&queue->init_done);
-
-
}
u32 head_reg;
u32 tail_reg;
+
+ struct completion ready;
};
/**
* @falcon: falcon to be managed
* @func: implementation of the firmware to use
* @init_msg_received: whether the init message has already been received
- * @init_done: whether all init is complete and commands can be processed
*/
struct nvkm_msgqueue {
struct nvkm_falcon *falcon;
const struct nvkm_msgqueue_func *func;
u32 fw_version;
bool init_msg_received;
- struct completion init_done;
};
void nvkm_msgqueue_ctor(const struct nvkm_msgqueue_func *, struct nvkm_falcon *,
}
nvkm_debug(subdev, "ACR WPR init complete\n");
- complete_all(&queue->init_done);
+ complete_all(&subdev->device->pmu->wpr_ready);
return 0;
}
static int
acr_boot_falcon(struct nvkm_msgqueue *priv, enum nvkm_secboot_falcon falcon)
{
+ struct nvkm_pmu *pmu = priv->falcon->owner->device->pmu;
DECLARE_COMPLETION_ONSTACK(completed);
/*
* flags - Flag specifying RESET or no RESET.
u32 falcon_id;
} cmd;
+ if (!wait_for_completion_timeout(&pmu->wpr_ready,
+ msecs_to_jiffies(1000))) {
+ nvkm_error(&pmu->subdev, "timeout waiting for WPR init\n");
+ return -ETIMEDOUT;
+ }
+
memset(&cmd, 0, sizeof(cmd));
cmd.hdr.unit_id = MSGQUEUE_0137C63D_UNIT_ACR;
static int
acr_boot_multiple_falcons(struct nvkm_msgqueue *priv, unsigned long falcon_mask)
{
+ struct nvkm_pmu *pmu = priv->falcon->owner->device->pmu;
DECLARE_COMPLETION_ONSTACK(completed);
/*
* flags - Flag specifying RESET or no RESET.
} cmd;
struct msgqueue_0137bca5 *queue = msgqueue_0137bca5(priv);
+ if (!wait_for_completion_timeout(&pmu->wpr_ready,
+ msecs_to_jiffies(1000))) {
+ nvkm_error(&pmu->subdev, "timeout waiting for WPR init\n");
+ return -ETIMEDOUT;
+ }
+
memset(&cmd, 0, sizeof(cmd));
cmd.hdr.unit_id = MSGQUEUE_0137C63D_UNIT_ACR;
}
}
- complete_all(&_queue->init_done);
-
return 0;
}
flush_work(&pmu->recv.work);
+ reinit_completion(&pmu->wpr_ready);
+
nvkm_falcon_cmdq_fini(pmu->lpq);
nvkm_falcon_cmdq_fini(pmu->hpq);
return 0;
(ret = nvkm_falcon_msgq_new(pmu->qmgr, "msgq", &pmu->msgq)))
return ret;
+ init_completion(&pmu->wpr_ready);
return 0;
}