From: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
To: Muhammad Usama Anjum <usama.anjum@collabora.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
Jeff Johnson <jjohnson@kernel.org>,
Youssef Samir <quic_yabdulra@quicinc.com>,
Matthew Leung <quic_mattleun@quicinc.com>,
Yan Zhen <yanzhen@vivo.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>,
Kunwu Chan <chentao@kylinos.cn>,
Troy Hanson <quic_thanson@quicinc.com>,
"Dr. David Alan Gilbert" <linux@treblig.org>
Cc: kernel@collabora.com, sebastian.reichel@collabora.com,
Carl Vanderlip <quic_carlv@quicinc.com>,
Alex Elder <elder@kernel.org>,
mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org,
ath11k@lists.infradead.org, ath12k@lists.infradead.org
Subject: Re: [PATCH v4] bus: mhi: host: don't free bhie tables during suspend/hibernation
Date: Mon, 12 May 2025 12:46:49 -0600 [thread overview]
Message-ID: <4a6b83f4-885a-46e1-ae31-21a4f3959bae@oss.qualcomm.com> (raw)
In-Reply-To: <20250506144941.2715345-1-usama.anjum@collabora.com>
On 5/6/2025 8:49 AM, Muhammad Usama Anjum wrote:
> Fix dma_direct_alloc() failure at resume time during bhie_table
> allocation because of memory pressure. There is a report where at
> resume time, the memory from the dma doesn't get allocated and MHI
> fails to re-initialize.
>
> To fix it, don't free the memory at power down during suspend /
> hibernation. Instead, use the same allocated memory again after every
> resume / hibernation. This patch has been tested with resume and
> hibernation both.
>
> The rddm is of constant size for a given hardware. While the fbc_image
> size depends on the firmware. If the firmware changes, we'll free and
> allocate new memory for it.
Why is it valid to load new firmware as a result of suspend? I don't
users would expect that.
> diff --git a/drivers/bus/mhi/host/boot.c b/drivers/bus/mhi/host/boot.c
> index efa3b6dddf4d2..bc8459798bbee 100644
> --- a/drivers/bus/mhi/host/boot.c
> +++ b/drivers/bus/mhi/host/boot.c
> @@ -584,10 +584,17 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl)
> * device transitioning into MHI READY state
> */
> if (fw_load_type == MHI_FW_LOAD_FBC) {
Why is this FBC specific?
> - ret = mhi_alloc_bhie_table(mhi_cntrl, &mhi_cntrl->fbc_image, fw_sz);
> - if (ret) {
> - release_firmware(firmware);
> - goto error_fw_load;
> + if (mhi_cntrl->fbc_image && fw_sz != mhi_cntrl->prev_fw_sz) {
> + mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image);
> + mhi_cntrl->fbc_image = NULL;
> + }
> + if (!mhi_cntrl->fbc_image) {
> + ret = mhi_alloc_bhie_table(mhi_cntrl, &mhi_cntrl->fbc_image, fw_sz);
> + if (ret) {
> + release_firmware(firmware);
> + goto error_fw_load;
> + }
> + mhi_cntrl->prev_fw_sz = fw_sz;
> }
>
> /* Load the firmware into BHIE vec table */
> diff --git a/drivers/bus/mhi/host/pm.c b/drivers/bus/mhi/host/pm.c
> index e6c3ff62bab1d..107d71b4cc51a 100644
> --- a/drivers/bus/mhi/host/pm.c
> +++ b/drivers/bus/mhi/host/pm.c
> @@ -1259,10 +1259,19 @@ void mhi_power_down(struct mhi_controller *mhi_cntrl, bool graceful)
> }
> EXPORT_SYMBOL_GPL(mhi_power_down);
>
> +static void __mhi_power_down_unprepare_keep_dev(struct mhi_controller *mhi_cntrl)
> +{
> + mhi_cntrl->bhi = NULL;
> + mhi_cntrl->bhie = NULL;
Why?
> +
> + mhi_deinit_dev_ctxt(mhi_cntrl);
> +}
next prev parent reply other threads:[~2025-05-12 18:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-06 14:49 [PATCH v4] bus: mhi: host: don't free bhie tables during suspend/hibernation Muhammad Usama Anjum
2025-05-07 9:14 ` Baochen Qiang
2025-05-07 14:14 ` Jeff Johnson
2025-05-12 18:46 ` Jeff Hugo [this message]
2025-05-13 6:44 ` Muhammad Usama Anjum
2025-05-13 15:16 ` Jeff Hugo
2025-05-14 7:17 ` Muhammad Usama Anjum
2025-05-16 14:51 ` Jeff Hugo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4a6b83f4-885a-46e1-ae31-21a4f3959bae@oss.qualcomm.com \
--to=jeff.hugo@oss.qualcomm.com \
--cc=ath11k@lists.infradead.org \
--cc=ath12k@lists.infradead.org \
--cc=chentao@kylinos.cn \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jacek.lawrynowicz@linux.intel.com \
--cc=jjohnson@kernel.org \
--cc=kernel@collabora.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linux@treblig.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=mhi@lists.linux.dev \
--cc=quic_carlv@quicinc.com \
--cc=quic_mattleun@quicinc.com \
--cc=quic_thanson@quicinc.com \
--cc=quic_yabdulra@quicinc.com \
--cc=sebastian.reichel@collabora.com \
--cc=usama.anjum@collabora.com \
--cc=yanzhen@vivo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox