Message ID | 1614208985-20851-1-git-send-email-bbhatt@codeaurora.org |
---|---|
Headers | show |
Series | Serialize execution environment changes for MHI | expand |
On 2/24/21 3:23 PM, Bhaumik Bhatt wrote: > Currently, client devices are created in SBL or AMSS (mission > mode) and only destroyed after power down or SYS ERROR. When > moving between certain execution environments, such as from SBL > to AMSS, no clean-up is required. This presents an issue where > SBL-specific channels are left open and client drivers now run in > an execution environment where they cannot operate. Fix this by > expanding the mhi_destroy_device() to do an execution environment > specific clean-up if one is requested. Close the gap and destroy > devices in such scenarios that allow SBL client drivers to clean > up once device enters mission mode. > > Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org> It make sense to clean up previous execution env related resources. 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, 25 Feb 2021 at 00:23, Bhaumik Bhatt <bbhatt@codeaurora.org> wrote: > > Currently, client devices are created in SBL or AMSS (mission > mode) and only destroyed after power down or SYS ERROR. When > moving between certain execution environments, such as from SBL > to AMSS, no clean-up is required. This presents an issue where > SBL-specific channels are left open and client drivers now run in > an execution environment where they cannot operate. Fix this by > expanding the mhi_destroy_device() to do an execution environment > specific clean-up if one is requested. Close the gap and destroy > devices in such scenarios that allow SBL client drivers to clean > up once device enters mission mode. > > Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
On Thu, 25 Feb 2021 at 00:23, Bhaumik Bhatt <bbhatt@codeaurora.org> wrote: > > During full boot chain firmware download, the PM state worker > downloads the AMSS image after a blocking wait for the SBL > execution environment change when running in PBL transition > itself. Improve this design by having the host download the AMSS > image from the SBL transition of PM state worker thread when a > DEV_ST_TRANSITION_SBL is queued instead of the blocking wait. > > Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org> > Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
On Wed, Feb 24, 2021 at 03:23:02PM -0800, Bhaumik Bhatt wrote: > Currently, client devices are created in SBL or AMSS (mission > mode) and only destroyed after power down or SYS ERROR. When > moving between certain execution environments, such as from SBL > to AMSS, no clean-up is required. This presents an issue where > SBL-specific channels are left open and client drivers now run in > an execution environment where they cannot operate. Fix this by > expanding the mhi_destroy_device() to do an execution environment > specific clean-up if one is requested. Close the gap and destroy > devices in such scenarios that allow SBL client drivers to clean > up once device enters mission mode. > > Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Thanks, Mani > --- > drivers/bus/mhi/core/main.c | 29 +++++++++++++++++++++++++---- > drivers/bus/mhi/core/pm.c | 3 +++ > 2 files changed, 28 insertions(+), 4 deletions(-) > > diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c > index 4e0131b..7a2e98c 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,17 @@ 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 execution environment is specified, remove only those devices that > + * started in them based on ee_mask for the channels as we move on to a > + * different execution environment > + */ > + 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 +277,19 @@ 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; > > - if (mhi_dev->dl_chan) > - put_device(&mhi_dev->dl_chan->mhi_dev->dev); > + put_device(&ul_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..3bd81d0 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 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 */ > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project >
On Wed, Feb 24, 2021 at 03:23:01PM -0800, Bhaumik Bhatt wrote: > v6: > -Add patch to improve debug message > -Fix switch-case fall through warning for EE serialization patch > -Address review comments and update commit text > > v5: > -Update commit text for "clear devices when moving execution environments" patch > -Added test platform details that were missed out in the cover letter > -Merged two if checks in to a single one for EE serialization patch > > v4: > -Addressed review comments for additional info logging for EE movements > -Updated switch case for EE handling in mhi_intvec_threaded_handler() > > v3: > -Update commit text to accurately reflect changes and reasoning based on reviews > > v2: > -Add patch to clear devices when moving execution environments > > Note: This patch is first in series of execution environment related changes. > > During full boot chain firmware download, the PM state worker downloads the AMSS > image after waiting for the SBL execution environment change in PBL mode itself. > Since getting rid of the firmware load worker thread, this design needs to > change and MHI host must download the AMSS image from the SBL mode of PM state > worker thread instead of blocking waits for SBL EE in PBL transition processing. > > Ensure that EE changes are handled only from appropriate places and occur > one after another and handle only PBL or RDDM EE changes as critical events > directly from the interrupt handler and the status callback is given to the > controller drivers promptly. > > When moving from SBL to AMSS EE, clear SBL specific client devices by calling > remove callbacks for them so they are not left opened in a different execution > environment. > > This patchset was tested on ARM64. > Series applied to mhi-next! Thanks, Mani > Bhaumik Bhatt (4): > bus: mhi: core: Destroy SBL devices when moving to mission mode > bus: mhi: core: Download AMSS image from appropriate function > bus: mhi: core: Process execution environment changes serially > bus: mhi: core: Update debug prints to include local device state > > drivers/bus/mhi/core/boot.c | 51 +++++++++++++-------------- > drivers/bus/mhi/core/internal.h | 1 + > drivers/bus/mhi/core/main.c | 76 +++++++++++++++++++++++++++-------------- > drivers/bus/mhi/core/pm.c | 10 ++++-- > 4 files changed, 83 insertions(+), 55 deletions(-) > > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project >
Hello: This series was applied to qcom/linux.git (refs/heads/for-next): On Wed, 24 Feb 2021 15:23:01 -0800 you wrote: > v6: > -Add patch to improve debug message > -Fix switch-case fall through warning for EE serialization patch > -Address review comments and update commit text > > v5: > -Update commit text for "clear devices when moving execution environments" patch > -Added test platform details that were missed out in the cover letter > -Merged two if checks in to a single one for EE serialization patch > > [...] Here is the summary with links: - [v6,1/4] bus: mhi: core: Destroy SBL devices when moving to mission mode https://git.kernel.org/qcom/c/925089c1900f - [v6,2/4] bus: mhi: core: Download AMSS image from appropriate function https://git.kernel.org/qcom/c/4884362f6977 - [v6,3/4] bus: mhi: core: Process execution environment changes serially https://git.kernel.org/qcom/c/ef2126c4e2ea - [v6,4/4] bus: mhi: core: Update debug prints to include local device state https://git.kernel.org/qcom/c/aaca4233ea03 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html