2021-09-14 00:46:32

by Jouni Malinen

[permalink] [raw]
Subject: [PATCH] ath10k: Fix device boot error

From: Abinaya Kalaiselvan <[email protected]>

mask value ATH10K_FW_CRASH_DUMP_RAM_DATA is not mandatory to get iram
mem layout. So introduced ath10k_coredump_get_hw_mem_layout to copy
hardware memory layout.

This fixes the below boot error:
[ 17.468882] ath10k_pci 0000:06:00.0: failed to copy target iram contents: -12
[ 17.513925] ath10k_pci 0000:06:00.0: could not init core (-12)
[ 17.517635] ath10k_pci 0000:06:00.0: could not probe fw (-12)

Tested-on: QCA9984 X86 10.4-3.9.0.2-00139

Fixes: 9af7c32ceca8 ("ath10k: add target IRAM recovery feature support")
Signed-off-by: Abinaya Kalaiselvan <[email protected]>
Signed-off-by: Jouni Malinen <[email protected]>
---
drivers/net/wireless/ath/ath10k/core.c | 2 +-
drivers/net/wireless/ath/ath10k/coredump.c | 11 ++++++++---
drivers/net/wireless/ath/ath10k/coredump.h | 1 +
3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 2f9be182fbfb..cbcf3aa3e92c 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2690,7 +2690,7 @@ static int ath10k_core_copy_target_iram(struct ath10k *ar)
int i, ret;
u32 len, remaining_len;

- hw_mem = ath10k_coredump_get_mem_layout(ar);
+ hw_mem = ath10k_coredump_get_hw_mem_layout(ar);
if (!hw_mem)
return -ENOMEM;

diff --git a/drivers/net/wireless/ath/ath10k/coredump.c b/drivers/net/wireless/ath/ath10k/coredump.c
index 7eb72290a925..f8419a707b89 100644
--- a/drivers/net/wireless/ath/ath10k/coredump.c
+++ b/drivers/net/wireless/ath/ath10k/coredump.c
@@ -1447,11 +1447,17 @@ static u32 ath10k_coredump_get_ramdump_size(struct ath10k *ar)

const struct ath10k_hw_mem_layout *ath10k_coredump_get_mem_layout(struct ath10k *ar)
{
- int i;
-
if (!test_bit(ATH10K_FW_CRASH_DUMP_RAM_DATA, &ath10k_coredump_mask))
return NULL;

+ return ath10k_coredump_get_hw_mem_layout(ar);
+}
+EXPORT_SYMBOL(ath10k_coredump_get_mem_layout);
+
+const struct ath10k_hw_mem_layout *ath10k_coredump_get_hw_mem_layout(struct ath10k *ar)
+{
+ int i;
+
if (WARN_ON(ar->target_version == 0))
return NULL;

@@ -1464,7 +1470,6 @@ const struct ath10k_hw_mem_layout *ath10k_coredump_get_mem_layout(struct ath10k

return NULL;
}
-EXPORT_SYMBOL(ath10k_coredump_get_mem_layout);

struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar)
{
diff --git a/drivers/net/wireless/ath/ath10k/coredump.h b/drivers/net/wireless/ath/ath10k/coredump.h
index 42404e246e0e..7f4849c69ce8 100644
--- a/drivers/net/wireless/ath/ath10k/coredump.h
+++ b/drivers/net/wireless/ath/ath10k/coredump.h
@@ -177,6 +177,7 @@ void ath10k_coredump_unregister(struct ath10k *ar);
void ath10k_coredump_destroy(struct ath10k *ar);

const struct ath10k_hw_mem_layout *ath10k_coredump_get_mem_layout(struct ath10k *ar);
+const struct ath10k_hw_mem_layout *ath10k_coredump_get_hw_mem_layout(struct ath10k *ar);

#else /* CONFIG_DEV_COREDUMP */

--
2.25.1


2021-09-14 03:22:26

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] ath10k: Fix device boot error

Hi Jouni,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on ath6kl/ath-next]
[also build test ERROR on wireless-drivers-next/master wireless-drivers/master v5.15-rc1 next-20210913]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Jouni-Malinen/ath10k-Fix-device-boot-error/20210914-015303
base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next
config: x86_64-randconfig-a013-20210913 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 261cbe98c38f8c1ee1a482fe76511110e790f58a)
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/06d0afd6a0864795a6750173f7959430da2def78
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jouni-Malinen/ath10k-Fix-device-boot-error/20210914-015303
git checkout 06d0afd6a0864795a6750173f7959430da2def78
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All error/warnings (new ones prefixed by >>):

>> drivers/net/wireless/ath/ath10k/core.c:2693:11: error: implicit declaration of function 'ath10k_coredump_get_hw_mem_layout' [-Werror,-Wimplicit-function-declaration]
hw_mem = ath10k_coredump_get_hw_mem_layout(ar);
^
drivers/net/wireless/ath/ath10k/core.c:2693:11: note: did you mean 'ath10k_coredump_get_mem_layout'?
drivers/net/wireless/ath/ath10k/coredump.h:213:1: note: 'ath10k_coredump_get_mem_layout' declared here
ath10k_coredump_get_mem_layout(struct ath10k *ar)
^
>> drivers/net/wireless/ath/ath10k/core.c:2693:9: warning: incompatible integer to pointer conversion assigning to 'const struct ath10k_hw_mem_layout *' from 'int' [-Wint-conversion]
hw_mem = ath10k_coredump_get_hw_mem_layout(ar);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.


vim +/ath10k_coredump_get_hw_mem_layout +2693 drivers/net/wireless/ath/ath10k/core.c

2682
2683 static int ath10k_core_copy_target_iram(struct ath10k *ar)
2684 {
2685 const struct ath10k_hw_mem_layout *hw_mem;
2686 const struct ath10k_mem_region *tmp, *mem_region = NULL;
2687 dma_addr_t paddr;
2688 void *vaddr = NULL;
2689 u8 num_read_itr;
2690 int i, ret;
2691 u32 len, remaining_len;
2692
> 2693 hw_mem = ath10k_coredump_get_hw_mem_layout(ar);
2694 if (!hw_mem)
2695 return -ENOMEM;
2696
2697 for (i = 0; i < hw_mem->region_table.size; i++) {
2698 tmp = &hw_mem->region_table.regions[i];
2699 if (tmp->type == ATH10K_MEM_REGION_TYPE_REG) {
2700 mem_region = tmp;
2701 break;
2702 }
2703 }
2704
2705 if (!mem_region)
2706 return -ENOMEM;
2707
2708 for (i = 0; i < ar->wmi.num_mem_chunks; i++) {
2709 if (ar->wmi.mem_chunks[i].req_id ==
2710 WMI_IRAM_RECOVERY_HOST_MEM_REQ_ID) {
2711 vaddr = ar->wmi.mem_chunks[i].vaddr;
2712 len = ar->wmi.mem_chunks[i].len;
2713 break;
2714 }
2715 }
2716
2717 if (!vaddr || !len) {
2718 ath10k_warn(ar, "No allocated memory for IRAM back up");
2719 return -ENOMEM;
2720 }
2721
2722 len = (len < mem_region->len) ? len : mem_region->len;
2723 paddr = mem_region->start;
2724 num_read_itr = len / TGT_IRAM_READ_PER_ITR;
2725 remaining_len = len % TGT_IRAM_READ_PER_ITR;
2726 for (i = 0; i < num_read_itr; i++) {
2727 ret = ath10k_hif_diag_read(ar, paddr, vaddr,
2728 TGT_IRAM_READ_PER_ITR);
2729 if (ret) {
2730 ath10k_warn(ar, "failed to copy firmware IRAM contents: %d",
2731 ret);
2732 return ret;
2733 }
2734
2735 paddr += TGT_IRAM_READ_PER_ITR;
2736 vaddr += TGT_IRAM_READ_PER_ITR;
2737 }
2738
2739 if (remaining_len) {
2740 ret = ath10k_hif_diag_read(ar, paddr, vaddr, remaining_len);
2741 if (ret) {
2742 ath10k_warn(ar, "failed to copy firmware IRAM contents: %d",
2743 ret);
2744 return ret;
2745 }
2746 }
2747
2748 ath10k_dbg(ar, ATH10K_DBG_BOOT, "target IRAM back up completed\n");
2749
2750 return 0;
2751 }
2752

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (4.75 kB)
.config.gz (45.55 kB)
Download all attachments

2021-10-20 07:55:59

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] ath10k: Fix device boot error

Jouni Malinen <[email protected]> wrote:

> From: Abinaya Kalaiselvan <[email protected]>
>
> mask value ATH10K_FW_CRASH_DUMP_RAM_DATA is not mandatory to get iram
> mem layout. So introduced ath10k_coredump_get_hw_mem_layout to copy
> hardware memory layout.
>
> This fixes the below boot error:
> [ 17.468882] ath10k_pci 0000:06:00.0: failed to copy target iram contents: -12
> [ 17.513925] ath10k_pci 0000:06:00.0: could not init core (-12)
> [ 17.517635] ath10k_pci 0000:06:00.0: could not probe fw (-12)
>
> Tested-on: QCA9984 X86 10.4-3.9.0.2-00139
>
> Fixes: 9af7c32ceca8 ("ath10k: add target IRAM recovery feature support")
> Signed-off-by: Abinaya Kalaiselvan <[email protected]>
> Signed-off-by: Jouni Malinen <[email protected]>
> Reported-by: kernel test robot <[email protected]>

The patch had multiple issues so I sent v2:

https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

Patch set to Changes Requested.

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches