netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kumar, M Chetan" <m.chetan.kumar@linux.intel.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	johannes@sipsolutions.net, ryazanov.s.a@gmail.com,
	loic.poulain@linaro.org, krishna.c.sudi@intel.com,
	linuxwwan@intel.com
Subject: Re: [PATCH net-next] net: wwan: iosm: firmware flashing and coredump collection
Date: Tue, 14 Sep 2021 10:59:47 +0530	[thread overview]
Message-ID: <491d4920-ca53-7473-74ab-0aa6f6851376@linux.intel.com> (raw)
In-Reply-To: <20210913092554.21bdbb97@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>


On 9/13/2021 9:55 PM, Jakub Kicinski wrote:
> On Mon, 13 Sep 2021 18:34:12 +0530 M Chetan Kumar wrote:
>> This patch brings-in support for M.2 7560 Device firmware flashing &
>> coredump collection using devlink.
>> - Driver Registers with Devlink framework.
>> - Register devlink params callback for configuring device params
>>    required in flashing or coredump flow.
>> - Implements devlink ops flash_update callback that programs modem
>>    firmware.
>> - Creates region & snapshot required for device coredump log collection.
>>
>> On early detection of device in boot rom stage. Driver registers with
>> Devlink framework and establish transport channel for PSI (Primary Signed
>> Image) injection. Once PSI is injected to device, the device execution
>> stage details are read to determine whether device is in flash or
>> exception mode.
> 
> Is this normal operation flow for the device? After each boot device
> boots from the rom image and then user has to "inject" the full FW
> image with devlink?

No. It's not a normal operation flow for the device.
M.2 7560 Device has a NAND flash. Only when device needs to be reflashed 
then only fw image is injected via devlink.

In order to keep device in boot rom stage a special AT command or MBIM 
CID is issued prior to fw flash.

>> +int ipc_coredump_get_list(struct iosm_devlink *devlink, u16 cmd)
>> +{
>> +	u32 byte_read, num_entries, file_size;
>> +	struct iosm_cd_table *cd_table;
>> +	u8 size[MAX_SIZE_LEN], i;
>> +	char *filename;
>> +	int ret = 0;
>> +
>> +	cd_table = kzalloc(MAX_CD_LIST_SIZE, GFP_KERNEL);
>> +	if (!cd_table) {
>> +		ret = -ENOMEM;
>> +		goto  cd_init_fail;
>> +	}
>> +
>> +	ret = ipc_devlink_send_cmd(devlink, cmd, MAX_CD_LIST_SIZE);
>> +	if (ret) {
>> +		dev_err(devlink->dev, "rpsi_cmd_coredump_start failed");
>> +		goto cd_init_fail;
>> +	}
>> +
>> +	ret = ipc_imem_sys_devlink_read(devlink, (u8 *)cd_table,
>> +					MAX_CD_LIST_SIZE, &byte_read);
>> +	if (ret) {
>> +		dev_err(devlink->dev, "Coredump data is invalid");
>> +		goto cd_init_fail;
>> +	}
>> +
>> +	if (byte_read != MAX_CD_LIST_SIZE)
>> +		goto cd_init_fail;
>> +
>> +	if (cmd == rpsi_cmd_coredump_start) {
>> +		num_entries = le32_to_cpu(cd_table->list.num_entries);
>> +		if (num_entries == 0 || num_entries > IOSM_NOF_CD_REGION) {
>> +			ret = -EINVAL;
>> +			goto cd_init_fail;
>> +		}
>> +
>> +		for (i = 0; i < num_entries; i++) {
>> +			file_size = le32_to_cpu(cd_table->list.entry[i].size);
>> +			filename = cd_table->list.entry[i].filename;
>> +
>> +			if (file_size > devlink->cd_file_info[i].default_size) {
>> +				ret = -EINVAL;
>> +				goto cd_init_fail;
>> +			}
>> +
>> +			devlink->cd_file_info[i].actual_size = file_size;
>> +			dev_dbg(devlink->dev, "file: %s actual size %d",
>> +				filename, file_size);
>> +			devlink_flash_update_status_notify(devlink->devlink_ctx,
>> +							   filename,
>> +							   "FILENAME", 0, 0);
> 
> Why are you using flash_update_status_notify() in a snapshot collecting
> function? As the name indicates that helper is for reporting flashing
> progress.

Coredump collection process starts with pre-flashing procedure (primary 
fw injection), depending on current device state either in exception or 
flash stage the device reported information is notified to devlink via 
_flash_update_status_notify.

This is an early procedure for coredump collection.

      parent reply	other threads:[~2021-09-14  5:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 13:04 [PATCH net-next] net: wwan: iosm: firmware flashing and coredump collection M Chetan Kumar
2021-09-13 14:30 ` patchwork-bot+netdevbpf
2021-09-13 16:25 ` Jakub Kicinski
2021-09-14  0:50   ` Andrew Lunn
2021-09-14  5:29   ` Kumar, M Chetan [this message]

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=491d4920-ca53-7473-74ab-0aa6f6851376@linux.intel.com \
    --to=m.chetan.kumar@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=johannes@sipsolutions.net \
    --cc=krishna.c.sudi@intel.com \
    --cc=kuba@kernel.org \
    --cc=linuxwwan@intel.com \
    --cc=loic.poulain@linaro.org \
    --cc=netdev@vger.kernel.org \
    --cc=ryazanov.s.a@gmail.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;
as well as URLs for NNTP newsgroup(s).