* [RFC] bus: mhi: core: Load firmware asynchronous
@ 2021-12-10 16:16 Thomas Weißschuh
2021-12-11 3:57 ` kernel test robot
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Thomas Weißschuh @ 2021-12-10 16:16 UTC (permalink / raw)
To: Hemant Kumar, Manivannan Sadhasivam
Cc: Thomas Weißschuh, linux-kernel, mhi, linux-arm-msm,
Mario Limonciello, Richard Hughes
This gives userspace the possibility to provide the firehose bootloader
via the sysfs-firmware-API instead of having to modify the global
firmware loadpath.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Please note that this is not tested yet, as I don't have access to a matching
firmware file.
This submission is to gather general feedback from the maintainers and then
Richard will do the actual testing, while I'll do the development.
This patch is should not have any impact beyond moving from request_firmware()
to request_firmware_nowait() and the involved code reshuffle.
---
drivers/bus/mhi/core/boot.c | 159 +++++++++++++++++++++++-------------
1 file changed, 101 insertions(+), 58 deletions(-)
diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c
index 74295d3cc662..b0576ffc69c6 100644
--- a/drivers/bus/mhi/core/boot.c
+++ b/drivers/bus/mhi/core/boot.c
@@ -18,6 +18,17 @@
#include <linux/wait.h>
#include "internal.h"
+struct mhi_fw_load_callback_ctx {
+ const char *fw_name;
+ struct mhi_controller *mhi_cntrl;
+};
+
+enum mhi_fw_load_status {
+ MHI_FW_LOAD_READY_STATE,
+ MHI_FW_ERROR_READY_STATE,
+ MHI_FW_ERROR_FW_LOAD,
+};
+
/* Setup RDDM vector table for RDDM transfer and program RXVEC */
void mhi_rddm_prepare(struct mhi_controller *mhi_cntrl,
struct image_info *img_info)
@@ -386,55 +397,53 @@ static void mhi_firmware_copy(struct mhi_controller *mhi_cntrl,
}
}
-void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl)
+static void mhi_fw_load_finish(struct mhi_controller *mhi_cntrl, enum mhi_fw_load_status status)
{
- const struct firmware *firmware = NULL;
struct device *dev = &mhi_cntrl->mhi_dev->dev;
- const char *fw_name;
- void *buf;
- dma_addr_t dma_addr;
- size_t size;
- int i, ret;
+ int ret;
- if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) {
- dev_err(dev, "Device MHI is not in valid state\n");
- return;
+ switch (status) {
+ case MHI_FW_LOAD_READY_STATE:
+ break;
+ case MHI_FW_ERROR_READY_STATE:
+ goto error_ready_state;
+ case MHI_FW_ERROR_FW_LOAD:
+ goto error_fw_load;
}
- /* save hardware info from BHI */
- ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_SERIALNU,
- &mhi_cntrl->serial_number);
- if (ret)
- dev_err(dev, "Could not capture serial number via BHI\n");
-
- for (i = 0; i < ARRAY_SIZE(mhi_cntrl->oem_pk_hash); i++) {
- ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_OEMPKHASH(i),
- &mhi_cntrl->oem_pk_hash[i]);
- if (ret) {
- dev_err(dev, "Could not capture OEM PK HASH via BHI\n");
- break;
- }
+ /* Transitioning into MHI RESET->READY state */
+ ret = mhi_ready_state_transition(mhi_cntrl);
+ if (ret) {
+ dev_err(dev, "MHI did not enter READY state\n");
+ goto error_ready_state;
}
- /* wait for ready on pass through or any other execution environment */
- if (!MHI_FW_LOAD_CAPABLE(mhi_cntrl->ee))
- goto fw_load_ready_state;
-
- fw_name = (mhi_cntrl->ee == MHI_EE_EDL) ?
- mhi_cntrl->edl_image : mhi_cntrl->fw_image;
+ dev_info(dev, "Wait for device to enter SBL or Mission mode\n");
+ return;
- if (!fw_name || (mhi_cntrl->fbc_download && (!mhi_cntrl->sbl_size ||
- !mhi_cntrl->seg_len))) {
- dev_err(dev,
- "No firmware image defined or !sbl_size || !seg_len\n");
- goto error_fw_load;
+error_ready_state:
+ if (mhi_cntrl->fbc_download) {
+ mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image);
+ mhi_cntrl->fbc_image = NULL;
}
- ret = request_firmware(&firmware, fw_name, dev);
- if (ret) {
- dev_err(dev, "Error loading firmware: %d\n", ret);
- goto error_fw_load;
- }
+error_fw_load:
+ mhi_cntrl->pm_state = MHI_PM_FW_DL_ERR;
+ wake_up_all(&mhi_cntrl->state_event);
+}
+
+static void mhi_fw_load_callback(const struct firmware *firmware, void *context)
+{
+ struct mhi_fw_load_callback_ctx *ctx = context;
+ const char *fw_name = ctx->fw_name;
+ struct mhi_controller *mhi_cntrl = ctx->mhi_cntrl;
+ struct device *dev = &mhi_cntrl->mhi_dev->dev;
+ dma_addr_t dma_addr;
+ size_t size;
+ void *buf;
+ int ret;
+
+ kfree(context);
size = (mhi_cntrl->fbc_download) ? mhi_cntrl->sbl_size : firmware->size;
@@ -446,7 +455,7 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl)
GFP_KERNEL);
if (!buf) {
release_firmware(firmware);
- goto error_fw_load;
+ mhi_fw_load_finish(mhi_cntrl, MHI_FW_ERROR_FW_LOAD);
}
/* Download image using BHI */
@@ -458,13 +467,13 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl)
if (ret) {
dev_err(dev, "MHI did not load image over BHI, ret: %d\n", ret);
release_firmware(firmware);
- goto error_fw_load;
+ mhi_fw_load_finish(mhi_cntrl, MHI_FW_ERROR_FW_LOAD);
}
/* Wait for ready since EDL image was loaded */
if (fw_name == mhi_cntrl->edl_image) {
release_firmware(firmware);
- goto fw_load_ready_state;
+ mhi_fw_load_finish(mhi_cntrl, MHI_FW_LOAD_READY_STATE);
}
write_lock_irq(&mhi_cntrl->pm_lock);
@@ -480,7 +489,7 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl)
firmware->size);
if (ret) {
release_firmware(firmware);
- goto error_fw_load;
+ mhi_fw_load_finish(mhi_cntrl, MHI_FW_ERROR_FW_LOAD);
}
/* Load the firmware into BHIE vec table */
@@ -489,26 +498,60 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl)
release_firmware(firmware);
-fw_load_ready_state:
- /* Transitioning into MHI RESET->READY state */
- ret = mhi_ready_state_transition(mhi_cntrl);
- if (ret) {
- dev_err(dev, "MHI did not enter READY state\n");
- goto error_ready_state;
+ mhi_fw_load_finish(mhi_cntrl, MHI_FW_LOAD_READY_STATE);
+}
+
+void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl)
+{
+ struct device *dev = &mhi_cntrl->mhi_dev->dev;
+ struct mhi_fw_load_callback_ctx *cb_ctx;
+ const char *fw_name;
+ int i, ret;
+
+ if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) {
+ dev_err(dev, "Device MHI is not in valid state\n");
+ return;
}
- dev_info(dev, "Wait for device to enter SBL or Mission mode\n");
- return;
+ /* save hardware info from BHI */
+ ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_SERIALNU,
+ &mhi_cntrl->serial_number);
+ if (ret)
+ dev_err(dev, "Could not capture serial number via BHI\n");
-error_ready_state:
- if (mhi_cntrl->fbc_download) {
- mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image);
- mhi_cntrl->fbc_image = NULL;
+ for (i = 0; i < ARRAY_SIZE(mhi_cntrl->oem_pk_hash); i++) {
+ ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_OEMPKHASH(i),
+ &mhi_cntrl->oem_pk_hash[i]);
+ if (ret) {
+ dev_err(dev, "Could not capture OEM PK HASH via BHI\n");
+ break;
+ }
}
-error_fw_load:
- mhi_cntrl->pm_state = MHI_PM_FW_DL_ERR;
- wake_up_all(&mhi_cntrl->state_event);
+ /* wait for ready on pass through or any other execution environment */
+ if (!MHI_FW_LOAD_CAPABLE(mhi_cntrl->ee))
+ mhi_fw_load_finish(mhi_cntrl, MHI_FW_LOAD_READY_STATE);
+
+ fw_name = (mhi_cntrl->ee == MHI_EE_EDL) ?
+ mhi_cntrl->edl_image : mhi_cntrl->fw_image;
+
+ if (!fw_name || (mhi_cntrl->fbc_download && (!mhi_cntrl->sbl_size ||
+ !mhi_cntrl->seg_len))) {
+ dev_err(dev,
+ "No firmware image defined or !sbl_size || !seg_len\n");
+ mhi_fw_load_finish(mhi_cntrl, MHI_FW_ERROR_FW_LOAD);
+ }
+
+ cb_ctx = kzalloc(sizeof(*cb_ctx), GFP_KERNEL);
+ if (!cb_ctx)
+ return;
+
+ ret = request_firmware_nowait(THIS_MODULE, true, fw_name, dev, GFP_KERNEL, cb_ctx,
+ mhi_fw_load_callback);
+ if (ret) {
+ dev_err(dev, "Error loading firmware: %d\n", ret);
+ mhi_fw_load_finish(mhi_cntrl, MHI_FW_ERROR_FW_LOAD);
+ }
}
int mhi_download_amss_image(struct mhi_controller *mhi_cntrl)
base-commit: 622e96fb58d63985b028abc2cb9a873124bdac1e
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [RFC] bus: mhi: core: Load firmware asynchronous
2021-12-10 16:16 [RFC] bus: mhi: core: Load firmware asynchronous Thomas Weißschuh
@ 2021-12-11 3:57 ` kernel test robot
2021-12-14 0:07 ` Hemant Kumar
2021-12-16 10:19 ` Kalle Valo
2 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-12-11 3:57 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7681 bytes --]
Hi "Thomas,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on 622e96fb58d63985b028abc2cb9a873124bdac1e]
url: https://github.com/0day-ci/linux/commits/Thomas-Wei-schuh/bus-mhi-core-Load-firmware-asynchronous/20211211-001725
base: 622e96fb58d63985b028abc2cb9a873124bdac1e
config: sh-randconfig-r015-20211210 (https://download.01.org/0day-ci/archive/20211211/202112111112.sFiipK0A-lkp(a)intel.com/config)
compiler: sh4-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/bc1fbdf39b0c8e31c64a703307a4e88a56efc8ca
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Thomas-Wei-schuh/bus-mhi-core-Load-firmware-asynchronous/20211211-001725
git checkout bc1fbdf39b0c8e31c64a703307a4e88a56efc8ca
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sh SHELL=/bin/bash drivers/bus/mhi/core/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/bus/mhi/core/boot.c: In function 'mhi_fw_load_callback':
>> drivers/bus/mhi/core/boot.c:463:15: warning: 'dma_addr' is used uninitialized [-Wuninitialized]
463 | ret = mhi_fw_load_bhi(mhi_cntrl, dma_addr, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/dma_addr +463 drivers/bus/mhi/core/boot.c
cd457afb166705 Manivannan Sadhasivam 2020-02-20 434
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 435 static void mhi_fw_load_callback(const struct firmware *firmware, void *context)
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 436 {
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 437 struct mhi_fw_load_callback_ctx *ctx = context;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 438 const char *fw_name = ctx->fw_name;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 439 struct mhi_controller *mhi_cntrl = ctx->mhi_cntrl;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 440 struct device *dev = &mhi_cntrl->mhi_dev->dev;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 441 dma_addr_t dma_addr;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 442 size_t size;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 443 void *buf;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 444 int ret;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 445
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 446 kfree(context);
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 447
cd457afb166705 Manivannan Sadhasivam 2020-02-20 448 size = (mhi_cntrl->fbc_download) ? mhi_cntrl->sbl_size : firmware->size;
cd457afb166705 Manivannan Sadhasivam 2020-02-20 449
cd457afb166705 Manivannan Sadhasivam 2020-02-20 450 /* SBL size provided is maximum size, not necessarily the image size */
cd457afb166705 Manivannan Sadhasivam 2020-02-20 451 if (size > firmware->size)
cd457afb166705 Manivannan Sadhasivam 2020-02-20 452 size = firmware->size;
cd457afb166705 Manivannan Sadhasivam 2020-02-20 453
2e36190de69cb4 Bhaumik Bhatt 2021-08-02 454 buf = dma_alloc_coherent(mhi_cntrl->cntrl_dev, size, &dma_addr,
2e36190de69cb4 Bhaumik Bhatt 2021-08-02 455 GFP_KERNEL);
cd457afb166705 Manivannan Sadhasivam 2020-02-20 456 if (!buf) {
cd457afb166705 Manivannan Sadhasivam 2020-02-20 457 release_firmware(firmware);
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 458 mhi_fw_load_finish(mhi_cntrl, MHI_FW_ERROR_FW_LOAD);
cd457afb166705 Manivannan Sadhasivam 2020-02-20 459 }
cd457afb166705 Manivannan Sadhasivam 2020-02-20 460
1b55c16a5e4718 Bhaumik Bhatt 2020-11-09 461 /* Download image using BHI */
cd457afb166705 Manivannan Sadhasivam 2020-02-20 462 memcpy(buf, firmware->data, size);
1b55c16a5e4718 Bhaumik Bhatt 2020-11-09 @463 ret = mhi_fw_load_bhi(mhi_cntrl, dma_addr, size);
2e36190de69cb4 Bhaumik Bhatt 2021-08-02 464 dma_free_coherent(mhi_cntrl->cntrl_dev, size, buf, dma_addr);
cd457afb166705 Manivannan Sadhasivam 2020-02-20 465
cd457afb166705 Manivannan Sadhasivam 2020-02-20 466 /* Error or in EDL mode, we're done */
0a895f091ebd94 Bhaumik Bhatt 2020-05-21 467 if (ret) {
1b55c16a5e4718 Bhaumik Bhatt 2020-11-09 468 dev_err(dev, "MHI did not load image over BHI, ret: %d\n", ret);
12e050c77be036 Bhaumik Bhatt 2020-11-09 469 release_firmware(firmware);
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 470 mhi_fw_load_finish(mhi_cntrl, MHI_FW_ERROR_FW_LOAD);
0a895f091ebd94 Bhaumik Bhatt 2020-05-21 471 }
0a895f091ebd94 Bhaumik Bhatt 2020-05-21 472
4f214496ac7421 Bhaumik Bhatt 2021-03-29 473 /* Wait for ready since EDL image was loaded */
418bec695696ab Bhaumik Bhatt 2021-03-29 474 if (fw_name == mhi_cntrl->edl_image) {
12e050c77be036 Bhaumik Bhatt 2020-11-09 475 release_firmware(firmware);
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 476 mhi_fw_load_finish(mhi_cntrl, MHI_FW_LOAD_READY_STATE);
12e050c77be036 Bhaumik Bhatt 2020-11-09 477 }
cd457afb166705 Manivannan Sadhasivam 2020-02-20 478
cd457afb166705 Manivannan Sadhasivam 2020-02-20 479 write_lock_irq(&mhi_cntrl->pm_lock);
cd457afb166705 Manivannan Sadhasivam 2020-02-20 480 mhi_cntrl->dev_state = MHI_STATE_RESET;
cd457afb166705 Manivannan Sadhasivam 2020-02-20 481 write_unlock_irq(&mhi_cntrl->pm_lock);
cd457afb166705 Manivannan Sadhasivam 2020-02-20 482
cd457afb166705 Manivannan Sadhasivam 2020-02-20 483 /*
cd457afb166705 Manivannan Sadhasivam 2020-02-20 484 * If we're doing fbc, populate vector tables while
cd457afb166705 Manivannan Sadhasivam 2020-02-20 485 * device transitioning into MHI READY state
cd457afb166705 Manivannan Sadhasivam 2020-02-20 486 */
cd457afb166705 Manivannan Sadhasivam 2020-02-20 487 if (mhi_cntrl->fbc_download) {
cd457afb166705 Manivannan Sadhasivam 2020-02-20 488 ret = mhi_alloc_bhie_table(mhi_cntrl, &mhi_cntrl->fbc_image,
cd457afb166705 Manivannan Sadhasivam 2020-02-20 489 firmware->size);
12e050c77be036 Bhaumik Bhatt 2020-11-09 490 if (ret) {
12e050c77be036 Bhaumik Bhatt 2020-11-09 491 release_firmware(firmware);
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 492 mhi_fw_load_finish(mhi_cntrl, MHI_FW_ERROR_FW_LOAD);
12e050c77be036 Bhaumik Bhatt 2020-11-09 493 }
cd457afb166705 Manivannan Sadhasivam 2020-02-20 494
cd457afb166705 Manivannan Sadhasivam 2020-02-20 495 /* Load the firmware into BHIE vec table */
cd457afb166705 Manivannan Sadhasivam 2020-02-20 496 mhi_firmware_copy(mhi_cntrl, firmware, mhi_cntrl->fbc_image);
cd457afb166705 Manivannan Sadhasivam 2020-02-20 497 }
cd457afb166705 Manivannan Sadhasivam 2020-02-20 498
12e050c77be036 Bhaumik Bhatt 2020-11-09 499 release_firmware(firmware);
12e050c77be036 Bhaumik Bhatt 2020-11-09 500
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 501 mhi_fw_load_finish(mhi_cntrl, MHI_FW_LOAD_READY_STATE);
0a895f091ebd94 Bhaumik Bhatt 2020-05-21 502 }
cd457afb166705 Manivannan Sadhasivam 2020-02-20 503
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC] bus: mhi: core: Load firmware asynchronous
2021-12-10 16:16 [RFC] bus: mhi: core: Load firmware asynchronous Thomas Weißschuh
2021-12-11 3:57 ` kernel test robot
@ 2021-12-14 0:07 ` Hemant Kumar
2021-12-14 6:32 ` Thomas Weißschuh
2021-12-16 10:19 ` Kalle Valo
2 siblings, 1 reply; 9+ messages in thread
From: Hemant Kumar @ 2021-12-14 0:07 UTC (permalink / raw)
To: Thomas Weißschuh, Manivannan Sadhasivam
Cc: linux-kernel, mhi, linux-arm-msm, Mario Limonciello, Richard Hughes
On 12/10/2021 8:16 AM, Thomas Weißschuh wrote:
> This gives userspace the possibility to provide the firehose bootloader
> via the sysfs-firmware-API instead of having to modify the global
> firmware loadpath.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
>
> ---
>
> Please note that this is not tested yet, as I don't have access to a matching
> firmware file.
> This submission is to gather general feedback from the maintainers and then
> Richard will do the actual testing, while I'll do the development.
>
> This patch is should not have any impact beyond moving from request_firmware()
> to request_firmware_nowait() and the involved code reshuffle.
what are we achieving by moving to async ver of the firmware load ? MHI
boot flow can not do anything until BHI load is over. Is the intention
eventually to enable firmware fallback mechanism and manually load the
firmware ?
[..]
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum, a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC] bus: mhi: core: Load firmware asynchronous
2021-12-14 0:07 ` Hemant Kumar
@ 2021-12-14 6:32 ` Thomas Weißschuh
2021-12-14 22:55 ` Hemant Kumar
0 siblings, 1 reply; 9+ messages in thread
From: Thomas Weißschuh @ 2021-12-14 6:32 UTC (permalink / raw)
To: Hemant Kumar
Cc: Manivannan Sadhasivam, linux-kernel, mhi, linux-arm-msm,
Mario Limonciello, Richard Hughes
On 2021-12-13 16:07-0800, Hemant Kumar wrote:
> On 12/10/2021 8:16 AM, Thomas Weißschuh wrote:
> > This gives userspace the possibility to provide the firehose bootloader
> > via the sysfs-firmware-API instead of having to modify the global
> > firmware loadpath.
> >
> > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> >
> > ---
> >
> > Please note that this is not tested yet, as I don't have access to a matching
> > firmware file.
> > This submission is to gather general feedback from the maintainers and then
> > Richard will do the actual testing, while I'll do the development.
> >
> > This patch is should not have any impact beyond moving from request_firmware()
> > to request_firmware_nowait() and the involved code reshuffle.
> what are we achieving by moving to async ver of the firmware load ? MHI boot
> flow can not do anything until BHI load is over. Is the intention eventually
> to enable firmware fallback mechanism and manually load the firmware ?
The goal is to provide the firehose bootloader (qcom/prog_firehose_sdx24.mbn)
via the firmware fallback mechanism when upgrading the firmware on the device
via the firehose protocol.
This bootloader firmware is not part of linux-firmware but provided as part of
each firmware update package, so it is not installed statically on the system.
I will extend the commit message with this information.
PS: The current patch is missing 'return' after calls to
'mhi_fw_load_finish()', this will be corrected in v2.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC] bus: mhi: core: Load firmware asynchronous
2021-12-14 6:32 ` Thomas Weißschuh
@ 2021-12-14 22:55 ` Hemant Kumar
2021-12-14 23:28 ` Thomas Weißschuh
0 siblings, 1 reply; 9+ messages in thread
From: Hemant Kumar @ 2021-12-14 22:55 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Manivannan Sadhasivam, linux-kernel, mhi, linux-arm-msm,
Mario Limonciello, Richard Hughes
On 12/13/2021 10:32 PM, Thomas Weißschuh wrote:
> On 2021-12-13 16:07-0800, Hemant Kumar wrote:
>> On 12/10/2021 8:16 AM, Thomas Weißschuh wrote:
>>> This gives userspace the possibility to provide the firehose bootloader
>>> via the sysfs-firmware-API instead of having to modify the global
>>> firmware loadpath.
>>>
>>> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
>>>
>>> ---
>>>
>>> Please note that this is not tested yet, as I don't have access to a matching
>>> firmware file.
>>> This submission is to gather general feedback from the maintainers and then
>>> Richard will do the actual testing, while I'll do the development.
>>>
>>> This patch is should not have any impact beyond moving from request_firmware()
>>> to request_firmware_nowait() and the involved code reshuffle.
>> what are we achieving by moving to async ver of the firmware load ? MHI boot
>> flow can not do anything until BHI load is over. Is the intention eventually
>> to enable firmware fallback mechanism and manually load the firmware ?
>
> The goal is to provide the firehose bootloader (qcom/prog_firehose_sdx24.mbn)
> via the firmware fallback mechanism when upgrading the firmware on the device
> via the firehose protocol.
>
> This bootloader firmware is not part of linux-firmware but provided as part of
> each firmware update package, so it is not installed statically on the system.
>
> I will extend the commit message with this information.
For my understanding i have follow up question. As per the kernel doc
https://www.kernel.org/doc/html/latest/driver-api/firmware/fallback-mechanisms.html
If CONFIG_FW_LOADER_USER_HELPER enabled but
CONFIG_FW_LOADER_USER_HELPER_FALLBACK is disabled, only the custom
fallback mechanism is available and for the request_firmware_nowait() call.
Custom fall back mechanism says
Users of the request_firmware_nowait() call have yet another option
available at their disposal: rely on the sysfs fallback mechanism but
request that no kobject uevents be issued to userspace. Original logic
behind this was that utilities other than udev might be required to
lookup firmware in non-traditional paths
Your patch is passing uevent flag as true which means you are relying on
uevent to be issued to userspace. How do you plan to update the firmware
path ? Alternatively firmware class provides a module param to specify
the firmware path /sys/module/firmware_class/parameters/path.
>
> PS: The current patch is missing 'return' after calls to
> 'mhi_fw_load_finish()', this will be corrected in v2.
>
Thanks,
Hemant
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum, a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC] bus: mhi: core: Load firmware asynchronous
2021-12-14 22:55 ` Hemant Kumar
@ 2021-12-14 23:28 ` Thomas Weißschuh
0 siblings, 0 replies; 9+ messages in thread
From: Thomas Weißschuh @ 2021-12-14 23:28 UTC (permalink / raw)
To: Hemant Kumar
Cc: Manivannan Sadhasivam, linux-kernel, mhi, linux-arm-msm,
Mario Limonciello, Richard Hughes, Ivan Mikhanchuk,
Aleksander Morgado
On 2021-12-14 14:55-0800, Hemant Kumar wrote:
> On 12/13/2021 10:32 PM, Thomas Weißschuh wrote:
> > On 2021-12-13 16:07-0800, Hemant Kumar wrote:
> > > On 12/10/2021 8:16 AM, Thomas Weißschuh wrote:
> > > > This gives userspace the possibility to provide the firehose bootloader
> > > > via the sysfs-firmware-API instead of having to modify the global
> > > > firmware loadpath.
> > > >
> > > > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> > > >
> > > > ---
> > > >
> > > > Please note that this is not tested yet, as I don't have access to a matching
> > > > firmware file.
> > > > This submission is to gather general feedback from the maintainers and then
> > > > Richard will do the actual testing, while I'll do the development.
> > > >
> > > > This patch is should not have any impact beyond moving from request_firmware()
> > > > to request_firmware_nowait() and the involved code reshuffle.
> > > what are we achieving by moving to async ver of the firmware load ? MHI boot
> > > flow can not do anything until BHI load is over. Is the intention eventually
> > > to enable firmware fallback mechanism and manually load the firmware ?
> >
> > The goal is to provide the firehose bootloader (qcom/prog_firehose_sdx24.mbn)
> > via the firmware fallback mechanism when upgrading the firmware on the device
> > via the firehose protocol.
> >
> > This bootloader firmware is not part of linux-firmware but provided as part of
> > each firmware update package, so it is not installed statically on the system.
> >
> > I will extend the commit message with this information.
>
> For my understanding i have follow up question. As per the kernel doc
> https://www.kernel.org/doc/html/latest/driver-api/firmware/fallback-mechanisms.html
I'll try to answer, but please be aware that I have no previous experience with
the firmware fallback mechanism and can not test this patch.
At this point in time I'm also hoping more for a general confirmation about
using *some* fallback mechanism for MHI, so Richard and Ivan can test the patch
(before it is committed) and then we can figure out exactly which of the
fallback mechanisms fits best with feedback from them.
> If CONFIG_FW_LOADER_USER_HELPER enabled but
> CONFIG_FW_LOADER_USER_HELPER_FALLBACK is disabled, only the custom fallback
> mechanism is available and for the request_firmware_nowait() call.
>
> Custom fall back mechanism says
> Users of the request_firmware_nowait() call have yet another option
> available at their disposal: rely on the sysfs fallback mechanism but
> request that no kobject uevents be issued to userspace. Original logic
> behind this was that utilities other than udev might be required to lookup
> firmware in non-traditional paths
>
> Your patch is passing uevent flag as true which means you are relying on
> uevent to be issued to userspace. How do you plan to update the firmware
> path ? Alternatively firmware class provides a module param to specify the
> firmware path /sys/module/firmware_class/parameters/path.
Emitting the uevent would allow the firmware update tool
(fwupd, https://github.com/fwupd/fwupd) to monitor uevents and recognize when
the device is ready to receive the firmware and then trigger the upload.
If I see it correctly uevent=0 and uevent=1 do the same things except uevent=1
also publishes the uevent.
Modifying /sys/module/firmware_class/parameters/path is what currently is being
done.
But modifying the global firmware load path has the potential for the following
issues:
* While the global firmware load path is modified to a custom location any
load_firmware() call from other devices will fail because the new path does
not have the normal linux-firmware.
* If the tool modifying crashes while before restoring the original load path
all further load_firmware()-calls will also fail.
> >
> > PS: The current patch is missing 'return' after calls to
> > 'mhi_fw_load_finish()', this will be corrected in v2.
Another point:
For sdx55 and sdx65 there is not only an edl firmware specified but also a
firmware for normal operation.
This firmware is not part of linux-firmware.
Currently the firmware load would fail and put the modem into an error
condition (I think?).
With this patch there would be a timeout before that error state is reached.
I know that some people have the SDX55 running with Linux but I'm now wondering
where they are getting the firmware "qcom/sdx55m/sbl1.mbn" from.
Thomas
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC] bus: mhi: core: Load firmware asynchronous
2021-12-10 16:16 [RFC] bus: mhi: core: Load firmware asynchronous Thomas Weißschuh
@ 2021-12-16 10:19 ` Kalle Valo
2021-12-14 0:07 ` Hemant Kumar
2021-12-16 10:19 ` Kalle Valo
2 siblings, 0 replies; 9+ messages in thread
From: Kalle Valo @ 2021-12-16 10:19 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Hemant Kumar, Manivannan Sadhasivam, linux-kernel, mhi,
linux-arm-msm, Mario Limonciello, Richard Hughes, ath11k
Thomas Weißschuh <linux@weissschuh.net> writes:
> This gives userspace the possibility to provide the firehose bootloader
> via the sysfs-firmware-API instead of having to modify the global
> firmware loadpath.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
>
> ---
>
> Please note that this is not tested yet, as I don't have access to a matching
> firmware file.
> This submission is to gather general feedback from the maintainers and then
> Richard will do the actual testing, while I'll do the development.
>
> This patch is should not have any impact beyond moving from request_firmware()
> to request_firmware_nowait() and the involved code reshuffle.
Related to firmware loading, for ath11k I have a different kind of need
for firmware handling in MHI. Instead of providing the firmware name to
MHI and MHI subystem loading the firmware from user space, I would like
to ath11k load the firmware from user space and just provide a pointer
to the firmware data.
The long story here is that currently ath11k pci devices have two
different firmware files, amss.bin and m3.bin. amss.bin is loaded via
MHI and m3.bin via QMI. What I would like do is to create one container
file firmware-2.bin and it would contain amss.bin, m3.bin and various
meta data needed by ath11k. ath11k would then parse firmware-2.bin and
provide pointer to amss.bin data for MHI.
We already use similar firmware-2.bin file in ath10k, but of course
ath10k doesn't need MHI so this hasn't been an issue before. We need
firmware-2.bin files because of two reasons: seamless backwards
compatibility and a reliable way to provide meta data to the driver.
Thoughts about this?
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC] bus: mhi: core: Load firmware asynchronous
@ 2021-12-16 10:19 ` Kalle Valo
0 siblings, 0 replies; 9+ messages in thread
From: Kalle Valo @ 2021-12-16 10:19 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Hemant Kumar, Manivannan Sadhasivam, linux-kernel, mhi,
linux-arm-msm, Mario Limonciello, Richard Hughes, ath11k
Thomas Weißschuh <linux@weissschuh.net> writes:
> This gives userspace the possibility to provide the firehose bootloader
> via the sysfs-firmware-API instead of having to modify the global
> firmware loadpath.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
>
> ---
>
> Please note that this is not tested yet, as I don't have access to a matching
> firmware file.
> This submission is to gather general feedback from the maintainers and then
> Richard will do the actual testing, while I'll do the development.
>
> This patch is should not have any impact beyond moving from request_firmware()
> to request_firmware_nowait() and the involved code reshuffle.
Related to firmware loading, for ath11k I have a different kind of need
for firmware handling in MHI. Instead of providing the firmware name to
MHI and MHI subystem loading the firmware from user space, I would like
to ath11k load the firmware from user space and just provide a pointer
to the firmware data.
The long story here is that currently ath11k pci devices have two
different firmware files, amss.bin and m3.bin. amss.bin is loaded via
MHI and m3.bin via QMI. What I would like do is to create one container
file firmware-2.bin and it would contain amss.bin, m3.bin and various
meta data needed by ath11k. ath11k would then parse firmware-2.bin and
provide pointer to amss.bin data for MHI.
We already use similar firmware-2.bin file in ath10k, but of course
ath10k doesn't need MHI so this hasn't been an issue before. We need
firmware-2.bin files because of two reasons: seamless backwards
compatibility and a reliable way to provide meta data to the driver.
Thoughts about this?
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
--
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [RFC] bus: mhi: core: Load firmware asynchronous
@ 2021-12-11 21:54 kernel test robot
0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-12-11 21:54 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 20399 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211210161645.10925-1-linux@weissschuh.net>
References: <20211210161645.10925-1-linux@weissschuh.net>
TO: "Thomas Weißschuh" <linux@weissschuh.net>
Hi "Thomas,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on 622e96fb58d63985b028abc2cb9a873124bdac1e]
url: https://github.com/0day-ci/linux/commits/Thomas-Wei-schuh/bus-mhi-core-Load-firmware-asynchronous/20211211-001725
base: 622e96fb58d63985b028abc2cb9a873124bdac1e
:::::: branch date: 30 hours ago
:::::: commit date: 30 hours ago
config: riscv-randconfig-c006-20211210 (https://download.01.org/0day-ci/archive/20211212/202112120530.tKg4x9UT-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/bc1fbdf39b0c8e31c64a703307a4e88a56efc8ca
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Thomas-Wei-schuh/bus-mhi-core-Load-firmware-asynchronous/20211211-001725
git checkout bc1fbdf39b0c8e31c64a703307a4e88a56efc8ca
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
include/linux/list.h:284:9: note: Left side of '||' is false
return READ_ONCE(head->next) == head;
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:302:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
include/linux/list.h:284:9: note: Left side of '||' is false
return READ_ONCE(head->next) == head;
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:302:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
include/linux/list.h:284:9: note: Left side of '||' is false
return READ_ONCE(head->next) == head;
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:302:3: note: expanded from macro '__native_word'
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
^
include/linux/list.h:284:9: note: Left side of '||' is true
return READ_ONCE(head->next) == head;
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:38: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/list.h:284:9: note: Taking false branch
return READ_ONCE(head->next) == head;
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:335:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:323:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:315:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
include/linux/list.h:284:9: note: Loop condition is false. Exiting loop
return READ_ONCE(head->next) == head;
^
include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
compiletime_assert_rwonce_type(x); \
^
include/asm-generic/rwonce.h:36:2: note: expanded from macro 'compiletime_assert_rwonce_type'
compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
^
include/linux/compiler_types.h:335:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:323:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:307:2: note: expanded from macro '__compiletime_assert'
do { \
^
include/linux/list.h:284:9: note: Use of memory after it is freed
return READ_ONCE(head->next) == head;
^
include/asm-generic/rwonce.h:50:2: note: expanded from macro 'READ_ONCE'
__READ_ONCE(x); \
^~~~~~~~~~~~~~
include/asm-generic/rwonce.h:44:24: note: expanded from macro '__READ_ONCE'
#define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 5 warnings (5 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
drivers/bus/mhi/core/boot.c:154:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = mhi_read_reg(mhi_cntrl, base, BHIE_RXVECSTATUS_OFFS, &rx_status);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/bus/mhi/core/boot.c:154:2: note: Value stored to 'ret' is never read
ret = mhi_read_reg(mhi_cntrl, base, BHIE_RXVECSTATUS_OFFS, &rx_status);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/bus/mhi/core/boot.c:462:2: warning: Null pointer passed as 1st argument to memory copy function [clang-analyzer-unix.cstring.NullArg]
memcpy(buf, firmware->data, size);
^ ~~~
drivers/bus/mhi/core/boot.c:448:9: note: Assuming field 'fbc_download' is false
size = (mhi_cntrl->fbc_download) ? mhi_cntrl->sbl_size : firmware->size;
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/bus/mhi/core/boot.c:448:9: note: '?' condition is false
drivers/bus/mhi/core/boot.c:451:6: note: 'size' is <= field 'size'
if (size > firmware->size)
^~~~
drivers/bus/mhi/core/boot.c:451:2: note: Taking false branch
if (size > firmware->size)
^
drivers/bus/mhi/core/boot.c:454:8: note: Calling 'dma_alloc_coherent'
buf = dma_alloc_coherent(mhi_cntrl->cntrl_dev, size, &dma_addr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:419:4: note: '?' condition is false
(gfp & __GFP_NOWARN) ? DMA_ATTR_NO_WARN : 0);
^
include/linux/dma-mapping.h:418:2: note: Returning pointer
return dma_alloc_attrs(dev, size, dma_handle, gfp,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/bus/mhi/core/boot.c:454:8: note: Returning from 'dma_alloc_coherent'
buf = dma_alloc_coherent(mhi_cntrl->cntrl_dev, size, &dma_addr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/bus/mhi/core/boot.c:454:2: note: Value assigned to 'buf'
buf = dma_alloc_coherent(mhi_cntrl->cntrl_dev, size, &dma_addr,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/bus/mhi/core/boot.c:456:6: note: Assuming 'buf' is null
if (!buf) {
^~~~
drivers/bus/mhi/core/boot.c:456:2: note: Taking true branch
if (!buf) {
^
drivers/bus/mhi/core/boot.c:462:2: note: Null pointer passed as 1st argument to memory copy function
memcpy(buf, firmware->data, size);
^ ~~~
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
drivers/phy/phy-core.c:307:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = 0; /* Override possible ret == -ENOTSUPP */
^ ~
drivers/phy/phy-core.c:307:2: note: Value stored to 'ret' is never read
ret = 0; /* Override possible ret == -ENOTSUPP */
^ ~
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:815:20: warning: The left operand of '==' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
if (pu == 0 && pd == 0) {
^
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:927:6: note: Assuming field 'pull_type' is null
if (hw->soc->pull_type)
^~~~~~~~~~~~~~~~~~
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:927:2: note: Taking false branch
if (hw->soc->pull_type)
^
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:932:2: note: Taking true branch
if (try_all_type & MTK_PULL_RSEL_TYPE) {
^
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:933:9: note: Calling 'mtk_pinconf_bias_get_rsel'
err = mtk_pinconf_bias_get_rsel(hw, desc, pullup, enable);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:803:10: note: 'pd' declared without an initial value
int pu, pd, rsel, err;
^~
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:805:8: note: Calling 'mtk_hw_get_value'
err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_RSEL, &rsel);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:221:8: note: Calling 'mtk_hw_pin_field_get'
err = mtk_hw_pin_field_get(hw, desc, field, &pf);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:149:6: note: 'field' is >= 0
if (field < 0 || field >= PINCTRL_PIN_REG_MAX) {
^~~~~
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:149:6: note: Left side of '||' is false
vim +462 drivers/bus/mhi/core/boot.c
cd457afb166705 Manivannan Sadhasivam 2020-02-20 434
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 435 static void mhi_fw_load_callback(const struct firmware *firmware, void *context)
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 436 {
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 437 struct mhi_fw_load_callback_ctx *ctx = context;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 438 const char *fw_name = ctx->fw_name;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 439 struct mhi_controller *mhi_cntrl = ctx->mhi_cntrl;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 440 struct device *dev = &mhi_cntrl->mhi_dev->dev;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 441 dma_addr_t dma_addr;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 442 size_t size;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 443 void *buf;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 444 int ret;
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 445
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 446 kfree(context);
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 447
cd457afb166705 Manivannan Sadhasivam 2020-02-20 448 size = (mhi_cntrl->fbc_download) ? mhi_cntrl->sbl_size : firmware->size;
cd457afb166705 Manivannan Sadhasivam 2020-02-20 449
cd457afb166705 Manivannan Sadhasivam 2020-02-20 450 /* SBL size provided is maximum size, not necessarily the image size */
cd457afb166705 Manivannan Sadhasivam 2020-02-20 451 if (size > firmware->size)
cd457afb166705 Manivannan Sadhasivam 2020-02-20 452 size = firmware->size;
cd457afb166705 Manivannan Sadhasivam 2020-02-20 453
2e36190de69cb4 Bhaumik Bhatt 2021-08-02 454 buf = dma_alloc_coherent(mhi_cntrl->cntrl_dev, size, &dma_addr,
2e36190de69cb4 Bhaumik Bhatt 2021-08-02 455 GFP_KERNEL);
cd457afb166705 Manivannan Sadhasivam 2020-02-20 456 if (!buf) {
cd457afb166705 Manivannan Sadhasivam 2020-02-20 457 release_firmware(firmware);
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 458 mhi_fw_load_finish(mhi_cntrl, MHI_FW_ERROR_FW_LOAD);
cd457afb166705 Manivannan Sadhasivam 2020-02-20 459 }
cd457afb166705 Manivannan Sadhasivam 2020-02-20 460
1b55c16a5e4718 Bhaumik Bhatt 2020-11-09 461 /* Download image using BHI */
cd457afb166705 Manivannan Sadhasivam 2020-02-20 @462 memcpy(buf, firmware->data, size);
1b55c16a5e4718 Bhaumik Bhatt 2020-11-09 463 ret = mhi_fw_load_bhi(mhi_cntrl, dma_addr, size);
2e36190de69cb4 Bhaumik Bhatt 2021-08-02 464 dma_free_coherent(mhi_cntrl->cntrl_dev, size, buf, dma_addr);
cd457afb166705 Manivannan Sadhasivam 2020-02-20 465
cd457afb166705 Manivannan Sadhasivam 2020-02-20 466 /* Error or in EDL mode, we're done */
0a895f091ebd94 Bhaumik Bhatt 2020-05-21 467 if (ret) {
1b55c16a5e4718 Bhaumik Bhatt 2020-11-09 468 dev_err(dev, "MHI did not load image over BHI, ret: %d\n", ret);
12e050c77be036 Bhaumik Bhatt 2020-11-09 469 release_firmware(firmware);
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 470 mhi_fw_load_finish(mhi_cntrl, MHI_FW_ERROR_FW_LOAD);
0a895f091ebd94 Bhaumik Bhatt 2020-05-21 471 }
0a895f091ebd94 Bhaumik Bhatt 2020-05-21 472
4f214496ac7421 Bhaumik Bhatt 2021-03-29 473 /* Wait for ready since EDL image was loaded */
418bec695696ab Bhaumik Bhatt 2021-03-29 474 if (fw_name == mhi_cntrl->edl_image) {
12e050c77be036 Bhaumik Bhatt 2020-11-09 475 release_firmware(firmware);
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 476 mhi_fw_load_finish(mhi_cntrl, MHI_FW_LOAD_READY_STATE);
12e050c77be036 Bhaumik Bhatt 2020-11-09 477 }
cd457afb166705 Manivannan Sadhasivam 2020-02-20 478
cd457afb166705 Manivannan Sadhasivam 2020-02-20 479 write_lock_irq(&mhi_cntrl->pm_lock);
cd457afb166705 Manivannan Sadhasivam 2020-02-20 480 mhi_cntrl->dev_state = MHI_STATE_RESET;
cd457afb166705 Manivannan Sadhasivam 2020-02-20 481 write_unlock_irq(&mhi_cntrl->pm_lock);
cd457afb166705 Manivannan Sadhasivam 2020-02-20 482
cd457afb166705 Manivannan Sadhasivam 2020-02-20 483 /*
cd457afb166705 Manivannan Sadhasivam 2020-02-20 484 * If we're doing fbc, populate vector tables while
cd457afb166705 Manivannan Sadhasivam 2020-02-20 485 * device transitioning into MHI READY state
cd457afb166705 Manivannan Sadhasivam 2020-02-20 486 */
cd457afb166705 Manivannan Sadhasivam 2020-02-20 487 if (mhi_cntrl->fbc_download) {
cd457afb166705 Manivannan Sadhasivam 2020-02-20 488 ret = mhi_alloc_bhie_table(mhi_cntrl, &mhi_cntrl->fbc_image,
cd457afb166705 Manivannan Sadhasivam 2020-02-20 489 firmware->size);
12e050c77be036 Bhaumik Bhatt 2020-11-09 490 if (ret) {
12e050c77be036 Bhaumik Bhatt 2020-11-09 491 release_firmware(firmware);
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 492 mhi_fw_load_finish(mhi_cntrl, MHI_FW_ERROR_FW_LOAD);
12e050c77be036 Bhaumik Bhatt 2020-11-09 493 }
cd457afb166705 Manivannan Sadhasivam 2020-02-20 494
cd457afb166705 Manivannan Sadhasivam 2020-02-20 495 /* Load the firmware into BHIE vec table */
cd457afb166705 Manivannan Sadhasivam 2020-02-20 496 mhi_firmware_copy(mhi_cntrl, firmware, mhi_cntrl->fbc_image);
cd457afb166705 Manivannan Sadhasivam 2020-02-20 497 }
cd457afb166705 Manivannan Sadhasivam 2020-02-20 498
12e050c77be036 Bhaumik Bhatt 2020-11-09 499 release_firmware(firmware);
12e050c77be036 Bhaumik Bhatt 2020-11-09 500
bc1fbdf39b0c8e Thomas Weißschuh 2021-12-10 501 mhi_fw_load_finish(mhi_cntrl, MHI_FW_LOAD_READY_STATE);
0a895f091ebd94 Bhaumik Bhatt 2020-05-21 502 }
cd457afb166705 Manivannan Sadhasivam 2020-02-20 503
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-12-16 10:19 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 16:16 [RFC] bus: mhi: core: Load firmware asynchronous Thomas Weißschuh
2021-12-11 3:57 ` kernel test robot
2021-12-14 0:07 ` Hemant Kumar
2021-12-14 6:32 ` Thomas Weißschuh
2021-12-14 22:55 ` Hemant Kumar
2021-12-14 23:28 ` Thomas Weißschuh
2021-12-16 10:19 ` Kalle Valo
2021-12-16 10:19 ` Kalle Valo
2021-12-11 21:54 kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.