linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Kalle Valo <kvalo@kernel.org>
Cc: mhi@lists.linux.dev, ath11k@lists.infradead.org,
	linux-wireless@vger.kernel.org
Subject: Re: [PATCH v2 1/3] mhi: allow MHI client drivers to provide the firmware via a pointer
Date: Sun, 28 May 2023 20:27:21 +0530	[thread overview]
Message-ID: <20230528145721.GE2814@thinkpad> (raw)
In-Reply-To: <87353jl3it.fsf@kernel.org>

On Fri, May 26, 2023 at 02:45:46PM +0300, Kalle Valo wrote:
> Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> writes:
> 
> > On Wed, Mar 08, 2023 at 05:25:20PM +0200, Kalle Valo wrote:
> >> From: Kalle Valo <quic_kvalo@quicinc.com>
> >> 
> >
> > Subject prefix should be: "bus: mhi: host: ..."
> 
> Will do.
> 
> >> @@ -392,9 +390,10 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl)
> >>  	const struct firmware *firmware = NULL;
> >>  	struct device *dev = &mhi_cntrl->mhi_dev->dev;
> >>  	const char *fw_name;
> >> +	const u8 *fw_data;
> >>  	void *buf;
> >>  	dma_addr_t dma_addr;
> >> -	size_t size;
> >> +	size_t size, fw_sz;
> >>  	int i, ret;
> >>  
> >>  	if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) {
> >> @@ -424,6 +423,14 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl)
> >>  	fw_name = (mhi_cntrl->ee == MHI_EE_EDL) ?
> >>  		mhi_cntrl->edl_image : mhi_cntrl->fw_image;
> >>  
> >
> > Can you please add a comment here?
> 
> Ok.
> 
> >
> >> +	if (!fw_name && mhi_cntrl->fbc_download &&
> >> +	    mhi_cntrl->fw_data && mhi_cntrl->fw_sz) {
> >> +		size = mhi_cntrl->sbl_size;
> >
> > Don't you need to validate sbl_size?
> 
> Good point, I'll add that.
> 
> >> --- a/include/linux/mhi.h
> >> +++ b/include/linux/mhi.h
> >> @@ -299,6 +299,10 @@ struct mhi_controller_config {
> >>   * @iova_start: IOMMU starting address for data (required)
> >>   * @iova_stop: IOMMU stop address for data (required)
> >>   * @fw_image: Firmware image name for normal booting (optional)
> >> + * @fw_data: Firmware image data content for normal booting, used only
> >> + *           if fw_image is NULL (optional)
> >> + * @fw_sz: Firmware image data size for normal booting, used only if fw_image
> >> + *         is NULL and fbc_download is true (optional)
> >>   * @edl_image: Firmware image name for emergency download mode (optional)
> >>   * @rddm_size: RAM dump size that host should allocate for debugging purpose
> >>   * @sbl_size: SBL image size downloaded through BHIe (optional)
> >> @@ -384,6 +388,8 @@ struct mhi_controller {
> >>  	dma_addr_t iova_start;
> >>  	dma_addr_t iova_stop;
> >>  	const char *fw_image;
> >> +	const u8 *fw_data;
> >> +	size_t fw_sz;
> >
> > Even though these members are not creating holes now, shuffling the datatypes
> > will create holes in the future. So I always prefer to keep the struct members
> > sorted in the below order:
> >
> > pointer
> > struct/union
> > u64
> > u32
> > u16
> > u8
> > bool
> 
> I'm not sure what are suggesting here as struct mhi_controller is not
> using that style. Are you saying that fw_sz should be after reg_len? So
> something like this:
> 
> 	const u8 *fw_data;
> 	const char *edl_image;
> 	size_t rddm_size;
> 	size_t sbl_size;
> 	size_t seg_len;
> 	size_t reg_len;
> 	size_t fw_sz;
> 

Ah, I thought I already sorted them up but apparently not. Keep it as it is,
I'll sort this and other structs later.

- Mani

> -- 
> https://patchwork.kernel.org/project/linux-wireless/list/
> 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

-- 
மணிவண்ணன் சதாசிவம்

  reply	other threads:[~2023-05-28 14:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 15:25 [PATCH v2 0/3] wifi: ath11k: support firmware-2.bin Kalle Valo
2023-03-08 15:25 ` [PATCH v2 1/3] mhi: allow MHI client drivers to provide the firmware via a pointer Kalle Valo
2023-03-15  8:18   ` Manivannan Sadhasivam
2023-05-26 11:45     ` Kalle Valo
2023-05-28 14:57       ` Manivannan Sadhasivam [this message]
2023-05-29  8:53         ` Kalle Valo
2023-03-08 15:25 ` [PATCH v2 2/3] wifi: ath11k: qmi: refactor ath11k_qmi_m3_load() Kalle Valo
2023-03-08 15:25 ` [PATCH v2 3/3] wifi: ath11k: add firmware-2.bin support Kalle Valo

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=20230528145721.GE2814@thinkpad \
    --to=manivannan.sadhasivam@linaro.org \
    --cc=ath11k@lists.infradead.org \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mhi@lists.linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).