Message ID | 1610651795-31287-2-git-send-email-bbhatt@codeaurora.org |
---|---|
State | Superseded |
Headers | show |
Series | Serialize execution environment changes for MHI | expand |
On 1/14/21 11:16 AM, Bhaumik Bhatt wrote: > When moving from SBL to mission mode execution environment, there > is no remove callback notification to MHI client drivers which > operate on SBL mode only. Client driver devices are being created > in SBL or AMSS(mission mode) and only destroyed after power down > or SYS_ERROR. If there exist any SBL-specific channels, those are > left open and client drivers are thus unaware of the new execution > environment where those channels cannot operate. Close the gap and > issue remove callbacks to SBL-specific client drivers once device > enters mission mode. > > Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by: Hemant Kumar <hemantk@codeaurora.org> -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
On Thu, Jan 14, 2021 at 11:16:33AM -0800, Bhaumik Bhatt wrote: > When moving from SBL to mission mode execution environment, there > is no remove callback notification to MHI client drivers which > operate on SBL mode only. Client driver devices are being created > in SBL or AMSS(mission mode) and only destroyed after power down > or SYS_ERROR. If there exist any SBL-specific channels, those are > left open and client drivers are thus unaware of the new execution > environment where those channels cannot operate. Close the gap and > issue remove callbacks to SBL-specific client drivers once device > enters mission mode. > What are the SBL specific channels and the client drivers operating on them? If this is something going to come in future, then this patch can come later. Thanks, Mani
Hi Mani, On 2021-01-20 11:50 PM, Manivannan Sadhasivam wrote: > On Thu, Jan 14, 2021 at 11:16:33AM -0800, Bhaumik Bhatt wrote: >> When moving from SBL to mission mode execution environment, there >> is no remove callback notification to MHI client drivers which >> operate on SBL mode only. Client driver devices are being created >> in SBL or AMSS(mission mode) and only destroyed after power down >> or SYS_ERROR. If there exist any SBL-specific channels, those are >> left open and client drivers are thus unaware of the new execution >> environment where those channels cannot operate. Close the gap and >> issue remove callbacks to SBL-specific client drivers once device >> enters mission mode. >> > > What are the SBL specific channels and the client drivers operating on > them? > If this is something going to come in future, then this patch can come > later. > > Thanks, > Mani Carl from Quectel (CC'd here) will need this patch as he works on EDL and Flash Programmer changes which also needs usage of QSAHARA server over SBL. Thanks, Bhaumik --- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index 8576b0f..1a7192e 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -244,8 +244,10 @@ static void mhi_del_ring_element(struct mhi_controller *mhi_cntrl, int mhi_destroy_device(struct device *dev, void *data) { + struct mhi_chan *ul_chan, *dl_chan; struct mhi_device *mhi_dev; struct mhi_controller *mhi_cntrl; + enum mhi_ee_type ee = MHI_EE_MAX; if (dev->bus != &mhi_bus_type) return 0; @@ -257,6 +259,12 @@ int mhi_destroy_device(struct device *dev, void *data) if (mhi_dev->dev_type == MHI_DEVICE_CONTROLLER) return 0; + ul_chan = mhi_dev->ul_chan; + dl_chan = mhi_dev->dl_chan; + + if (data) + ee = *(enum mhi_ee_type *)data; + /* * For the suspend and resume case, this function will get called * without mhi_unregister_controller(). Hence, we need to drop the @@ -264,11 +272,17 @@ int mhi_destroy_device(struct device *dev, void *data) * be sure that there will be no instances of mhi_dev left after * this. */ - if (mhi_dev->ul_chan) - put_device(&mhi_dev->ul_chan->mhi_dev->dev); + if (ul_chan) { + if (ee != MHI_EE_MAX && !(ul_chan->ee_mask & BIT(ee))) + return 0; + put_device(&ul_chan->mhi_dev->dev); + } - if (mhi_dev->dl_chan) - put_device(&mhi_dev->dl_chan->mhi_dev->dev); + if (dl_chan) { + if (ee != MHI_EE_MAX && !(dl_chan->ee_mask & BIT(ee))) + return 0; + put_device(&dl_chan->mhi_dev->dev); + } dev_dbg(&mhi_cntrl->mhi_dev->dev, "destroy device for chan:%s\n", mhi_dev->name); diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 681960c..8da8806 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -377,6 +377,7 @@ static int mhi_pm_mission_mode_transition(struct mhi_controller *mhi_cntrl) { struct mhi_event *mhi_event; struct device *dev = &mhi_cntrl->mhi_dev->dev; + enum mhi_ee_type ee = MHI_EE_MAX, current_ee = mhi_cntrl->ee; int i, ret; dev_dbg(dev, "Processing Mission Mode transition\n"); @@ -395,6 +396,8 @@ static int mhi_pm_mission_mode_transition(struct mhi_controller *mhi_cntrl) wake_up_all(&mhi_cntrl->state_event); + device_for_each_child(&mhi_cntrl->mhi_dev->dev, ¤t_ee, + mhi_destroy_device); mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_EE_MISSION_MODE); /* Force MHI to be in M0 state before continuing */
When moving from SBL to mission mode execution environment, there is no remove callback notification to MHI client drivers which operate on SBL mode only. Client driver devices are being created in SBL or AMSS(mission mode) and only destroyed after power down or SYS_ERROR. If there exist any SBL-specific channels, those are left open and client drivers are thus unaware of the new execution environment where those channels cannot operate. Close the gap and issue remove callbacks to SBL-specific client drivers once device enters mission mode. Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org> --- drivers/bus/mhi/core/main.c | 22 ++++++++++++++++++---- drivers/bus/mhi/core/pm.c | 3 +++ 2 files changed, 21 insertions(+), 4 deletions(-)