mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-24 02:01:36 +03:00
nvadsp: false trigger for adsp boot
Change add spinlock protection for message enqueue to avoid possible race condition between enqueue and dequeue of ADSP OS message. Bug 2031075 Change-Id: Iad243fdf034db89a61e32411a8b03c817c19d81e Signed-off-by: Dipesh Gandhi <dipeshg@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1613124 (cherry picked from commit 3d146a3ba4dbe4c1375d64d425ff0b9be7f7c272) Reviewed-on: https://git-master.nvidia.com/r/1669402 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Tested-by: Ajay Nandakumar M <anandakumarm@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Laxman Dewangan
parent
c8f7a26db7
commit
c844c3a973
@@ -56,19 +56,21 @@ static void mboxq_destroy(struct nvadsp_mbox_queue *queue)
|
||||
static status_t mboxq_enqueue(struct nvadsp_mbox_queue *queue,
|
||||
uint32_t data)
|
||||
{
|
||||
unsigned long flags;
|
||||
int ret = 0;
|
||||
|
||||
if (is_mboxq_full(queue)) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&queue->lock, flags);
|
||||
if (is_mboxq_empty(queue))
|
||||
complete_all(&queue->comp);
|
||||
|
||||
queue->array[queue->tail] = data;
|
||||
queue->tail = (queue->tail + 1) & NVADSP_MBOX_QUEUE_SIZE_MASK;
|
||||
queue->count++;
|
||||
spin_unlock_irqrestore(&queue->lock, flags);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user