Skip to content

Commit

Permalink
iwlwifi: dbg: remove unsupported regions
Browse files Browse the repository at this point in the history
In case user requested to register an unsupported regions,
remove it from active list and trigger list, this saves operational
driver memory and run time at collecting debug data.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210210142629.a0cc944040e8.I3ae37547452b39f8040428c21ed47bdc67ae8f71@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
  • Loading branch information
Mordechay Goodstein authored and Luca Coelho committed Feb 10, 2021
1 parent 1c094e5 commit beb44c0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
6 changes: 4 additions & 2 deletions drivers/net/wireless/intel/iwlwifi/fw/dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2073,7 +2073,8 @@ static u32 iwl_dump_ini_info(struct iwl_fw_runtime *fwrt,
dump->umac_minor = cpu_to_le32(fwrt->dump.fw_ver.umac_minor);

dump->fw_mon_mode = cpu_to_le32(fwrt->trans->dbg.ini_dest);
dump->regions_mask = trigger->regions_mask;
dump->regions_mask = trigger->regions_mask &
~cpu_to_le64(fwrt->trans->dbg.unsupported_region_msk);

dump->build_tag_len = cpu_to_le32(sizeof(dump->build_tag));
memcpy(dump->build_tag, fwrt->fw->human_readable,
Expand Down Expand Up @@ -2202,7 +2203,8 @@ static u32 iwl_dump_ini_trigger(struct iwl_fw_runtime *fwrt,
};
int i;
u32 size = 0;
u64 regions_mask = le64_to_cpu(trigger->regions_mask);
u64 regions_mask = le64_to_cpu(trigger->regions_mask) &
~(fwrt->trans->dbg.unsupported_region_msk);

BUILD_BUG_ON(sizeof(trigger->regions_mask) != sizeof(regions_mask));
BUILD_BUG_ON((sizeof(trigger->regions_mask) * BITS_PER_BYTE) <
Expand Down
36 changes: 35 additions & 1 deletion drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,7 @@ static void iwl_dbg_tlv_init_cfg(struct iwl_fw_runtime *fwrt)
{
enum iwl_fw_ini_buffer_location *ini_dest = &fwrt->trans->dbg.ini_dest;
int ret, i;
u32 failed_alloc = 0;

if (*ini_dest != IWL_FW_INI_LOCATION_INVALID)
return;
Expand Down Expand Up @@ -990,10 +991,43 @@ static void iwl_dbg_tlv_init_cfg(struct iwl_fw_runtime *fwrt)
continue;

ret = iwl_dbg_tlv_alloc_fragments(fwrt, i);
if (ret)

if (ret) {
IWL_WARN(fwrt,
"WRT: Failed to allocate DRAM buffer for allocation id %d, ret=%d\n",
i, ret);
failed_alloc |= BIT(i);
}
}

if (!failed_alloc)
return;

for (i = 0; i < ARRAY_SIZE(fwrt->trans->dbg.active_regions) && failed_alloc; i++) {
struct iwl_fw_ini_region_tlv *reg;
struct iwl_ucode_tlv **active_reg =
&fwrt->trans->dbg.active_regions[i];
u32 reg_type;

if (!*active_reg)
continue;

reg = (void *)(*active_reg)->data;
reg_type = le32_to_cpu(reg->type);

if (reg_type != IWL_FW_INI_REGION_DRAM_BUFFER ||
!(BIT(le32_to_cpu(reg->dram_alloc_id)) & failed_alloc))
continue;

IWL_DEBUG_FW(fwrt,
"WRT: removing allocation id %d from region id %d\n",
le32_to_cpu(reg->dram_alloc_id), i);

failed_alloc &= ~le32_to_cpu(reg->dram_alloc_id);
fwrt->trans->dbg.unsupported_region_msk |= BIT(i);

kfree(*active_reg);
*active_reg = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/intel/iwlwifi/iwl-trans.h
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ struct iwl_trans_debug {
bool hw_error;
enum iwl_fw_ini_buffer_location ini_dest;

u64 unsupported_region_msk;
struct iwl_ucode_tlv *active_regions[IWL_FW_INI_MAX_REGION_ID];
struct list_head debug_info_tlv_list;
struct iwl_dbg_tlv_time_point_data
Expand Down

0 comments on commit beb44c0

Please sign in to comment.