ath10k: detach coredump.c from debug.c
Now coredump is totally separate from debug.c and doesn't depend on CONFIG_ATH10K_DEBUGFS anymore, only on CONFIG_DEV_COREDUMP. Also remove leftovers from the removed debugfs file support. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
This commit is contained in:
@@ -21,7 +21,7 @@ ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o
|
|||||||
ath10k_core-$(CONFIG_THERMAL) += thermal.o
|
ath10k_core-$(CONFIG_THERMAL) += thermal.o
|
||||||
ath10k_core-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o
|
ath10k_core-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o
|
||||||
ath10k_core-$(CONFIG_PM) += wow.o
|
ath10k_core-$(CONFIG_PM) += wow.o
|
||||||
ath10k_core-$(CONFIG_ATH10K_DEBUGFS) += coredump.o
|
ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o
|
||||||
|
|
||||||
obj-$(CONFIG_ATH10K_PCI) += ath10k_pci.o
|
obj-$(CONFIG_ATH10K_PCI) += ath10k_pci.o
|
||||||
ath10k_pci-y += pci.o \
|
ath10k_pci-y += pci.o \
|
||||||
|
@@ -2735,12 +2735,19 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
|
|||||||
|
|
||||||
init_dummy_netdev(&ar->napi_dev);
|
init_dummy_netdev(&ar->napi_dev);
|
||||||
|
|
||||||
ret = ath10k_debug_create(ar);
|
ret = ath10k_coredump_create(ar);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_free_aux_wq;
|
goto err_free_aux_wq;
|
||||||
|
|
||||||
|
ret = ath10k_debug_create(ar);
|
||||||
|
if (ret)
|
||||||
|
goto err_free_coredump;
|
||||||
|
|
||||||
return ar;
|
return ar;
|
||||||
|
|
||||||
|
err_free_coredump:
|
||||||
|
ath10k_coredump_destroy(ar);
|
||||||
|
|
||||||
err_free_aux_wq:
|
err_free_aux_wq:
|
||||||
destroy_workqueue(ar->workqueue_aux);
|
destroy_workqueue(ar->workqueue_aux);
|
||||||
err_free_wq:
|
err_free_wq:
|
||||||
@@ -2762,6 +2769,7 @@ void ath10k_core_destroy(struct ath10k *ar)
|
|||||||
destroy_workqueue(ar->workqueue_aux);
|
destroy_workqueue(ar->workqueue_aux);
|
||||||
|
|
||||||
ath10k_debug_destroy(ar);
|
ath10k_debug_destroy(ar);
|
||||||
|
ath10k_coredump_destroy(ar);
|
||||||
ath10k_htt_tx_destroy(&ar->htt);
|
ath10k_htt_tx_destroy(&ar->htt);
|
||||||
ath10k_wmi_free_host_mem(ar);
|
ath10k_wmi_free_host_mem(ar);
|
||||||
ath10k_mac_destroy(ar);
|
ath10k_mac_destroy(ar);
|
||||||
|
@@ -462,8 +462,6 @@ struct ath10k_ce_crash_hdr {
|
|||||||
|
|
||||||
/* used for crash-dump storage, protected by data-lock */
|
/* used for crash-dump storage, protected by data-lock */
|
||||||
struct ath10k_fw_crash_data {
|
struct ath10k_fw_crash_data {
|
||||||
bool crashed_since_read;
|
|
||||||
|
|
||||||
guid_t guid;
|
guid_t guid;
|
||||||
struct timespec64 timestamp;
|
struct timespec64 timestamp;
|
||||||
__le32 registers[REG_DUMP_COUNT_QCA988X];
|
__le32 registers[REG_DUMP_COUNT_QCA988X];
|
||||||
@@ -493,8 +491,6 @@ struct ath10k_debug {
|
|||||||
u32 reg_addr;
|
u32 reg_addr;
|
||||||
u32 nf_cal_period;
|
u32 nf_cal_period;
|
||||||
void *cal_data;
|
void *cal_data;
|
||||||
|
|
||||||
struct ath10k_fw_crash_data *fw_crash_data;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ath10k_state {
|
enum ath10k_state {
|
||||||
@@ -971,6 +967,13 @@ struct ath10k {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
u32 pktlog_filter;
|
u32 pktlog_filter;
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEV_COREDUMP
|
||||||
|
struct {
|
||||||
|
struct ath10k_fw_crash_data *fw_crash_data;
|
||||||
|
} coredump;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
/* protected by conf_mutex */
|
/* protected by conf_mutex */
|
||||||
struct ath10k_fw_components utf_mode_fw;
|
struct ath10k_fw_components utf_mode_fw;
|
||||||
|
@@ -21,15 +21,12 @@
|
|||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
#ifdef CONFIG_DEV_COREDUMP
|
|
||||||
|
|
||||||
struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar)
|
struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar)
|
||||||
{
|
{
|
||||||
struct ath10k_fw_crash_data *crash_data = ar->debug.fw_crash_data;
|
struct ath10k_fw_crash_data *crash_data = ar->coredump.fw_crash_data;
|
||||||
|
|
||||||
lockdep_assert_held(&ar->data_lock);
|
lockdep_assert_held(&ar->data_lock);
|
||||||
|
|
||||||
crash_data->crashed_since_read = true;
|
|
||||||
guid_gen(&crash_data->guid);
|
guid_gen(&crash_data->guid);
|
||||||
ktime_get_real_ts64(&crash_data->timestamp);
|
ktime_get_real_ts64(&crash_data->timestamp);
|
||||||
|
|
||||||
@@ -37,10 +34,9 @@ struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ath10k_coredump_new);
|
EXPORT_SYMBOL(ath10k_coredump_new);
|
||||||
|
|
||||||
static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar,
|
static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar)
|
||||||
bool mark_read)
|
|
||||||
{
|
{
|
||||||
struct ath10k_fw_crash_data *crash_data = ar->debug.fw_crash_data;
|
struct ath10k_fw_crash_data *crash_data = ar->coredump.fw_crash_data;
|
||||||
struct ath10k_ce_crash_hdr *ce_hdr;
|
struct ath10k_ce_crash_hdr *ce_hdr;
|
||||||
struct ath10k_dump_file_data *dump_data;
|
struct ath10k_dump_file_data *dump_data;
|
||||||
struct ath10k_tlv_dump_data *dump_tlv;
|
struct ath10k_tlv_dump_data *dump_tlv;
|
||||||
@@ -64,12 +60,6 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar,
|
|||||||
|
|
||||||
spin_lock_bh(&ar->data_lock);
|
spin_lock_bh(&ar->data_lock);
|
||||||
|
|
||||||
if (!crash_data->crashed_since_read) {
|
|
||||||
spin_unlock_bh(&ar->data_lock);
|
|
||||||
vfree(buf);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
dump_data = (struct ath10k_dump_file_data *)(buf);
|
dump_data = (struct ath10k_dump_file_data *)(buf);
|
||||||
strlcpy(dump_data->df_magic, "ATH10K-FW-DUMP",
|
strlcpy(dump_data->df_magic, "ATH10K-FW-DUMP",
|
||||||
sizeof(dump_data->df_magic));
|
sizeof(dump_data->df_magic));
|
||||||
@@ -122,8 +112,6 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar,
|
|||||||
sofar += sizeof(*dump_tlv) + sizeof(*ce_hdr) +
|
sofar += sizeof(*dump_tlv) + sizeof(*ce_hdr) +
|
||||||
CE_COUNT * sizeof(ce_hdr->entries[0]);
|
CE_COUNT * sizeof(ce_hdr->entries[0]);
|
||||||
|
|
||||||
ar->debug.fw_crash_data->crashed_since_read = !mark_read;
|
|
||||||
|
|
||||||
spin_unlock_bh(&ar->data_lock);
|
spin_unlock_bh(&ar->data_lock);
|
||||||
|
|
||||||
return dump_data;
|
return dump_data;
|
||||||
@@ -132,34 +120,29 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar,
|
|||||||
int ath10k_coredump_submit(struct ath10k *ar)
|
int ath10k_coredump_submit(struct ath10k *ar)
|
||||||
{
|
{
|
||||||
struct ath10k_dump_file_data *dump;
|
struct ath10k_dump_file_data *dump;
|
||||||
void *dump_ptr;
|
|
||||||
u32 dump_len;
|
|
||||||
|
|
||||||
/* To keep the dump file available also for debugfs don't mark the
|
dump = ath10k_coredump_build(ar);
|
||||||
* file read, only debugfs should do that.
|
|
||||||
*/
|
|
||||||
dump = ath10k_coredump_build(ar, false);
|
|
||||||
if (!dump) {
|
if (!dump) {
|
||||||
ath10k_warn(ar, "no crash dump data found for devcoredump");
|
ath10k_warn(ar, "no crash dump data found for devcoredump");
|
||||||
return -ENODATA;
|
return -ENODATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make a copy of the dump file for dev_coredumpv() as during the
|
dev_coredumpv(ar->dev, dump, le32_to_cpu(dump->len), GFP_KERNEL);
|
||||||
* transition period we need to own the original file. Once
|
|
||||||
* fw_crash_dump debugfs file is removed no need to have a copy
|
|
||||||
* anymore.
|
|
||||||
*/
|
|
||||||
dump_len = le32_to_cpu(dump->len);
|
|
||||||
dump_ptr = vzalloc(dump_len);
|
|
||||||
|
|
||||||
if (!dump_ptr)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
memcpy(dump_ptr, dump, dump_len);
|
|
||||||
|
|
||||||
dev_coredumpv(ar->dev, dump_ptr, dump_len, GFP_KERNEL);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_DEV_COREDUMP */
|
int ath10k_coredump_create(struct ath10k *ar)
|
||||||
|
{
|
||||||
|
ar->coredump.fw_crash_data = vzalloc(sizeof(*ar->coredump.fw_crash_data));
|
||||||
|
if (!ar->coredump.fw_crash_data)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ath10k_coredump_destroy(struct ath10k *ar)
|
||||||
|
{
|
||||||
|
vfree(ar->coredump.fw_crash_data);
|
||||||
|
ar->coredump.fw_crash_data = NULL;
|
||||||
|
}
|
||||||
|
@@ -103,6 +103,8 @@ struct ath10k_dump_file_data {
|
|||||||
|
|
||||||
int ath10k_coredump_submit(struct ath10k *ar);
|
int ath10k_coredump_submit(struct ath10k *ar);
|
||||||
struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar);
|
struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar);
|
||||||
|
int ath10k_coredump_create(struct ath10k *ar);
|
||||||
|
void ath10k_coredump_destroy(struct ath10k *ar);
|
||||||
|
|
||||||
#else /* CONFIG_DEV_COREDUMP */
|
#else /* CONFIG_DEV_COREDUMP */
|
||||||
|
|
||||||
@@ -116,6 +118,15 @@ static inline struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int ath10k_coredump_create(struct ath10k *ar)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void ath10k_coredump_destroy(struct ath10k *ar)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_DEV_COREDUMP */
|
#endif /* CONFIG_DEV_COREDUMP */
|
||||||
|
|
||||||
#endif /* _COREDUMP_H_ */
|
#endif /* _COREDUMP_H_ */
|
||||||
|
@@ -2137,10 +2137,6 @@ static const struct file_operations fops_fw_checksums = {
|
|||||||
|
|
||||||
int ath10k_debug_create(struct ath10k *ar)
|
int ath10k_debug_create(struct ath10k *ar)
|
||||||
{
|
{
|
||||||
ar->debug.fw_crash_data = vzalloc(sizeof(*ar->debug.fw_crash_data));
|
|
||||||
if (!ar->debug.fw_crash_data)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
ar->debug.cal_data = vzalloc(ATH10K_DEBUG_CAL_DATA_LEN);
|
ar->debug.cal_data = vzalloc(ATH10K_DEBUG_CAL_DATA_LEN);
|
||||||
if (!ar->debug.cal_data)
|
if (!ar->debug.cal_data)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@@ -2155,9 +2151,6 @@ int ath10k_debug_create(struct ath10k *ar)
|
|||||||
|
|
||||||
void ath10k_debug_destroy(struct ath10k *ar)
|
void ath10k_debug_destroy(struct ath10k *ar)
|
||||||
{
|
{
|
||||||
vfree(ar->debug.fw_crash_data);
|
|
||||||
ar->debug.fw_crash_data = NULL;
|
|
||||||
|
|
||||||
vfree(ar->debug.cal_data);
|
vfree(ar->debug.cal_data);
|
||||||
ar->debug.cal_data = NULL;
|
ar->debug.cal_data = NULL;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user