From 04e87d8bc75694f821c356e811a631fd9807bfcd Mon Sep 17 00:00:00 2001 From: Veerabhadrarao Badiganti Date: Mon, 20 Sep 2021 18:57:50 +0530 Subject: [PATCH] msm: mhi_dev: Process the PM_RST_DEAST event in the caller context With the commit <37ea867103f2>("msm: ep-pcie: Use threaded irq for PERST de-assertion handling"), PCIe driver notifies the PM_RST_DEAST event in threadedIRQ context. Process this event in the same context so that we can finish link initialization and training as quickly as possible. Change-Id: If920fd9b653d6ae82cea599effb2d912a9b08174 Signed-off-by: Veerabhadrarao Badiganti --- drivers/platform/msm/mhi_dev/mhi_sm.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/platform/msm/mhi_dev/mhi_sm.c b/drivers/platform/msm/mhi_dev/mhi_sm.c index 15b518645b65..7802f6069767 100644 --- a/drivers/platform/msm/mhi_dev/mhi_sm.c +++ b/drivers/platform/msm/mhi_dev/mhi_sm.c @@ -1407,7 +1407,18 @@ void mhi_dev_sm_pcie_handler(struct ep_pcie_notify *notify) mhi_sm_ctx->stats.rst_deast_event_cnt++; MHI_SM_DBG("Hold wake for perst deassert event\n"); pm_stay_awake(mhi->dev); - break; + + atomic_inc(&mhi_sm_ctx->pending_pcie_events); + dstate_change_evt->event = event; + INIT_WORK(&dstate_change_evt->work, mhi_sm_pcie_event_manager); + /* + * Link init has to be completed as quicly as possible. + * Since this gets inovked from threaded IRQ context, do + * all processing in the same context, so that we don't run + * into any scheduling letencies. + */ + mhi_sm_pcie_event_manager(&dstate_change_evt->work); + goto exit; case EP_PCIE_EVENT_PM_D0: mhi_sm_ctx->stats.d0_event_cnt++;