wifi: iwlwifi: dbg-tlv: clear FW debug memory on init

JIRA: https://issues.redhat.com/browse/RHEL-2907

commit 93ae81454b1107843ad36dcdc457dd10ee0f2cbe
Author: Johannes Berg <johannes.berg@intel.com>
Date:   Tue Jun 13 15:57:27 2023 +0300

    wifi: iwlwifi: dbg-tlv: clear FW debug memory on init
    
    When we restart the firmware, we shouldn't keep old debug data
    around. Since the "allocate" function might not reallocate the
    memory blocks (they're only freed when we unbind from the device),
    clear the memory to have a clean slate for debug data.
    
    This is a bit more complex since we normally don't enter into
    the allocation function, but duplicating the logic didn't seem
    enticing either, so rework the allocation a bit to always go
    into the individual block allocation, but there clear if it's
    already allocated, rather than allocating again.
    
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230613155501.30b82881cfbf.I39520aff8ac95ee64d39dc5913525a1efd7995fa@changeid
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
This commit is contained in:
Jose Ignacio Tornos Martinez 2023-11-27 15:01:32 +01:00
parent 221c029405
commit 9991a8e331
1 changed files with 24 additions and 13 deletions

View File

@ -586,8 +586,14 @@ static int iwl_dbg_tlv_alloc_fragments(struct iwl_fw_runtime *fwrt,
fw_mon_cfg = &fwrt->trans->dbg.fw_mon_cfg[alloc_id];
fw_mon = &fwrt->trans->dbg.fw_mon_ini[alloc_id];
if (fw_mon->num_frags ||
fw_mon_cfg->buf_location !=
if (fw_mon->num_frags) {
for (i = 0; i < fw_mon->num_frags; i++)
memset(fw_mon->frags[i].block, 0,
fw_mon->frags[i].size);
return 0;
}
if (fw_mon_cfg->buf_location !=
cpu_to_le32(IWL_FW_INI_LOCATION_DRAM_PATH))
return 0;
@ -1272,18 +1278,23 @@ static void iwl_dbg_tlv_init_cfg(struct iwl_fw_runtime *fwrt)
int ret, i;
u32 failed_alloc = 0;
if (*ini_dest != IWL_FW_INI_LOCATION_INVALID)
if (*ini_dest == IWL_FW_INI_LOCATION_INVALID) {
IWL_DEBUG_FW(fwrt,
"WRT: Generating active triggers list, domain 0x%x\n",
fwrt->trans->dbg.domains_bitmap);
for (i = 0; i < ARRAY_SIZE(fwrt->trans->dbg.time_point); i++) {
struct iwl_dbg_tlv_time_point_data *tp =
&fwrt->trans->dbg.time_point[i];
iwl_dbg_tlv_gen_active_trig_list(fwrt, tp);
}
} else if (*ini_dest != IWL_FW_INI_LOCATION_DRAM_PATH) {
/* For DRAM, go through the loop below to clear all the buffers
* properly on restart, otherwise garbage may be left there and
* leak into new debug dumps.
*/
return;
IWL_DEBUG_FW(fwrt,
"WRT: Generating active triggers list, domain 0x%x\n",
fwrt->trans->dbg.domains_bitmap);
for (i = 0; i < ARRAY_SIZE(fwrt->trans->dbg.time_point); i++) {
struct iwl_dbg_tlv_time_point_data *tp =
&fwrt->trans->dbg.time_point[i];
iwl_dbg_tlv_gen_active_trig_list(fwrt, tp);
}
*ini_dest = IWL_FW_INI_LOCATION_INVALID;