Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2170552pxu; Fri, 9 Oct 2020 09:34:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLzRp5BxVvlEMtSy589HfGQoe4w1z6FLrk8hfKvVehLeqK2inHua963k6JG69/BxuW+28j X-Received: by 2002:a17:907:1042:: with SMTP id oy2mr14594250ejb.64.1602261292672; Fri, 09 Oct 2020 09:34:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602261292; cv=none; d=google.com; s=arc-20160816; b=Cq9XzgK++e3w7olIIp6UFSIBRyooEkuZZLWFs/2bVZAhojCHdqwYhZqYwS7xlgDvwV 9w4UqOxcDIvBA5eHbWCrcdwB0VB/VFjffxfmWQjG044nhaWgy8IA0950gQzNgxRBvf3w 3BtULg+OB/b4GKD8KRKBPavMtZlPwT8qD4nSbXvVnzLwOgFeB8aeJluTnfOMarvd0F5R rH+/eFKrAp8WBm3aRy49u3DYQz6fwRNLoTruoKrdJpPfVIBt58PBi7pFXAlx5D6so+46 rFAPZ8aLlZrbHsJuWI/TQ9sWPzUzMv6QO3u7gxdLEXVavcCxbNNeOlIYDCVb2Fw3IWSR qDEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=mOTcy3+NA6WMt5XJNmj5tg+j6bcKEmODuGu9umfiTHs=; b=x4z50O3nx0wOTu4LwTsKpxgC510aRXlaV8Ht12YS3CWSwgaDhDlHPwxhAFVHiCwHs0 kTUmlt+NOSJ4O/IzZT2ljwjrn552LsZPoHlGkRqTaeqWdWc3pXlLFXR/yOchMGEZ+gMS xFj/Yh0MoEkh8sgrlAIw97KgM2m8lfJvVX5LrlApXYwlOVTB7KIWluVfPLua9aFMVlx9 BXrKR6T6LjwLpQfdDNHcEtOFSmAbl0M95/JouV2QhppvfaF6S1IV01RgogGS/PPjyh/m 8KahLlkOaSBsUPyEHkXFIq2mr5olNn/BI+Oon7F/RvZ3ASygpE7aDpBpzysYwZXaBsMY sgxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ksVkMwzv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c9si6777389edl.424.2020.10.09.09.34.28; Fri, 09 Oct 2020 09:34:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ksVkMwzv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389803AbgJIQcl (ORCPT + 99 others); Fri, 9 Oct 2020 12:32:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388719AbgJIQcl (ORCPT ); Fri, 9 Oct 2020 12:32:41 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF227C0613D5 for ; Fri, 9 Oct 2020 09:32:39 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id w21so1941180plq.3 for ; Fri, 09 Oct 2020 09:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mOTcy3+NA6WMt5XJNmj5tg+j6bcKEmODuGu9umfiTHs=; b=ksVkMwzvlP+IFARBE9t7y6xsrsrnd5cktvydnD1bDp7vEbHpw8tYNjp43xSW1/lKTL XFjQL7aZI6owEpa0TIyR9peHB5RguhWECJfs7dN51FBRPL+8+dBPdeGtKjHDRkiu0mc3 3/yl7TP3rbuxokoz3gFdLUVYhihnFht7utQGUSes1xRJCDcOI1ErMvwiuKY6QJdGivzT ZGQHGyB7hFzNm4zsrH0MAgnZpJi+xbllfBQG0rdnDrr2w7cosamVfT7Jxc60QWt9RJdH rBukeat6C2BWcfNyQ0C1f8eJBUU3OCEzuS0GJyiA3M2D8oejOMP7VowuYRdkRjBjp5Wk EtSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mOTcy3+NA6WMt5XJNmj5tg+j6bcKEmODuGu9umfiTHs=; b=SpyIQE80S9W+xkOswUPeHaulA5CckV2J7imsb2jRfwh1U85qoEmhY6lg905c3lDVKk WufNpG6C08wDpP7ktvntZLuEP4/JNDEkBvfNSoeNV4NbAUfxC30QB2ANYdYcNPaHQdbX z3Br4i/tsINs4Vi1w2foFlpLGVe5ipBIrDlRhRENr9S+8lUq5+Vonf6Eoiknz2IJvI/K n0+YrU8hEwSBL7dLXBdOYPZY9O6HLmKWEJW80IrhAbiR4wd1WkbVY4nHvXF1AeBuw03O Ka0+g8obpvYB2tkZfTjpjoSJvK83F9cejt9c4P1qPkOJ5sHkBT0gBFt3jKlisMtU5nbf YsEw== X-Gm-Message-State: AOAM532kr2iUzbB4pGKz8evbtk0yPLlMX/ppe/cW+MoQpr6d+lTiXGWM Rx5rpKQUfor/pi18ecReNGGx2GT6C8ov X-Received: by 2002:a17:902:a40e:b029:d3:c6fa:2650 with SMTP id p14-20020a170902a40eb02900d3c6fa2650mr12617454plq.29.1602261159147; Fri, 09 Oct 2020 09:32:39 -0700 (PDT) Received: from Mani-XPS-13-9360 ([2409:4072:6292:5a21:d5ff:f3e8:fcf2:ccc7]) by smtp.gmail.com with ESMTPSA id q8sm6231603pfg.118.2020.10.09.09.32.34 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Oct 2020 09:32:38 -0700 (PDT) Date: Fri, 9 Oct 2020 22:02:31 +0530 From: Manivannan Sadhasivam To: Bhaumik Bhatt Cc: linux-arm-msm@vger.kernel.org, hemantk@codeaurora.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 07/10] bus: mhi: core: Move to SYS_ERROR regardless of RDDM capability Message-ID: <20201009163231.GH4810@Mani-XPS-13-9360> References: <1600480955-16827-1-git-send-email-bbhatt@codeaurora.org> <1600480955-16827-8-git-send-email-bbhatt@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1600480955-16827-8-git-send-email-bbhatt@codeaurora.org> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 18, 2020 at 07:02:32PM -0700, Bhaumik Bhatt wrote: > In some cases, the entry of device to RDDM execution environment > can occur after a significant amount of time has elapsed after the > SYS_ERROR state change event has arrived. This can result in scenarios > where users of the MHI bus are unaware of the error state of the Who are all the users of MHI bus? Client drivers? > device. Hence, moving the MHI bus to a SYS_ERROR detected state will > prevent further client activity and wait for the RDDM entry. > > Signed-off-by: Bhaumik Bhatt > --- > drivers/bus/mhi/core/main.c | 24 ++++++++++++++++-------- > 1 file changed, 16 insertions(+), 8 deletions(-) > > diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c > index 2cff5dd..1c8e332 100644 > --- a/drivers/bus/mhi/core/main.c > +++ b/drivers/bus/mhi/core/main.c > @@ -376,6 +376,7 @@ irqreturn_t mhi_intvec_threaded_handler(int irq_number, void *priv) > enum mhi_state state = MHI_STATE_MAX; > enum mhi_pm_state pm_state = 0; > enum mhi_ee_type ee = 0; > + bool handle_rddm = false; > > write_lock_irq(&mhi_cntrl->pm_lock); > if (!MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state)) { > @@ -400,6 +401,17 @@ irqreturn_t mhi_intvec_threaded_handler(int irq_number, void *priv) > /* If device supports RDDM don't bother processing SYS error */ > if (mhi_cntrl->rddm_image) { > if (mhi_cntrl->ee == MHI_EE_RDDM && mhi_cntrl->ee != ee) { > + /* prevent clients from queueing any more packets */ > + write_lock_irq(&mhi_cntrl->pm_lock); > + pm_state = mhi_tryset_pm_state(mhi_cntrl, > + MHI_PM_SYS_ERR_DETECT); The condition above already moves MHI to MHI_PM_SYS_ERR_DETECT if the state is MHI_STATE_SYS_ERR. Why are you doing it here again? Thanks, Mani > + if (pm_state == MHI_PM_SYS_ERR_DETECT) > + handle_rddm = true; > + write_unlock_irq(&mhi_cntrl->pm_lock); > + } > + > + if (handle_rddm) { > + dev_err(dev, "RDDM event occurred!\n"); > mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_EE_RDDM); > wake_up_all(&mhi_cntrl->state_event); > } > @@ -733,19 +745,15 @@ int mhi_process_ctrl_ev_ring(struct mhi_controller *mhi_cntrl, > break; > case MHI_STATE_SYS_ERR: > { > - enum mhi_pm_state new_state; > - > - /* skip SYS_ERROR handling if RDDM supported */ > - if (mhi_cntrl->ee == MHI_EE_RDDM || > - mhi_cntrl->rddm_image) > - break; > + enum mhi_pm_state state = MHI_PM_STATE_MAX; > > dev_dbg(dev, "System error detected\n"); > write_lock_irq(&mhi_cntrl->pm_lock); > - new_state = mhi_tryset_pm_state(mhi_cntrl, > + if (mhi_cntrl->ee != MHI_EE_RDDM) > + state = mhi_tryset_pm_state(mhi_cntrl, > MHI_PM_SYS_ERR_DETECT); > write_unlock_irq(&mhi_cntrl->pm_lock); > - if (new_state == MHI_PM_SYS_ERR_DETECT) > + if (state == MHI_PM_SYS_ERR_DETECT) > mhi_pm_sys_err_handler(mhi_cntrl); > break; > } > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project >