From a251e5e45e93e9ac453ab7d642c1ebfffc461ffd Mon Sep 17 00:00:00 2001 From: Jay Jayanna Date: Wed, 19 Aug 2020 20:03:39 -0700 Subject: [PATCH] mailbox: msm_qmp: Assert on timeout Dropped messages to AOP are generally fatal. The general rule of thumb is to let clients decide whether the dropped message is fatal. There have been some cases where there are messages sent to AOP as part of the device shutdown, effectively overwriting the error state. Add an assert to when QMP detects timeout so the error state on AOP is preserved. Change-Id: I5eaf42a76b1298246351ec9d66fe32e7308233bd Signed-off-by: Jay Jayanna --- drivers/mailbox/msm_qmp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/mailbox/msm_qmp.c b/drivers/mailbox/msm_qmp.c index 30252024fd31..6172ce6aeae2 100644 --- a/drivers/mailbox/msm_qmp.c +++ b/drivers/mailbox/msm_qmp.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. */ #include @@ -42,6 +42,12 @@ do { \ ipc_log_string(ctxt, "%s[%s]: "x, "", __func__, ##__VA_ARGS__); \ } while (0) +#ifdef CONFIG_QMP_DEBUGFS_CLIENT +#define QMP_BUG(x) BUG_ON(x) +#else +#define QMP_BUG(x) do {} while (0) +#endif + /** * enum qmp_local_state - definition of the local state machine * @LINK_DISCONNECTED: Init state, waiting for ucore to start @@ -264,6 +270,7 @@ static void qmp_notify_timeout(struct work_struct *work) return; } QMP_ERR(mbox->mdev->ilc, "tx timeout for %d\n", mbox->idx_in_flight); + QMP_BUG(mbox->tx_sent); iowrite32(0, mbox->desc + mbox->mcore_mbox_offset); mbox->tx_sent = false; spin_unlock_irqrestore(&mbox->tx_lock, flags);