Commit9af7c32cec
("ath10k: add target IRAM recovery feature support") introduced a new firmware feature flag ATH10K_FW_FEATURE_IRAM_RECOVERY. But this caused ath10k_pci module load to fail if ATH10K_FW_CRASH_DUMP_RAM_DATA bit was not enabled in the ath10k coredump_mask module parameter: [ 2209.328190] ath10k_pci 0000:02:00.0: qca9984/qca9994 hw1.0 target 0x01000000 chip_id 0x00000000 sub 168c:cafe [ 2209.434414] ath10k_pci 0000:02:00.0: kconfig debug 1 debugfs 1 tracing 1 dfs 1 testmode 1 [ 2209.547191] ath10k_pci 0000:02:00.0: firmware ver 10.4-3.9.0.2-00099 api 5 features no-p2p,mfp,peer-flow-ctrl,btcoex-param,allows-mesh-bcast,no-ps,peer-fixed-rate,iram-recovery crc32 cbade90a [ 2210.896485] ath10k_pci 0000:02:00.0: board_file api 1 bmi_id 0:1 crc32 a040efc2 [ 2213.603339] ath10k_pci 0000:02:00.0: failed to copy target iram contents: -12 [ 2213.839027] ath10k_pci 0000:02:00.0: could not init core (-12) [ 2213.933910] ath10k_pci 0000:02:00.0: could not probe fw (-12) And by default coredump_mask does not have ATH10K_FW_CRASH_DUMP_RAM_DATA enabled so anyone using a firmware with iram-recovery feature would fail. To my knowledge only QCA9984 firmwares starting from release 10.4-3.9.0.2-00099 enabled the feature. The reason for regression was that ath10k_core_copy_target_iram() used ath10k_coredump_get_mem_layout() to get the memory layout, but when ATH10K_FW_CRASH_DUMP_RAM_DATA was disabled it would get just NULL and bail out with an error. While looking at all this I noticed another bug: if CONFIG_DEV_COREDUMP is disabled but the firmware has iram-recovery enabled the module load fails with similar error messages. I fixed that by returning 0 from ath10k_core_copy_target_iram() when _ath10k_coredump_get_mem_layout() returns NULL. Tested-on: QCA9984 hw2.0 PCI 10.4-3.9.0.2-00139 Fixes:9af7c32cec
("ath10k: add target IRAM recovery feature support") Signed-off-by: Abinaya Kalaiselvan <akalaise@codeaurora.org> Signed-off-by: Jouni Malinen <jouni@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20211020075054.23061-1-kvalo@codeaurora.org
226 lines
5 KiB
C
226 lines
5 KiB
C
/* SPDX-License-Identifier: ISC */
|
|
/*
|
|
* Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
|
|
*/
|
|
|
|
#ifndef _COREDUMP_H_
|
|
#define _COREDUMP_H_
|
|
|
|
#include "core.h"
|
|
|
|
#define ATH10K_FW_CRASH_DUMP_VERSION 1
|
|
|
|
/**
|
|
* enum ath10k_fw_crash_dump_type - types of data in the dump file
|
|
* @ATH10K_FW_CRASH_DUMP_REGDUMP: Register crash dump in binary format
|
|
*/
|
|
enum ath10k_fw_crash_dump_type {
|
|
ATH10K_FW_CRASH_DUMP_REGISTERS = 0,
|
|
ATH10K_FW_CRASH_DUMP_CE_DATA = 1,
|
|
|
|
/* contains multiple struct ath10k_dump_ram_data_hdr */
|
|
ATH10K_FW_CRASH_DUMP_RAM_DATA = 2,
|
|
|
|
ATH10K_FW_CRASH_DUMP_MAX,
|
|
};
|
|
|
|
struct ath10k_tlv_dump_data {
|
|
/* see ath10k_fw_crash_dump_type above */
|
|
__le32 type;
|
|
|
|
/* in bytes */
|
|
__le32 tlv_len;
|
|
|
|
/* pad to 32-bit boundaries as needed */
|
|
u8 tlv_data[];
|
|
} __packed;
|
|
|
|
struct ath10k_dump_file_data {
|
|
/* dump file information */
|
|
|
|
/* "ATH10K-FW-DUMP" */
|
|
char df_magic[16];
|
|
|
|
__le32 len;
|
|
|
|
/* file dump version */
|
|
__le32 version;
|
|
|
|
/* some info we can get from ath10k struct that might help */
|
|
|
|
guid_t guid;
|
|
|
|
__le32 chip_id;
|
|
|
|
/* 0 for now, in place for later hardware */
|
|
__le32 bus_type;
|
|
|
|
__le32 target_version;
|
|
__le32 fw_version_major;
|
|
__le32 fw_version_minor;
|
|
__le32 fw_version_release;
|
|
__le32 fw_version_build;
|
|
__le32 phy_capability;
|
|
__le32 hw_min_tx_power;
|
|
__le32 hw_max_tx_power;
|
|
__le32 ht_cap_info;
|
|
__le32 vht_cap_info;
|
|
__le32 num_rf_chains;
|
|
|
|
/* firmware version string */
|
|
char fw_ver[ETHTOOL_FWVERS_LEN];
|
|
|
|
/* Kernel related information */
|
|
|
|
/* time-of-day stamp */
|
|
__le64 tv_sec;
|
|
|
|
/* time-of-day stamp, nano-seconds */
|
|
__le64 tv_nsec;
|
|
|
|
/* LINUX_VERSION_CODE */
|
|
__le32 kernel_ver_code;
|
|
|
|
/* VERMAGIC_STRING */
|
|
char kernel_ver[64];
|
|
|
|
/* room for growth w/out changing binary format */
|
|
u8 unused[128];
|
|
|
|
/* struct ath10k_tlv_dump_data + more */
|
|
u8 data[];
|
|
} __packed;
|
|
|
|
struct ath10k_dump_ram_data_hdr {
|
|
/* enum ath10k_mem_region_type */
|
|
__le32 region_type;
|
|
|
|
__le32 start;
|
|
|
|
/* length of payload data, not including this header */
|
|
__le32 length;
|
|
|
|
u8 data[];
|
|
};
|
|
|
|
/* magic number to fill the holes not copied due to sections in regions */
|
|
#define ATH10K_MAGIC_NOT_COPIED 0xAA
|
|
|
|
/* part of user space ABI */
|
|
enum ath10k_mem_region_type {
|
|
ATH10K_MEM_REGION_TYPE_REG = 1,
|
|
ATH10K_MEM_REGION_TYPE_DRAM = 2,
|
|
ATH10K_MEM_REGION_TYPE_AXI = 3,
|
|
ATH10K_MEM_REGION_TYPE_IRAM1 = 4,
|
|
ATH10K_MEM_REGION_TYPE_IRAM2 = 5,
|
|
ATH10K_MEM_REGION_TYPE_IOSRAM = 6,
|
|
ATH10K_MEM_REGION_TYPE_IOREG = 7,
|
|
ATH10K_MEM_REGION_TYPE_MSA = 8,
|
|
};
|
|
|
|
/* Define a section of the region which should be copied. As not all parts
|
|
* of the memory is possible to copy, for example some of the registers can
|
|
* be like that, sections can be used to define what is safe to copy.
|
|
*
|
|
* To minimize the size of the array, the list must obey the format:
|
|
* '{start0,stop0},{start1,stop1},{start2,stop2}....' The values below must
|
|
* also obey to 'start0 < stop0 < start1 < stop1 < start2 < ...', otherwise
|
|
* we may encouter error in the dump processing.
|
|
*/
|
|
struct ath10k_mem_section {
|
|
u32 start;
|
|
u32 end;
|
|
};
|
|
|
|
/* One region of a memory layout. If the sections field is null entire
|
|
* region is copied. If sections is non-null only the areas specified in
|
|
* sections are copied and rest of the areas are filled with
|
|
* ATH10K_MAGIC_NOT_COPIED.
|
|
*/
|
|
struct ath10k_mem_region {
|
|
enum ath10k_mem_region_type type;
|
|
u32 start;
|
|
u32 len;
|
|
|
|
const char *name;
|
|
|
|
struct {
|
|
const struct ath10k_mem_section *sections;
|
|
u32 size;
|
|
} section_table;
|
|
};
|
|
|
|
/* Contains the memory layout of a hardware version identified with the
|
|
* hardware id, split into regions.
|
|
*/
|
|
struct ath10k_hw_mem_layout {
|
|
u32 hw_id;
|
|
u32 hw_rev;
|
|
enum ath10k_bus bus;
|
|
|
|
struct {
|
|
const struct ath10k_mem_region *regions;
|
|
int size;
|
|
} region_table;
|
|
};
|
|
|
|
/* FIXME: where to put this? */
|
|
extern unsigned long ath10k_coredump_mask;
|
|
|
|
#ifdef CONFIG_DEV_COREDUMP
|
|
|
|
int ath10k_coredump_submit(struct ath10k *ar);
|
|
struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar);
|
|
int ath10k_coredump_create(struct ath10k *ar);
|
|
int ath10k_coredump_register(struct ath10k *ar);
|
|
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_mem_layout(struct ath10k *ar);
|
|
|
|
#else /* CONFIG_DEV_COREDUMP */
|
|
|
|
static inline int ath10k_coredump_submit(struct ath10k *ar)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline int ath10k_coredump_create(struct ath10k *ar)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int ath10k_coredump_register(struct ath10k *ar)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void ath10k_coredump_unregister(struct ath10k *ar)
|
|
{
|
|
}
|
|
|
|
static inline void ath10k_coredump_destroy(struct ath10k *ar)
|
|
{
|
|
}
|
|
|
|
static inline const struct ath10k_hw_mem_layout *
|
|
ath10k_coredump_get_mem_layout(struct ath10k *ar)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline const struct ath10k_hw_mem_layout *
|
|
_ath10k_coredump_get_mem_layout(struct ath10k *ar)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
#endif /* CONFIG_DEV_COREDUMP */
|
|
|
|
#endif /* _COREDUMP_H_ */
|