From 5d5463b60faa356841af4d83a377b67b6b565b5f Mon Sep 17 00:00:00 2001 From: Mahesh Kumar Date: Mon, 9 Jan 2023 16:03:49 +0530 Subject: [PATCH] platform:dce: notify dce after state ack The current code doesn't notify DCE IPC after DCE IPC is in ACK state Current Flow: CPU DCE 1: tegra_ivc_init --------- 2: DCE_ADMIN_CMD_IPC_CREATE tegra_ivc_init 3: --------- tegra_ivc_channel_reset dce:SIVC_STATE_SYNC cpu:ESTABLISHED 4: tegra_ivc_reset dce:SIVC_STATE_SYNC --------- cpu:SYNC 5: Notify() tegra_ivc_channel_notified dce:SIVC_STATE_ACK cpu:SYNC 6: tegra_ivc_notified --------- dce:SIVC_STATE_ACK cpu:ESTABLISHED After Step 6 DCE state is in ACK state and CPU state is in ESTABLISHED state. As there is no further cpu->dce notification in RM_NOTIFY channel, dce state stays in the "ACK" state and any attempt to send msg on RM_NOTIFY channel from dce->cpu fails. This patch notifies dce after step-6, So dce channel is also in the "ESTABLISHED" state. If steps 3-6 get executed in CPU before Step 5 in DCE gets a chance to execute (DCE is slow), the CPU IPC state will change to "established". Now when step 5 will execute in DCE, it'll see the CPU state as "established" so, It'll make the DCE state also "established". That's how it's working today. Bug 3861985 Signed-off-by: Mahesh Kumar Change-Id: Ieb13f525d3f81b30aaae848d8d5adb1106856b65 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2840065 Reviewed-by: svcacv Reviewed-by: Arun Swain GVS: Gerrit_Virtual_Submit --- drivers/platform/tegra/dce/dce-ipc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/platform/tegra/dce/dce-ipc.c b/drivers/platform/tegra/dce/dce-ipc.c index fe5bc3b8..2dee8344 100644 --- a/drivers/platform/tegra/dce/dce-ipc.c +++ b/drivers/platform/tegra/dce/dce-ipc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -424,20 +424,19 @@ out: */ bool dce_ipc_channel_is_ready(struct tegra_dce *d, u32 ch_type) { - bool ret; + bool is_est; struct dce_ipc_channel *ch = d->d_ipc.ch[ch_type]; dce_mutex_lock(&ch->lock); - ret = (tegra_ivc_notified(&ch->d_ivc) ? false : true); + is_est = (tegra_ivc_notified(&ch->d_ivc) ? false : true); - if (ret == false) - ch->signal.notify(d, &ch->signal.to_d); + ch->signal.notify(d, &ch->signal.to_d); dce_mutex_unlock(&ch->lock); - return ret; + return is_est; } /**