History log of /linux-master/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
Revision Date Author Comments
# 045a5b64 19-Mar-2024 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: fw: don't always use FW dump trig

Since the dump_data (struct iwl_fwrt_dump_data) is a union,
it's not safe to unconditionally access and use the 'trig'
member, it might be 'desc' instead. Access it only if it's
known to be 'trig' rather than 'desc', i.e. if ini-debug
is present.

Cc: stable@vger.kernel.org
Fixes: 0eb50c674a1e ("iwlwifi: yoyo: send hcmd to fw after dump collection completes.")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240319100755.e2976bc58b29.I72fbd6135b3623227de53d8a2bb82776066cb72b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 318b3fac 04-Feb-2024 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: use system_unbound_wq for debug dump

This can take some time, so it's better to use the unbound
workqueue.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240204235836.75c8d2286f81.I478e9faf422f22ae66c0a113003fea83565c5692@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# ec06e9b9 27-Jan-2024 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: fw: dbg: ensure correct config name sizes

This hard-codes the size, but it's not obvious why that's
correct. Use sizeof() and cross-check the two structs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240128084842.58fcdea2ace7.I49cb1d7bdbea12085aada0c96ef42fcbcb3d2b38@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 8a41c017 27-Jan-2024 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: fix some kernel-doc issues

Add return descriptions, move description contents after
(parameter) sections and fix short descriptions.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240128084842.02ac00f67239.I4ad17097badfcbb82ccdb8c126f61a6f3170798e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# aa125f22 28-Jan-2024 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: remove extra kernel-doc

This no longer exists, remove the kernel-doc.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240128102209.d2192d79bc09.Id9551728d618248dd471382a5283503a8976237a@changeid


# 6f3afc6c 19-Dec-2023 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

wifi: iwlwifi: mvm: use the new command to clear the internal buffer

The firmware can allow to clear the internal debug buffer. This can be
used to sanitize the data when requested to.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231219215605.99aed3efbacb.Ib5bda1d1ff4bae476667737d4081ad066d1d7e6b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 268712dc 06-Dec-2023 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

wifi: iwlwifi: mvm: add a debugfs hook to clear the monitor data

This can be used by the user space when it wants to clear the data we
collected so far for privacy reasons.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231207044813.d5e97d5ec0d9.I7a5e836e6109e1fce7e6301dba8d1f28e60a5440@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 70582e26 19-Oct-2023 Justin Stitt <justinstitt@google.com>

wifi: iwlwifi: fw: replace deprecated strncpy with strscpy_pad

strncpy() is deprecated for use on NUL-terminated destination strings
[1] and as such we should prefer more robust and less ambiguous string
interfaces.

Based on the deliberate `sizeof(dest) ... - 1` pattern we can see that
both dump_info->dev_human_readable and dump_info->bus_human_readable are
intended to be NUL-terminated.

Moreover, since this seems to cross the file boundary let's NUL-pad to
ensure no behavior change.

strscpy_pad() covers both the NUL-termination and NUL-padding, let's use
it.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231019-strncpy-drivers-net-wireless-intel-iwlwifi-fw-dbg-c-v2-1-179b211a374b@google.com


# a634386c 16-Oct-2023 Daniel Gabay <daniel.gabay@intel.com>

wifi: iwlwifi: add support for SNPS DPHYIP region type

Add the required logic for parsing and dumping this new region.

Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231017115047.c859539194e7.I965482de2871e28b09f4572f1aa87ae4e3b366be@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 66125c42 03-Oct-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: add support for new ini region types

YoYo introduces 2 new region types: prph mac and phy blocks.
The data in this regions consists of a list of
(base address, size) pairs.
This way we can set a block of consecutive registers by the
base address and the size, instead of a list of registers.
Add support for parsing and dumping these new region types

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231004123422.0a10320f4259.I680ef6e16267d95329ee239f05d0999f5a1719ac@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 440a561c 03-Oct-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: Extract common prph mac/phy regions data dump logic

YoYo (debug data collection mechanism) is introducing 2 new types
of regions: prph mac/phy ranges.
These types will have a common logic of reading the data from the
device as the mac/phy prph has. Put it in a separate function so it can
be reused.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20231004123422.16f06414c65c.Ie911bc83a1e2f8fddb27b4c5bd24f933f8b674b6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# fc2fe0a5 13-Sep-2023 Gregory Greenman <gregory.greenman@intel.com>

wifi: iwlwifi: fw: disable firmware debug asserts

Disable firmware debug asserts, which are used for internal
firmware testing purposes only.

Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230913145231.8feafd9b17be.Ia7bec82ac25897caab581692d67055aa1aca2ed2@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# eeef0168 20-Jun-2023 Miri Korenblit <miriam.rachel.korenblit@intel.com>

wifi: iwlwifi: fw: send marker cmd before suspend cmd

This is needed to sync the times in the FW and driver logs

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230620125813.9c84322c41b5.Id13816b3ece103f88514a7523b22bb2b9dcc8ab7@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# d4f1a50c 12-Jun-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: unify checks for HW error values

The hardware, depending on which part fails or times out,
returns 0xA5A5A5A. or 0x5A5A5A5. with the lowest 4 bits
encoding some further reason/status. However, mostly we
don't really need to care about the exact reasons, so
unify the checks for this to avoid hardcoding those magic
values all over the driver.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230612184434.3e2959741a38.I1c297a53787b87e4e2b8f296c041921338573f4d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 4784f3f9 31-May-2023 Mukesh Sisodiya <mukesh.sisodiya@intel.com>

wifi: iwlwifi: remove dead code in iwl_dump_ini_imr_get_size()

Remove the check for the IMR debug data size which
leads to dead code.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230531194630.58eec8d40729.Ifb7d64706eed45726db804f36e785283dff7adab@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# d3ae6918 13-May-2023 Johannes Berg <johannes.berg@intel.com>

wifi: iwlwifi: fw: fix DBGI dump

The DBGI dump is (unsurprisingly) of type DBGI, not SRAM.
This leads to bad register accesses because the union is
built differently, there's no allocation ID, and thus the
allocation ID ends up being 0x8000.

Note that this was already wrong for DRAM vs. SMEM since
they use different parts of the union, but the allocation
ID is at the same place, so it worked.

Fix all of this but set the allocation ID in a way that
the offset calculation ends up without any offset.

Fixes: 34bc27783a31 ("iwlwifi: yoyo: fix DBGI_SRAM ini dump header.")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230514120631.19a302ae4c65.I12272599f7c1930666157b9d5e7f81fe9ec4c421@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 8ce437dd 14-Apr-2023 Tom Rix <trix@redhat.com>

wifi: iwlwifi: fw: move memset before early return

Clang static analysis reports this representative issue
dbg.c:1455:6: warning: Branch condition evaluates to
a garbage value
if (!rxf_data.size)
^~~~~~~~~~~~~~

This check depends on iwl_ini_get_rxf_data() to clear
rxf_data but the function can return early without
doing the clear. So move the memset before the early
return.

Fixes: cc9b6012d34b ("iwlwifi: yoyo: use hweight_long instead of bit manipulating")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230414130637.872a7175f1ff.I33802a77a91998276992b088fbe25f61c87c33ac@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 11195ab0 13-Apr-2023 Daniel Gabay <daniel.gabay@intel.com>

wifi: iwlwifi: yoyo: skip dump correctly on hw error

When NIC is in a bad state, reading data will return 28 bits as
0xa5a5a5a and the lowest 4 bits are not fixed value.

Mask these bits in a few places to skip the dump correctly.

Fixes: 89639e06d0f3 ("iwlwifi: yoyo: support for new DBGI_SRAM region")
Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230413213309.df6c0663179d.I36d8487b2419c6fefa65e5514855d94327c3b1eb@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 74aae250 13-Apr-2023 Mukesh Sisodiya <mukesh.sisodiya@intel.com>

wifi: iwlwifi: Fix the duplicate dump name

Driver is using the dump name generated first time in all
generated dump in case of NMI.
The validity of dump name should be with each dump created
and need to reset after each use.

Fixes: 834f920ef34b ("wifi: iwlwifi: yoyo: Add driver defined dump file name")
Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230413213309.6c987f820557.I924f2eae1eef2fe82c7a23be566551653d46f729@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 51fa8c02 14-Mar-2023 Mukesh Sisodiya <mukesh.sisodiya@intel.com>

wifi: iwlwifi: yoyo: Add new tlv for dump file name extension

Add tlv in dump file for dump file name extension.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Greenman, Gregory <gregory.greenman@intel.com>
Link: https://lore.kernel.org/r/20230314194113.ffc28212994e.Ie5f10709548497061f95c1634d942dd2facf72ec@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# 38a523a2 27-Jun-2022 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Revert "devcoredump: remove the useless gfp_t parameter in dev_coredumpv and dev_coredumpm"

This reverts commit 77515ebaf01920e2db49e04672ef669a7c2907f2 as it
causes build problems in linux-next. It needs to be reintroduced in a
way that can allow the api to evolve and not require a "flag day" to
catch all users.

Link: https://lore.kernel.org/r/20220623160723.7a44b573@canb.auug.org.au
Cc: Duoming Zhou <duoming@zju.edu.cn>
Cc: Brian Norris <briannorris@chromium.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 77515eba 06-Jun-2022 Duoming Zhou <duoming@zju.edu.cn>

devcoredump: remove the useless gfp_t parameter in dev_coredumpv and dev_coredumpm

The dev_coredumpv() and dev_coredumpm() could not be used in atomic
context, because they call kvasprintf_const() and kstrdup() with
GFP_KERNEL parameter. The process is shown below:

dev_coredumpv(.., gfp_t gfp)
dev_coredumpm(.., gfp_t gfp)
dev_set_name
kobject_set_name_vargs
kvasprintf_const(GFP_KERNEL, ...); //may sleep
kstrdup(s, GFP_KERNEL); //may sleep

This patch removes gfp_t parameter of dev_coredumpv() and dev_coredumpm()
and changes the gfp_t parameter of kzalloc() in dev_coredumpm() to
GFP_KERNEL in order to show they could not be used in atomic context.

Fixes: 833c95456a70 ("device coredump: add new device coredump class")
Reviewed-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/df72af3b1862bac7d8e793d1f3931857d3779dfd.1654569290.git.duoming@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 97374513 04-Mar-2022 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: dbg: check trigger data before access

Without trigger data set, no point in any collection.
so check that we have the info for collecting the 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.20220304131517.5fb34fb1f0eb.I4d7f2a4d162e80474540c5caf1194ed7d32977bc@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f0c16338 04-Mar-2022 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: dbg: in sync mode don't call schedule

Today in the code we have two options for collecting data sync/schedule,
the two options call the same function and can lead to racing in free
resources after done.

So we call only one of two sync/schedule, and in case of sync only
call sync function without also schedule to immediately run as a side
job.

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.20220304131517.88574097ce1b.I1b42297619d638d677a2300ed9a95105c1262101@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# a6d21729 04-Mar-2022 Mukesh Sisodiya <mukesh.sisodiya@intel.com>

iwlwifi: yoyo: dump IMR DRAM only for HW and FW error

Support debug collection of the platform IMR memory region
only for HW and FW error. This region needs to be collected
as the last region.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220304131517.5b70e5ba9a41.I502f9b6179b97b163992729edd2b3c5c4ca9e311@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 1132f6de 15-Feb-2022 Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>

iwlwifi/fw: use struct_size over open coded arithmetic

Replace zero-length array with flexible-array member and make use
of the struct_size() helper in kzalloc().

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
Link: https://lore.kernel.org/r/20220216030841.1839666-1-chi.minghao@zte.com.cn
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 990c2742 08-Feb-2022 Cai Huoqing <cai.huoqing@linux.dev>

iwlwifi: Make use of the helper macro LIST_HEAD()

Replace "struct list_head head = LIST_HEAD_INIT(head)" with
"LIST_HEAD(head)" to simplify the code.

Signed-off-by: Cai Huoqing <cai.huoqing@linux.dev>
Link: https://lore.kernel.org/r/20220209032322.37472-1-cai.huoqing@linux.dev
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 0eb50c67 10-Feb-2022 Mukesh Sisodiya <mukesh.sisodiya@intel.com>

iwlwifi: yoyo: send hcmd to fw after dump collection completes.

Send a command to FW once the driver completes the dump collection
for the timepoint which requires the command to be send.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220210181930.b8c1228a0c0a.I71da6a799253650f3d0b181315de388cb9360e30@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 9d200edd 10-Feb-2022 Mukesh Sisodiya <mukesh.sisodiya@intel.com>

iwlwifi: yoyo: support dump policy for the dump size

Support dump size limitation based on the TLV by firmware.
This is needed for limited memory systems so only the most
important dumps are sent by driver.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220210181930.d7e1ff264766.If2327fd890a453cdc9069d26220394d0b4e79743@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 86371b73 03-Feb-2022 Johannes Berg <johannes.berg@intel.com>

iwlwifi: remove unused macros

Found with W=2, remove unused macros in C files. In one case
move the macro under the corresponding ifdef.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220204122220.068c6052689b.Idbb7a87c2fd93619c1765c7f4ed15190c3fef2a7@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f5cdcb86 30-Jan-2022 Johannes Berg <johannes.berg@intel.com>

iwlwifi: fw: make dump_start callback void

We never return errors there, so just make it void.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220130115024.375b3a28d89e.Ia76e9bf13e26eb148abfebdaf859eab1b81d2af1@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# ce014c98 29-Jan-2022 Rotem Saado <rotem.saado@intel.com>

iwlwifi: yoyo: remove DBGI_SRAM address reset writing

Due to preg protection we cannot write to this register
while FW is running (when FW in Halt it is ok).
since we have some cases that we need to dump this
region while FW is running remove this writing from DRV.
FW will do this writing.

Signed-off-by: Rotem Saado <rotem.saado@intel.com>
Fixes: 89639e06d0f3 ("iwlwifi: yoyo: support for new DBGI_SRAM region")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220129105618.209f3078bc74.I463530bd2f40daedb39f6d9df987bb7cee209033@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# c0941ace 29-Jan-2022 Mukesh Sisodiya <mukesh.sisodiya@intel.com>

iwlwifi: yoyo: add IMR DRAM dump support

Support debug collection of the platform IMR memory region,
where data is copied by FW during d3 state

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220129105618.715f04ecc635.Ib89a6caa06c1324c1c0dd3f9f4cf7407f2857155@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 34bc2778 29-Jan-2022 Rotem Saado <rotem.saado@intel.com>

iwlwifi: yoyo: fix DBGI_SRAM ini dump header.

DBGI SRAM is new type of monitor, therefore it should be
dump as monitor type with ini dump monitor header.

Signed-off-by: Rotem Saado <rotem.saado@intel.com>
Fixes: 89639e06d0f3 ("iwlwifi: yoyo: support for new DBGI_SRAM region")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220129105618.6c31f6a2dcfc.If311c1d548bc5f7157a449e848ea01f71f5592eb@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f3497dda 29-Jan-2022 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: dbg: add infra for tracking free buffer size

Until now function just got a pointer to some buffer and used it as if
it's good to use with no boundaries about size left in the buffer.

This infra helps for internal functions ops to make sure buffer usage
is in bound of allocation.

We also add external checks with warnings to verify every internal
function didn't exceed usage of the free buffer size.

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.20220129105618.25c90fb14968.Ic8f05581a745d08011ca29b3f42767402643e8c5@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 3827cb59 28-Jan-2022 Johannes Berg <johannes.berg@intel.com>

iwlwifi: avoid void pointer arithmetic

Avoid void pointer arithmetic since it's technically
undefined and causes warnings in some places that use
our code.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220128153014.e349104ecd94.Iadc937f475158b9437becdfefb361a97e7eaa934@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# c3c3e9a7 19-Dec-2021 Mukesh Sisodiya <mukesh.sisodiya@intel.com>

iwlwifi: yoyo: fix issue with new DBGI_SRAM region read.

NIC has been grabbed for reading twice which is leading
to NIC hang. Code correction are done for reading data with
no grab function.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211219132536.55527214f8c9.I1748215ccb3fa20a3491a46a49b12e04eb560ac6@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# ddb6b76b 18-Dec-2021 Mukesh Sisodiya <mukesh.sisodiya@intel.com>

iwlwifi: yoyo: support TLV-based firmware reset

Support resetting the firmware via TLV-based debugging. When applied,
this will cause the driver to reset the firmware when the debugging
is triggered.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211219121514.d59b29653a1e.I7b3be4a1ad1a9d5d0e86259740e89ac113c9348b@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f1c0bb74 10-Dec-2021 Matti Gottlieb <matti.gottlieb@intel.com>

iwlwifi: Read the correct addresses when getting the crf id

The original implementation checked the HW family, and as a result
of that used different addresses for the prph registers.

The old HWs addresses start with 0xa****** and the newer
ones start with 0xd******.

For this there are iwl_read/write_umac_prph functions that just add the

diff in the address automatically (in this case 0x300000), so the code will
be common for all HWs

In the original implementation the address given already had the 0xd******
causing the address to become 0x10***** (after adding the offset)

Change the registers to start with 0xa*****.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211210090244.db2722547eb2.I03dce63698befc2fd9105111c3015b8d6e36868a@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 04f1ee24 04-Dec-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: fw: correctly detect HW-SMEM region subtype

This is part of the "device memory" type, but with the
subtypes we can now detect it properly, rather than
having to make assumptions on the ID.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211204174546.91d33aa9dd3d.Ifb48e21fbb92ea25360856b5cc2afbb9b485d6b3@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 62ed5d90 04-Dec-2021 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: fw: add support for splitting region type bits

In next region tlv (3) region type is going to be split into bit mask
without affecting the ops for handling region type, so we just mask
the type independent of the version due to all versions having the
same bits usage.

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.20211204130722.083e4b47055e.If7483d854e3d07f81236d314b8155cd5996f306c@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 55c6d8f8 07-Dec-2021 Mike Golant <michael.golant@intel.com>

iwlwifi: support 4-bits in MAC step value

We have a MAC component (which is inside the SoC) and it has several
different HW steps. 3 bits used to be enough but now we need 4-bits
to represent all the different steps.

Properly support 4-bits in the MAC step value by refactoring all the
current handling of the MAC step/dash.

Already from family 8000 and up the dash (bits 0-1) no longer exists
and the step (until 8000 bits 2-3) consists of the dash bits as well.

To do this remove the CSR_HW_REV_STEP and the CSR_HW_REV_DASH
macros, replace them with CSR_HW_REV_STEP_DASH and add hw_rev_step
into the trans struct.

In addition remove the CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP and
CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH macros and create a new macro
combining the 2 (this way we don't need shifting or anything else.)

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Mike Golant <michael.golant@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211207160459.2e81a14d1f80.Ia5287e37fb3439d805336837361f6491f958e465@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# fdb70083 16-Oct-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: fw dump: add infrastructure for dump scrubbing

In firmware dumps, currently all kinds of key material may be
included, e.g. in host commands (if firmware crashes during the
processing of a key-related command) or in the TX FIFO(s) if
we have been using in-TX-command key material.

Additionally, some firmware versions will advertise sections
of their internal data to not dump, due to them containing some
sensitive data.

Add some infrastructure to allow scrubbing this data out, as
dependent on the opmode's idea of what will need to be done.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211017123741.360cc8fe55b1.Ie3bd3ece38043969f7e116e61a6ec1197a58d78b@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 1f171f4f 26-Aug-2021 Matti Gottlieb <matti.gottlieb@intel.com>

iwlwifi: Add support for getting rf id with blank otp

When having a blank OTP the only way to get the rf id
and the cdb info is from prph registers.

Currently there is some implementation for this, but it
is located in the wrong place in the code (should be before
trying to understand what HW is connected and not after),
and it has a partial implementation.

Signed-off-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210826224715.820c2ae18c2b.Iec9b2e2615ce65e6aff5ce896589227a7030f4cf@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 89639e06 19-Aug-2021 Mukesh Sisodiya <mukesh.sisodiya@intel.com>

iwlwifi: yoyo: support for new DBGI_SRAM region

new region handling is added for dump collection.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.af9a24b82396.I53c5f82bd2d0f56fd699e3841c922082d99f1c90@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 8a433cb6 19-Aug-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: fw: fix debug dump data declarations

The debug dump ranges aren't just an array of such ranges
since each range has a variable size. Therefore, the use
of a struct array is misleading at best.

Change it to be a u8 data[] instead of the struct array,
the code doesn't significantly change since it's actually
doing things correctly now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210819183728.693c9891097d.Idcaab1fd659e8be2f56be647b2534befd61a4460@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# e6344c06 05-Aug-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: fw: correctly limit to monitor dump

In commit 79f033f6f229 ("iwlwifi: dbg: don't limit dump decisions
to all or monitor") we changed the code to pass around a bitmap,
but in the monitor_only case, one place accidentally used the bit
number, not the bit mask, resulting in CSR and FW_INFO getting
dumped instead of monitor data. Fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210805141826.774fd8729a33.Ic985a787071d1c0b127ef0ba8367da896ee11f57@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b8221b0f 02-Aug-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: prepare for synchronous error dumps

In some cases it may be necessary to synchronously create
a firmware error report, add the necessary infrastructure
for this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802170640.481b6642f0fc.I7c9c958408a285e3d19aceed2a5a3341cfc08382@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 4db7cf1e 21-Jun-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: move error dump to fw utils

Conceptually, this belongs more into the firmware utils
rather than the mvm opmode, so move the collection and
output there.

Note that this slightly changes the format of the Status
line.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210621103449.b82b60d81346.Ide3b688107f6a59c7fc7eb1d8f2002b0a5c1f2d2@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# a451b823 12-Jun-2021 Mukesh Sisodiya <mukesh.sisodiya@intel.com>

iwlwifi: yoyo: support region TLV version 2

Region TLV version 2 now includes more data, but it is not
relevant for the driver.
In order to support this new version, just mask the new part out.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210612142637.60dd4c60ab49.I44fe02af389d3ab089363bf9bde0d99a4c1ff383@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 378c7be6 11-Apr-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: fw: print out trigger delay when collecting data

It can be confusing to see "Collecting data: ..." followed by
that not actually happening immediately so print out the delay
in that message.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210411132130.5bd095dc579a.Id1f3b746ac61497951638ba7ce70fc4b63dd87d1@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 9ce505fe 10-Feb-2021 Abhishek Naik <abhishek.naik@intel.com>

iwlwifi: mvm: Check ret code for iwl_mvm_load_nvm_to_nic

Return value of the iwl_mvm_load_nvm_to_nic func is not analyzed. If load
NVM to nic func fails and NVM is not loaded to fw properly, then fw may
behave badly and lead to some strange issue. This commit will analyze
return value and if load NVM to nic has failed, then the error code is
sent to the previous func, which will trigger WRT log collection.
iwl_fw_dbg_error_collect() func collects dump only if tri type is
FW_DBG_TRIGGER_ALIVE_TIMEOUT. But when Load NVM to nic function fails
trig_type is FW_DBG_TRIGGER_DRIVER. This commit also has code changes to
collect dump when trig_type is FW_DBG_TRIGGER_DRIVER.

Signed-off-by: Abhishek Naik <abhishek.naik@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210210171218.32998850192a.Ic58d08cb6944ca55e343ff0032c82cfa7821e588@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 1ed08f6f 10-Feb-2021 Johannes Berg <johannes.berg@intel.com>

iwlwifi: remove flags argument for nic_access

Since we no longer save interrupts, we no longer need the flags
argument here, remove it throughout.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210210142629.8de8fe6f9fff.If040b056d0e8c771c65ac5c29230f939354a142b@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# beb44c0c 10-Feb-2021 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: dbg: remove unsupported regions

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>


# fcc2622c 17-Jan-2021 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: dbg: dump paged memory from index 1

We skip index 0 that holds CSS section which isn't relevant for paged
memory.

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.20210117130510.ad2df68fccbc.I381f931c6e7606c21935ec6667619b209224e408@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# fe472e9d 26-Nov-2020 Lee Jones <lee.jones@linaro.org>

iwlwifi: fw: dbg: Fix misspelling of 'reg_data' in function header

Fixes the following W=1 kernel build warning(s):

drivers/net/wireless/intel/iwlwifi/fw/dbg.c:1932: warning: Function parameter or member 'reg_data' not described in 'iwl_dump_ini_mem'
drivers/net/wireless/intel/iwlwifi/fw/dbg.c:1932: warning: Excess function parameter 'reg' description in 'iwl_dump_ini_mem'

Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: Luca Coelho <luciano.coelho@intel.com>
Cc: Intel Linux Wireless <linuxwifi@intel.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201126133152.3211309-15-lee.jones@linaro.org


# 8e99ea8d 09-Dec-2020 Johannes Berg <johannes.berg@intel.com>

iwlwifi: use SPDX tags

Use SPDX tags instead of the long copyright notices. Also cleanup
some duplicate copyright notices and combine the years where possible.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201210000603.481bcb512a6f.I8146abe5a637079e7336209f23cb26af98b12b31@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# cc598782 09-Dec-2020 Rotem Saado <rotem.saado@intel.com>

iwlwifi: yoyo: align the write pointer to DWs

from AX210 generation the write pointer is in Bytes.
to be align with all previous HWs convert it DWs.

Signed-off-by: Rotem Saado <rotem.saado@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231351.c9a9cbef4a09.Ic7df63c617f79b7e6a95a510c51b3516bba5599f@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b34872bc 09-Dec-2020 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: yoyo: add the ability to dump phy periphery

This enables analyzing phy/HW bugs.

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.20201209231351.53bce4f8353d.Ia6944582bd2c748387aaef96755d8919c5d25dc1@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# ba8f6f4a 25-Sep-2020 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: dbg: add dumping special device memory

With the new region we can handle in user space understanding
the struct type and version and driver doesn't need to be involved
at all.

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.20200926002540.88c431fad7da.I282944cbad5aa367735a9f9a5c47cfbd107a5fc0@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 66d0a3b5 17-Oct-2019 Chris Down <chris@chrisdown.name>

iwlwifi: Don't IWL_WARN on FW reconfiguration

IWL_WARN seems excessive here since this can happen during normal
operation. Every time I connect to a new network with 8086:24fd I get
this as KERN_WARNING on the console, which mildly distracts from other
more pressing messages. For example:

% sudo journalctl _TRANSPORT=kernel | grep -c 'FW already configured'
403

Signed-off-by: Chris Down <chris@chrisdown.name>
Cc: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Cc: Luca Coelho <luciano.coelho@intel.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Link: https://lore.kernel.org/r/20191017144841.GA16393@chrisdown.name
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d3d2674c 25-Apr-2020 Liad Kaufman <liad.kaufman@intel.com>

iwlwifi: dbg_ini: differentiate ax210 hw with same hw type

There are several "flavors" of HW that have the same HW type, but
can be told apart after reading a certain perph register. This
is easy to do in runtime, but more complicated to do when looking
at the logs offline.

To make it easier to tell apart these "flavors" when looking at
the dumped dbg info, add these bits to the HW type, allowing
simple differentiation.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200425130140.330ea11d17ae.Ie59b25430a308090b15112ac6deedf4fbf487ff1@changeid


# 281277b2 25-Apr-2020 Johannes Berg <johannes.berg@intel.com>

iwlwifi: dbg: mark a variable __maybe_unused

If CONFIG_IWLWIFI_DEBUGFS is not set, the variable is assigned
but not checked, resulting in a compiler warning. Suppress it,
we need the variable for the debugfs-enabled case.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200425130140.485f886f5a6c.I8a91c560c26cced33b15d8419caebb53a9abcc2d@changeid


# 0960237d 24-Apr-2020 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: yoyo: remove magic number

The for loop is iterating over active regions so iterate only
over the len of the active regions buffer size.

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.20200424194456.e10482b9eed7.I15da7bb25d9b9e3eef1c1b117dc585e703ce756a@changeid


# 2abe24f9 24-Apr-2020 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: set debug descriptor to NULL outside of iwl_fw_free_dump_desc

To avoid static analysis warning and to make the flow more readable, set
the debug descriptor to NULL outside iwl_fw_free_dump_desc and only in
the required places.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200424194456.5d5c50750a52.I17e33fc268c2097b7c42877f86cef2aa163b913a@changeid


# cc9b6012 24-Apr-2020 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: yoyo: use hweight_long instead of bit manipulating

Also we can only have one fid1 or fid2 set so no need to check
if the fid2 is set in case fid1 wasn't set.

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.20200424182644.34e74106bad3.Ic3a9f0a35fed47b02ebcd27c2dc2b50cb1e56bdf@changeid


# ebfa7f8a 24-Apr-2020 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: yoyo: add support for parsing SHARED_MEM_ALLOC version 4

The new version adds the information for RX2C FIFO addresses.

Use the new addresses to parse the FIFO info when dumping.

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.20200424182643.97cc25d96b53.I65fd0400d80f505bd6d7eed442f12db24b25bbe3@changeid


# f05f8edd 17-Apr-2020 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: yoyo: support IWL_FW_INI_TIME_POINT_HOST_ALIVE_TIMEOUT time point

Allow the driver to perform dump collection in case of alive notification
timeout in yoyo mode.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200417131727.bd46e6240590.Ibda6d9d330a1ae49670152cede34629b280f6cf9@changeid


# 7a99c877 17-Apr-2020 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: support multiple dumps in legacy dump flow

Support multiple debug data collection triggers in legacy flow.
Utilize the already existing Yoyo infra so the change is rather simple.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200417131727.5be6a1923cbe.I10701236b03f66328041f2a38f5f0f22a26fd40b@changeid


# e8b61560 13-Nov-2019 rotem saado <rotem.saado@intel.com>

iwlwifi: yoyo: don't block dumping internal memory when not in SRAM mode

When we have an assert during D3 we want to dump the internal
buffer memory even if are we working in DRAM debug mode. We should not
block dumping it.

Change-Id: I69aad2d4904c4f8bb653c61e8781a2e07780054f
Signed-off-by: Rotem Saado <rotem.saado@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f696a7ee 01-Nov-2019 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: yoyo: add PCI config space region type

Add a new region type that allows us to dump the PCI config space.
This is mostly the same as dumping a memory region, but reading from
the device's config space instead.

In order to make this generic and independent of the trans type, we
make a function called iwl_dump_ini_config_iter() that calls a new op
in the transport to read its config space.

Change-Id: I15151bddf589f13b0e0a45c28b96bbcd73bcfdeb
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 699b760b 06-Mar-2020 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: dbg: don't abort if sending DBGC_SUSPEND_RESUME fails

If the firmware is in a bad state or not initialized fully, sending
the DBGC_SUSPEND_RESUME command fails but we can still collect logs.

Instead of aborting the entire dump process, simply ignore the error.
By removing the last callpoint that was checking the return value, we
can also convert the function to return void.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Fixes: 576058330f2d ("iwlwifi: dbg: support debug recording suspend resume command")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200306151129.dcec37b2efd4.I8dcd190431d110a6a0e88095ce93591ccfb3d78d@changeid


# a5688e60 06-Mar-2020 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: yoyo: don't add TLV offset when reading FIFOs

The TLV offset is only used to read registers, while the offset used for
the FIFO addresses are hard coded in the driver and not given by the
TLV.

If we try to apply the TLV offset when reading the FIFOs, we'll read
from invalid addresses, causing the driver to hang.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Fixes: 8d7dea25ada7 ("iwlwifi: dbg_ini: implement Rx fifos dump")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200306151129.fbab869c26fa.I4ddac20d02f9bce41855a816aa6855c89bc3874e@changeid


# 0b295a1e 10-Oct-2019 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: add device name to device_info

We have a lot of mostly duplicated data structures that are repeated
only because the device name string is different. To avoid this, move
the string from the cfg to the trans structure and add it
independently from the rest of the configuration to the PCI mapping
tables.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 058c411d 27-Oct-2019 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: yoyo: remove unnecessary active triggers status flag

Now that we can't change the domain at runtime anymore, we don't have
to protect the active trigger status. Remove it. Additionally, we
don't need to flush the dumps at this point anymore, since this only
runs during initialization and there shouldn't be any dumps running.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 990aba28 15-Dec-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: force stop the debug monitor HW

The driver is required to stop the debug monitor HW recording regardless
of the debug configuration since the driver is responsible to halt the
FW DBGC.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# efaaa97c 01-Oct-2019 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: dbg_ini: don't skip a TX FIFO when dumping

Before we start looping over the internal TX FIFOs increase the fifo
number, but that's incorrect and causes a FIFO to be skipped. This is
probably due to a copy and paste from the previous loop.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 6abe1e2e 04-Aug-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: use vzalloc to allocate dumping memory regions

During dump flow, the driver allocates spaces to store the memory
regions that will be included in the dump. These regions can be very
large so in order to avoid allocation failure, use vzalloc instead.
The kmalloc uses GFP_KERNEL and the driver does not make any use of the
fact that the memory is contiguous so the same functionality is
maintained.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 3ed34fbf 23-Jul-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: support FW response/notification region type

Allow the driver to collect FW response/notification region type
during dump and allow triggering dump collection for a given FW
response/notification.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# cf29c5b6 23-Jul-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: implement time point handling

Calculate active triggers list and implement time points handling.
Also allow to override the debug domain via iwl-dbg-cfg.ini by setting
FW_DBG_DOMAIN field.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 677d25b2 22-Jul-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: use new API in dump info

Make dump info region use new API.
debug_info_tlv_list list will be initialize in a future patch once the
driver will start using it.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# a77e3d28 22-Jul-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: add error tables dumping support

Allow to collect error table data.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 593fae3e 22-Jul-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: add monitor dumping support

Allow collecting monitor data in ini debug mode.
Implement both SMEM and DRAM monitor regions dumping.
For DRAM monitor, support DBGC1, DBGC2 and DBGC3 and support several
DRAM fragments per DBGC.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 3b589d56 23-Jul-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: use new trigger TLV in dump flow

Make dump flow use the new trigger TLV.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# c9fe75e9 23-Jul-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: use new region TLV in dump flow

Make dump flow use the new region TLV and update the region type enum.
Temporarily remove monitor dumping support. Support will be readded in a
future patch.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b4b814fe 12-Sep-2019 Navid Emamdoost <navid.emamdoost@gmail.com>

iwlwifi: dbg_ini: fix memory leak in alloc_sgtable

In alloc_sgtable if alloc_page fails, the alocated table should be
released.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 9b1bcfcc 01-Jul-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: remove periodic trigger

Remove periodic trigger functionality.
After moving to the new API we will add periodic trigger functionality
that matches the new API.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 286ca8eb 12-Jul-2019 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: add a pointer to the trans_cfg directly in trans

Add a pointer to the iwl_trans structure and point it to the trans
part of the cfg. This is the first step in disassociating the trans
configuration from the rest of the configuration.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 79b6c8fe 02-Aug-2018 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: separate elements from cfg that are needed by trans_alloc

In order to be able to select the cfg depending on the HW revision or
on the RF ID, we need to set up the trans before selecting the cfg.
To do so, move the elements from cfg that are needed by
iwl_trans_alloc() to a separate struct at the top of the cfg, so it
can be used by other cfg types as well, before selecting the rest of
the configuration.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# cd6de838 17-Jun-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: use regions ops array instead of switch case in dump flow

Make a static regions ops array and use it instead of switch case when
determining what op to use to collect a region.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# bdc62390 17-Jun-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: make a single ops struct for paging collect

Needed for future changes.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d4c444ef 17-Jun-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: move tx fifo data into fw runtime

Needed for future changes.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 0fc296f8 16-Jun-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: use linked list for dump TLVs during dump creation

Avoid iterating over dump TLVs twice for size calculation by using
linked list to store the dump TLVs.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 00eacde4 13-Jun-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: separate cfg and dump flows to different modules

separate configuration flows and dump collection flows.
make ini configuration flows be in iwl-dbg-tlv.c and dump related flows
in dbg.c to better reflect their logical difference.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# a64d4e8d 27-May-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: align wrt log prints to the same format

Align wrt log prints to the driver coding style
Remove the ext field from the log and print it at the beginning of the
apply point.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f259fc89 30-Jun-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: remove debug flow TLV

Debug flow TLV was removed from the FW. Remove the TLV from the driver
as well.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 341bd290 30-Jun-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: verify debug TLVs at allocation phase

Reimplement debug TLV allocation flow. The driver will check the
validity of the debug TLVs prior allocating space for them.
Any malformed or unsupported TLV will be skipped.
The TLV specific checks will be added in later patches.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# a1af4c48 30-Jun-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: use function to check if ini dbg mode is on

use iwl_trans_dbg_ini_valid function instead of a boolean value check if
dbg_ini mode is on. It is needed for a future patch.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 2d46f7af 14-Jun-2019 Christoph Hellwig <hch@lst.de>

iwlwifi: stop passing bogus gfp flags arguments to dma_alloc_coherent

dma_alloc_coherent is not just the page allocator. The only valid
arguments to pass are either GFP_ATOMIC or GFP_ATOMIC with possible
modifiers of __GFP_NORETRY or __GFP_NOWARN.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 5b79c323 17-Jun-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: remove periphery phy and aux regions handling

periphery phy and aux regions should not be collected like periphery mac
region. Remove their handling. The handling will be added in the future
once the FW will support it.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: 7a14c23dcdee ("iwlwifi: dbg: dump data according to the new ini TLVs")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 40b7d22d 10-Jun-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: use linked list to store debug TLVs

Use a linked list to maintain the debug TLVs instead of a single buffer.
This way, the driver does not need to iterate over the binary file twice
and allocates smaller chunks of memory. Also, in case one allocation
fails the driver will work with the partial configuration instead of
aborting the entire debug configuration.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# ccdc3d6d 12-Jun-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: maintain buffer allocations from trans instead of TLVs buffer

Maintain DRAM debug buffer status in trans instead of keeping it as
part of the TLVs buffer to avoid allocating extra space for it.
Needed for future changes.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 15995b75 24-Jun-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: add debug periphery registers to 9000 device family

Add debug HW periphery registers to 9000 device family.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 57605833 19-May-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: support debug recording suspend resume command

Support the new DBGC_SUSPEND_RESUME command to change the recording state.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 203c83d3 22-May-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: move debug recording stop from trans to op mode

The op mode should stop the debug recording and not the transport layer.
Rename iwl_fwrt_stop_device into iwl_fw_dbg_stop_sync and move the debug
stop recording to it.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b721f5b1 21-May-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: move monitor recording functionality from header file

The recording functions are quite big to be inline and the driver should
expose only the stop and restart functions that are allowed to be used
rather then the internal helper functions. Move the functions from the
header file.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 1f660725 01-Aug-2019 Mauro Rossi <issor.oruam@gmail.com>

iwlwifi: dbg_ini: fix compile time assert build errors

This patch fixes and preserves existing code style, and readability,
for IWL_ERR() and IWL_WARN() macros invocations recently added in dbg.c

Fixes the following build errors with Android build system:

/home/utente/pie-x86_kernel/kernel/drivers/net/wireless/intel/iwlwifi/fw/dbg.c: In function '_iwl_fw_dbg_apply_point':
/home/utente/pie-x86_kernel/kernel/drivers/net/wireless/intel/iwlwifi/fw/dbg.c:2445:3:
error: call to '__compiletime_assert_2446' declared with attribute error: BUILD_BUG_ON failed: err_str[sizeof(err_str) - 2] != '\n'
/home/utente/pie-x86_kernel/kernel/drivers/net/wireless/intel/iwlwifi/fw/dbg.c:2451:3:
error: call to '__compiletime_assert_2452' declared with attribute error: BUILD_BUG_ON failed: err_str[sizeof(err_str) - 2] != '\n'
...
/home/utente/pie-x86_kernel/kernel/drivers/net/wireless/intel/iwlwifi/fw/dbg.c:2789:5:
error: call to '__compiletime_assert_2790' declared with attribute error: BUILD_BUG_ON failed: invalid_ap_str[sizeof(invalid_ap_str) - 2] != '\n'
/home/utente/pie-x86_kernel/kernel/drivers/net/wireless/intel/iwlwifi/fw/dbg.c:2800:5:
error: call to '__compiletime_assert_2801' declared with attribute error: BUILD_BUG_ON failed: invalid_ap_str[sizeof(invalid_ap_str) - 2] != '\n'

Fixes: 427ab6385cf3 ("iwlwifi: dbg_ini: enforce apply point early on buffer allocation tlv")
Fixes: 57d88b116175 ("iwlwifi: dbg_ini: support debug info TLV")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# 6c7f7087 19-May-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: debug recording stop and restart command remove

The 0xF6 command used to start and stop the recording from 22560 devices
was removed. This is causing an assert when the driver tries to alter
the recording state.
Remove the use of the command.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 029c25f3 16-May-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: fix debug monitor stop and restart in ini mode

In ini debug mode the recording does not restart unless legacy monitor
configuration is also given.

Add dbg_ini_dest field to trans to indicate the debug monitor
destination to solve this.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 91c28b83 13-May-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: move trans debug fields to a separate struct

Unite iwl_trans debug related fields under iwl_trans_debug struct to
increase readability and keep iwl_trans clean.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 1d45a700 12-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: remove redundant checking of ini mode

There are several flows where the driver checks if it runs in ini mode.
Some of these flows are no longer used in ini mode or there is another
condition that check the ini mode in the same flow. Either way, those
conditions are redundant. Remove the redundant conditions.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 427ab638 13-May-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: enforce apply point early on buffer allocation tlv

Apply buffer allocation TLV only if it is set to apply point
IWL_FW_INI_APPLY_EARLY.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# fc838c77 16-May-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: fix debug monitor stop and restart delays

The driver should delay only in recording stop flow between writing to
DBGC_IN_SAMPLE register and DBGC_OUT_CTRL register. Any other delay is
not needed.

Change the following:
1. Remove any unnecessary delays in the flow
2. Increase the delay in the stop recording flow since 100 micro is
not enough
3. Use usleep_range instead of delay since the driver is allowed to
sleep in this flow.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: 5cfe79c8d92a ("iwlwifi: fw: stop and start debugging using host command")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 0a3a3e9e 18-Apr-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: implement dump info collection

The info struct contains data about the FW, HW, RF and the debug
configuration.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 57d88b11 18-Apr-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: support debug info TLV

Add support to debug info TLV.
The TLV contains human readable naming of the FW image and the
debug configuration.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# dc14b800 28-Apr-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: use different barker for ini dump

Use a different barker for ini dump to allow differentiation from legacy
dump. Also it allows to remove INI_BIT from dump TLVs.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# c7ab138e 02-Apr-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: add consecutive trigger firing support

When a dump trigger is fired, the driver sets IWL_FWRT_STATUS_DUMPING and
aborts any consecutive dump collection.
To allow consecutive triggers firing, use 5 dump workers and allocate
them upon incoming dump collection requests.

This functionality is needed since in ini debug mode each trigger may
have entirely different memory regions to collect unlike the legacy
mode in which all the triggers dump the same memory regions.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# e8704b81 08-Apr-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: abort region collection in case the size is 0

Allows to abort region collection in case the region size is 0.
It is needed for future regions that their size might be 0.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 97319355 08-Apr-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: dump headers cleanup

Unite dump memory ranges under a single struct and add a specific header
for each type of memory.
Also, maintain a single version to all dump structures.

This cleanup is also needed for the future addition of FW notification
regions and others.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# e4eee943 26-Mar-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: allow dump collection in case of an early error

Improve the robustness of the dump collection flow in case of an early
error:
1. in iwl_trans_pcie_sync_nmi, disable and enable interrupts only if
they were already enabled
2. attempt to initiate dump collection in iwl_fw_dbg_error_collect only
if the device is enabled
3. check Tx command queue was already allocated before trying to collect it

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# cc5470df 29-May-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: print fseq info upon fw assert

Read fseq info from FW registers and print it upon fw assert.
The print is needed since the fseq version coming from the TLV might
not be the actual version that is used.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# a0eaead4 07-Apr-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: check for valid region type during regions parsing

Add region type checking during regions parsing to avoid attempts to
parse unsupported or illegal region types.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 0aade8f4 08-Apr-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: avoid allocating memory for region with disabled domain

In iwl_fw_ini_get_trigger_len the driver allocates space for memory
regions regardless of their domain and in iwl_fw_ini_dump_trigger the
driver aborts trigger collection of disabled domain. This diff causes
unneeded memory allocation and traling zeros in the dump file.

Solve this behavior by enforcing domain checking in
iwl_fw_ini_get_trigger_len

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 391481ad 04-Apr-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: replace dump info device family with HW type

In the dump info, the driver sets device_family to
IWL_FW_ERROR_DUMP_FAMILY_7 in case IWL_FW_ERROR_DUMP_FAMILY_7 is used or
IWL_FW_ERROR_DUMP_FAMILY_8 otherwise. This information is misleading and
incorrect since the driver sets the device family to 8 to any device that
is from family 8 and later, e.g. device family 9 is represented as 8 in
the dump.
Also, the device family enum is known only to the driver and
does not give any information to the FW developer

Change the device family to HW type to give propper data about the nic
in use.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# bfd8e3da 19-Mar-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: add periodic trigger support

Allows to configure a periodic data collection

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 954454d6 07-Apr-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: add lmac and umac error tables dumping support

Add LMAC_ERROR_TABLE and UMAC_ERROR_TABLE region types and handle them
in the same way as we handle DEVICE_MEMORY.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 69166f7a 19-Mar-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: set dump bit only when trigger collection is certain

In case the the trigger occurrences is zero or force_restart is set, the
driver sets IWL_FWRT_STATUS_DUMPING without actually scheduling trigger
collection. At this point no other dump collection can be performed.

Solve this by setting IWL_FWRT_STATUS_DUMPING bit only when the driver
is surely going to schedule dump collection

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# e91130ce 14-Mar-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: add lmac and umac PC registers to periphery dump

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 32d2282a 06-Mar-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: add periphery memory dumping support to ax210 device family

Allows to dump periphery memory on ax210 devices.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 53032e6e 03-Mar-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: add debug prints to the ini flows

Add debug prints to the ini flow and rewrite existing prints to provide
more information

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 77f99ae6 03-Mar-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: support notification and dhc regions type parsing

IWL_FW_INI_REGION_CSR and IWL_FW_INI_REGION_NOTIFICATION does not have
memory addresses attached to them so the driver should skip them when
parsing the region tlv.
Also, instead of declearing what region types should skip the addition of
the memory addresses, declare what regions have addition of memory
addresses.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 56fe12d2 26-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg: fill radio registers data regardless of fifos data dumping

The driver calculates memory regions dump size, allocate memory and
fills the data. The driver fills the radio registers data only if the
memory size of the fifos is greater then zero, so in case the user
masked out the fifos from the dump, the driver will skip filling the
radio register data.

Solve this by checking filling radio registers data independently from
fifos data.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 30eba3f9 19-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: apply rx fifo offset after reading the region registers

The region registers comes in abolute value so read the registers before
applying the rx fifo offset.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 33a40386 17-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: remove redundant type argument from iwl_dump_ini_mem

Since iwl_dump_ini_mem receive struct iwl_fw_ini_region_cfg which holds
the region type, there is no point to pass the type separately.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 84294b5b 17-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: remove redundant curly brackets from trigger collection flow

remove redundant curly brackets from iwl_fw_ini_dump_trigger and
iwl_fw_ini_get_trigger_len

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 4c704534 17-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: add monitor header to smem monitor

Add write pointer and cycle count registers to smem monitor header.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d63916ae 17-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: fix the dram monitor header size

Add sizeof(struct iwl_fw_ini_error_dump_range) to the header of the dram
monitor.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f0e1e1c2 17-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: change memory range base address to u64

AX210 devices will use u64 for the base address to the DRAM monitor
buffer. To support this, change the structure for all device families
so both address sizes fit.

Also move range_data_size to the top of the struct to ease the parsing
of the memory range.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 60eeaf57 17-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: add registers addresses in fifo dump

Add to the fifo dump the registers addresses.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 1cdb4d8f 17-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: add region id to the region dump

Add the region id of the collected memory to the header of the memory
region.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 990ffe3e 16-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: add version to dump header

Add version to dump header to allow future changes of the dump struct,
once the ini debug flow becomes operational, without breaking backwards
compatibility.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 9802162f 17-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: add memory offset to the base address of a memory region

Add the offset to the base address of a memory region to show the actual
addresses being read.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 4bdb2676 17-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: fix iwl_dump_ini_dev_mem_iter memory base address

The driver is using range->start_addr before assigning it a value.
Set value into range->start_addr and then use it.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# bfa34c33 10-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: enforce always on domain checking

Enforce domain checking before sending host commands and collecting
memory regions. Currently the driver supports always on domain only.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 4b49e34e 12-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: separate between ini and legacy dump flows

Separate between ini and legacy dump flows to allow adding ini triggers
that are not supported in the legacy flow and to increase readabilty.

iwl_fw_dbg_ini_collect function is now called with legacy trigger id and
_iwl_fw_dbg_ini_collect is called with ini trigger id.

Also make the actual dumping function static so that any dump collection
will go through iwl_fw_dbg_collect_sync.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 07d35b42 10-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: use sync nmi in case of init flow failure

In case of alive interrupt timeout or any failure in the init flow
the driver generates FW nmi. The driver assumes that the nmi will
generate SW interrupt. This assumption does not hold and leads to faulty
behavior in the recovery flow.

Solve this by using sync nmi, this way, even if the driver does not
receive SW interrupt, it still starts the recovery flow.

Also remove the wait queue from iwl_fwrt_stop_device since the driver is
handling the SW interrupt synchronously.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b05d57c9 12-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: fix bad dump size calculation

The driver initiates the size value with the size of the struct and then
adds the size of the data and checks if the size is zero so size can not
be equal to zero.

Solve this by getting the data size, check that it is not equal to zero
and only then add the struct size.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: 7a14c23dcdee ("iwlwifi: dbg: dump data according to the new ini TLVs")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 8625794e 10-Feb-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: in case of region dump failure set memory to 0

In case the driver fails to dump a memory region, and this is the last
region, then partial region would be extracted.

Solve this by setting the data to zero in case of failure.
This will cause dump to be a list of consecutive successful memory
regions and trailing zeros with no partial memories extracted.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 8d7dea25 27-Jan-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: implement Rx fifos dump

Implement Rx fifos dump in the new dump mechanism.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 1b64d58b 20-Dec-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: implement Tx fifos dump

Implement Tx fifos dump in the new dump mechanism.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 2dbf3aea 19-Dec-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: add region to fill_header handler

Add iwl_fw_ini_region_cfg region struct to fill_header handler of
iwl_dump_ini_mem_ops. it is needed for future support in fifos dumping.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 1a6c8bb7 28-Jan-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: make fill_range handler accept generic range pointer

Make fill_range handler of iwl_dump_ini_mem_ops accept a generic range
pointer. It is needed for future support in fifos dumping.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 01e591c9 28-Jan-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: make memory dump get_size handler include headers

Make the get size handler of iwl_dump_ini_mem_ops include the total
size of the region. It is needed for fifos dumping.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 05841faa 27-Jan-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: add print to iwl_dump_ini_mem in case of invalid range

Add informative print in case the range is not available.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 00276722 29-Jan-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: fix infinite time ignore consecutive dumps

The driver sets ignore_consec to -1 which is 0xffffffff in u32
so when iwl_fw_ini_trigger_on is called, it will always return false
and each trigger could be used only once.

Solve this by removing the assignment to -1.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: fe1b7d6c2888 ("iwlwifi: add support for triggering ini triggers")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 714afd35 23-Jan-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: remove redundant condition from prior alive dump flow

After the FW image was loaded for the first time,
fwrt->smem_cfg.num_lmacs value will no longer be zero since we don't
clean it when we stop the device. So if we load the image once and then
we fail on a consecutive attempt, the driver will abort any dumping.

Solve this by removing the condition. It is safe to remove since
when we do the actual dumping in iwl_fw_dbg_collect_sync we check
that STATUS_DEVICE_ENABLED bit is still active.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 46c7c982 13-Jan-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: enable ignore consecutive trigger feature

Enable ignore consecutive trigger feature which allows to configure the
driver to skip consecutive triggers from the same type.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 159133c8 13-Jan-2019 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: properly use delay option in dump trigger flow

Fix several issues related to dump delay:
1. In legacy dump trigger, use stop_delay field instead of trig_dis_ms.
2. ini delay is messured in usec so align both ini and legacy to usec.
3. schedule_delayed_work receives the delay value in jiffies so
translate the dump delay to jiffies.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: ea7cb8293874 ("iwlwifi: dbg: make trigger functions type agnostic")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# ea695b7c 01-Jan-2019 Shaul Triebitz <shaul.triebitz@intel.com>

iwlwifi: align to new periphery address space for AX210 family

In AX210 family, UMAC periphery address space moved from
0xA00000 to 0xD00000.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d4f4793c 01-Jan-2019 Shaul Triebitz <shaul.triebitz@intel.com>

iwlwifi: dbg: temporarily skip periphery dump for AX210 devices

Many periphery addresses have changed in AX210 devices.
Until sorting out which peripheries should be dumped, skip
that step for now.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b61a6610 21-Nov-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: rewrite trigger flow and align to FW API changes

Trigger field ignore_default was changed to override_trig.
The first byte of the field indicates the driver to override existing
configuration or keep the previous one
The second byte of the field indicated the driver to replace the regions
of the previous trigger or to append new regions to it.

Change the way the active triggers are maintained to support trigger
override in different apply points.
Do this by making a trigger that updates at runtime by the
triggers that are being used in the different apply points.

In case of an assert, the driver does not reconfigure the triggers
and uses the old configuration which leads to undefined behavior.
Solve this by clearing the triggers in assert recovery flow.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 106b791a 16-Dec-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: implement monitor dram memory dump

Implement monitor dram memory dump in the new dump mechanism.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# e41e2c26 16-Dec-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: implement monitor sram memory dump

Implement monitor sram memory dump in the new dump mechanism.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 505a00c0 05-Dec-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: implement paging memory dump

Implement paging memory dump in the new dump mechanism.
To support this change, moved iwl_self_init_dram strcut from trans_pcie
to trans so that it will accessible via fw_runtime.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 6e9f8f99 03-Dec-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: implement device internal memory dump

Implement device internal memory dump in the new dump mechanism.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f4f907aa 02-Dec-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: implement csr memory dump

Implement csr memory dump in the new dump mechanism.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 8d534e96 03-Dec-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: create new dump flow and implement prph dump

Create a skeleton to unite all memory dumps in ini mode.
Implement prph dump with the new skeleton.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 9deb52c6 05-Dec-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: align struct iwl_fw_ini_region_cfg to the FW

New fields were added to struct iwl_fw_ini_region_cfg.
add those field and apply the changes the result from this change

offset field is used to differentiate between the different LMACs
and any memory access to the region addresses should be
base_addr + offset.

A fifo struct is to hold the meta data needed for fifo regions

Also move range_data_size and num_of_ranges into a struct under the
union to be aligned to the struct in the FW.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 0ec7bfb2 20-Nov-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: remove redundant dram buffer allocation

There are several flows in that can cause redundant allocation.

In case the driver reaches the maximum amount of blocks allowed, it
allocates the buffer and only then checks if it reached the maximum
amount of blocks and return without freeing the buffer,
causing a memory leak.

Solve this by moving the check of the amount of buffers being used
before the allocation.

In case there was an assert, the apply points are being reused,
causing that for each assert, the driver allocates a new redundant
buffer.

Solve this by adding a new is_alloc field to indicate if the driver
already allocated memory for the requested buffer.

Also, split iwl_fw_dbg_buffer_allocation function into
iwl_fw_dbg_buffer_allocation and iwl_fw_dbg_buffer_apply
to increase the clearity of the flow.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: d47902f9f71d ("iwlwifi: dbg: add apply point logic")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 700b3799 12-Nov-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: Fix pre operational dumping flows

There are several dumping flows in the driver in case of a fail
prior to operational.

In some cases we get 2 dumps while in others we get none.

Fix this by uniting the different flows.
Add a different dump type to driver triggered dumps in case we want
a dump but did not got assert, and make all dumping go through
iwl_fw_dbg_collect_desc to avoid multiple dumps.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 67b8261c 22-Nov-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: differentiate between alive timeout and alive flow failure

There are two cases that can cause the alive flow to fail,
an assert or a timeout.
Currently we mask any incoming asserts when we wait for alive.

Solve this by differentiating between the two cases:
1. Let the regular error handling to handle a received assert
2. Do a dump collection in the case of a timeout

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: f38efdb29389 ("iwlwifi: add dump collection in case alive flow fails")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 7e316572 20-Nov-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: fix bad dma handling in page_mem dumping flow

Prior to gen2 we allocate the paging memory via alloc_pages
which requires passing ownership on the memory between the
cpu and the device using dma_sync_single_for_cpu and
dma_sync_single_for_device.

Add missing dma_sync_single_for_device in iwl_dump_paging
after copying the memory.

since gen2, we allocate the paging memory using dma_alloc_coherent
which does not need passing ownership between the cpu and device.

Remove unneeded call to dma_sync_single_for_cpu in
iwl_trans_pcie_dump_data prior to copying the memory.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: 5538409ba393 ("iwlwifi: pcie: support page dumping in wrt in gen2")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# bb0306bd 26-Nov-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: give better naming to region struct fields

Some of the region struct fields have misleading naming
change those fields to have an informative naming

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 55fbf0d2 26-Nov-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: set dump mask BIT(n) instead of n

The driver sets dump_mask value instead of BIT(value).
fix it by updating dump_mask correctly.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: 7a14c23dcdee ("iwlwifi: dbg: dump data according to the new ini TLVs")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b2aea95c 26-Nov-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: retrieve dump_delay value properly

The driver uses ignore_consec instead of dump_delay.
Fix it by using dump_delay as expected.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: fe1b7d6c2888 ("iwlwifi: add support for triggering ini triggers")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# cd0fc658 26-Nov-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: properly handle ini user trigger

in case of a user trigger while ini is enable we change
FW_DBG_TRIGGER_USER to IWL_FW_TRIGGER_ID_USER_TRIGGER in
iwl_fw_dbg_collect and then again we attempt to do so in
_iwl_fw_error_ini_dump which causes to abort the dump.

Fix it by removing the second check in _iwl_fw_error_ini_dump.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: 7a14c23dcdee ("iwlwifi: dbg: dump data according to the new ini TLVs")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 07a44b32 26-Nov-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dbg_ini: allocate dram buffer with proper flags

Use the same flags we use in the legacy buffer allocation.
Missing __GFP_NOWARN will cause an unwanted warning incase
we fail to allocate.
Missing __GFP_ZERO will give a buffer initially filled with
garbage which can make debug difficult in case our wrap count is zero.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Fixes: d47902f9f71d ("iwlwifi: dbg: add apply point logic")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# e6aeeb4f 29-Oct-2018 Johannes Berg <johannes.berg@intel.com>

iwlwifi: mvm: clean up LDBG config command usage

Clean up the LDBG config command to not be called "continuous
recording", and while at it actually remove the continuous
recording implementation completely since it was only used for
store & forward architectures.

This also fixes a bug at least in iwl_fw_dbg_buffer_allocation()
because what's now "__le32 type" (matching the firmware) used to
be "__le16 enable_recording", so the buffer allocation config
sub-struct would erroneously have started at the wrong offset.
In the other cases this didn't actually lead to a bug as other
bytes in pad[] were all zeroes, so accessing the 16-bit value as
a 32-bit value wouldn't make a difference (in little endian.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# acf42a95 21-Oct-2018 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: avoid access out of memory allocated

The value in num_lmac can be bigger than mem_cfg->lmac array,
warn in case it's bigger.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Fixes: 68025d5f9bfe ("iwlwifi: dbg: refactor dump code to improve readability")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 162b22c9 21-Oct-2018 Liad Kaufman <liad.kaufman@intel.com>

iwlwifi: tighten boundary checks

The driver assumes certain sizes and lengths aren't crossed in some
places. Make sure this indeed happens.

Found by Klocwork.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 7e08baeb 02-Oct-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: wrt: add 22000 device familiy prph dump support

Add prph dump addresses to support prph dump in 22000 HW.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d3561e0e 13-Sep-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: wrt: add to dump number of lmacs, lmac1 and umac error id

Add to the dump the number of lmacs, the error id of the umac
and the error id of lmac1, if supported.
In case the reason for the dump trigger is not an assert
the error id is zero.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 2c47e5a1 06-Sep-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: dbg: add debug data to warning

Add debug data to the warning issued when getting wrong region
id from firmware.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# a06875a7 28-Aug-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: wrt: add rt status and num of rx/tx fifos to dump

Add the rt status of the last assert or 0 if the dump collection was
not initiated by an assert. Add the number of rx and tx fifos in use.
These fields are added to dump info lst file.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# fe1b7d6c 21-Jun-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: add support for triggering ini triggers

Add support for ini triggers.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 7a14c23d 13-Jun-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: dbg: dump data according to the new ini TLVs

When ini TLVs are loaded, dump data according to the
stored configuration.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d47902f9 13-Jun-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: dbg: add apply point logic

Add a function to be called when apply point occurs.
For each of the TLVs, the function will perform the
apply point logic:
- For HCMD - send the stored host command
- For buffer allocation - allocate the memory and send the
buffer allocation command
- For trigger and region - update the stored configuration

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 74374223 13-Jun-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: dbg: disable triggers for ini

When ini is loaded, disable all legacy trigger
configuration.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 71256480 02-Aug-2018 Lior Cohen <lior2.cohen@intel.com>

iwlwifi: add fw dump upon RT ucode start failure

FW dump was missing in case the RT FW ucode
section failed to load. This failure happens when
the RT section of the FW file is corrupted.

Signed-off-by: Lior Cohen <lior2.cohen@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 32b258e9 31-Jul-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: dbg: split fifos dump

Split the dump of RXF and TXF. This is in order to
enable code reuse for INI, which may decide to dump
only RXF and not TXF, and vice versa.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 79f033f6 30-Jul-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: dbg: don't limit dump decisions to all or monitor

Currently opmode is limited to asking transport to either
dump all the dumps configured at startup, or monitor only.
Instead, pass to transport a bitmask, to allow flexibility.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 56b657f7 30-Jul-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: fw: use helper to determine whether to dump paging

Logic is there twice, and we'll need a third place
soon for ini dumping. In addition move the dumping
to a function, also to enable reuse.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# e488e593 30-Jul-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: dbg: use helper to check if debug type is set

This enables to incorporate more logic in one place.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 124e0eba 23-Jul-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: dbg: avoid passing trigger around

The trigger structure is being passed around, when
all we care about is whether to dump only monitor
or not. Pass a bool instead.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 4244e7fc 11-Jun-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: dump debug data before stop device

Debug data dump is not working in flows that stop the device is used
in their error handling. During these flows the op mode mutex is
locked until the device stops. Because of that, any assert generated
from the firmware can be handled only after the device already
stopped.

Since dumping cannot occour after stopping the device, split the the
dump function to two parts, Part that handles locking, and the part
that starts the actual dumping and call the second part in the op mode
stop device function.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# ea7cb829 21-Jun-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: dbg: make trigger functions type agnostic

As preparation for new trigger type, make iwl_fw_dbg_collect_desc
agnostic to the trigger structure.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# af303252 21-Jun-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: dbg: decrement occurrences for all triggers

iwl_fw_dbg_collect can be called by any function that already
has the error string ready. iwl_fw_dbg_collect_trig, on the
other hand, does string formatting. The occurrences decrement
is at iwl_fw_dbg_collect_trig, instead of iwl_fw_dbg_collect,
which causes it to sometimes be skipped. Move it to the right
location.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# f38efdb2 27-May-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: add dump collection in case alive flow fails

Trigger dump collection if the alive flow fails, regardless of the
reason.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 7339cc29 12-Jun-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: dbg: dump memory in a helper function

The code that dumps various memory types repeats itself. Move it to a
function to avoid duplication.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# a6820511 11-Jun-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: dbg: split iwl_fw_error_dump to two functions

Split iwl_fw_error_dump to two parts. The first part will dump the
actual data, and second will do the file allocations, trans calls and
actual file operations. This is done in order to enable reuse of the
code for the new debug ini infrastructure.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 68025d5f 10-Jun-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: dbg: refactor dump code to improve readability

Add a macro to replace all the conditions checking for valid dump
length. In addition, move the fifo len calculation to a helper
function.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 17b809c9 11-Jun-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: dbg: move debug data to a struct

The debug variables are bloating the iwl_fw struct. And the fields
are out of order, missing docs and some are redundant.

Clean this up. This serves as preparation for unionizing it for the
new ini infra.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 79f25b10 29-May-2018 Emmanuel Grumbach <emmanuel.grumbach@intel.com>

iwlwifi: dbg: don't crash if the firmware crashes in the middle of a debug dump

We can dump data from the firmware either when it crashes,
or when the firmware is alive.
Not all the data is available if the firmware is running
(like the Tx / Rx FIFOs which are available only when the
firmware is halted), so we first check that the firmware
is alive to compute the required size for the dump and then
fill the buffer with the data.

When we allocate the buffer, we test the STATUS_FW_ERROR
bit to check if the firmware is alive or not. This bit
can be changed during the course of the dump since it is
modified in the interrupt handler.

We hit a case where we allocate the buffer while the
firmware is sill working, and while we start to fill the
buffer, the firmware crashes. Then we test STATUS_FW_ERROR
again and decide to fill the buffer with data like the
FIFOs even if no room was allocated for this data in the
buffer. This means that we overflow the buffer that was
allocated leading to memory corruption.

To fix this, test the STATUS_FW_ERROR bit only once and
rely on local variables to check if we should dump fifos
or other firmware components.

Fixes: 04fd2c28226f ("iwlwifi: mvm: add rxf and txf to dump data")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# da752717 09-Apr-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: debug flow cleanup

Cleanup of the debug flow by moving several flows to separate
functions to increase readability. Three functions were created:

1. iwl_fw_get_prph_len - returns the size needed for periphery dump.
2. iwl_fw_dump_mem for - executes the memory dumping flow.
3. iwl_trans_get_fw_monitor_len - returns the size needed for monitor dump.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 5cfe79c8 17-May-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: fw: stop and start debugging using host command

In new devices, access to periphery is forbidden. Send instead
host command to start and stop debugging.

Memory allocation is written in context info, but in case we
need to update it there is a dedicated command. Add definitions,
currently unused, of the new command.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# d25eec30 17-May-2018 Sara Sharon <sara.sharon@intel.com>

iwlwifi: fw: add a restart FW debug function

Move the restart FW debug code to a function. This avoids code
duplication and lays the infra to support the new start and stop
host commands in some future devices.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# ea7c2bfd 17-May-2018 Johannes Berg <johannes.berg@intel.com>

Revert "iwlwifi: allow memory debug TLV to specify the memory type"

This reverts the addition of memory type in the memory debug TLV
as the firmware never ended up implementing it, and now the PRPH
dump is added as a different TLV.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# ae17404e 03-May-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: avoid code duplication in stopping fw debug data recording

Make all FW debug data stop recording flows to use
iwl_fw_dbg_stop_recording function instead of writing to FW
registers directly.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 754f890a 24-Aug-2018 Luca Coelho <luciano.coelho@intel.com>

iwlwifi: remove all occurrences of the FSF address paragraph

The Free Software Foundation address is superfluous and causes
checkpatch to issue a warning when present. Remove all paragraphs
with FSF's address to prevent that.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 84f26025 19-Apr-2018 Johannes Berg <johannes.berg@intel.com>

iwlwifi: don't WARN on trying to dump dead firmware

There's no point in warning here, the user will just get an
error back to the debugfs file write, and warning just makes
it seem like there's an internal consistency problem when in
reality the user just happened to hit this at a bad time.
Remove the warning.

Fixes: f45f979dc208 ("iwlwifi: mvm: disable dbg data collect when fw isn't alive")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 2d8c2615 29-Jan-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: add d3 debug data support

During d3, the firmware records debug data into internal buffer
if debug data collection occurs, collect the data that was written to the
buffer

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b21e32dc 11-Feb-2018 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: turn timestamp marker cmd off by default

Don't enable debugging timestamps by default, so we save power by not
waking up the FW with timestamp commands.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 520f03ea 20-Feb-2018 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: allow masking out memory areas from the fw dump

Reading and dumping memory areas takes time, and sometimes
dumping all of the areas isn't necessary.

Allow choosing the memory areas which should be dumped.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 378c8931 28-Dec-2017 Shahar S Matityahu <shahar.s.matityahu@intel.com>

iwlwifi: wrt: add fw force restart via triggers

We can set triggers that cause a debug data collection when something
of interest happens (e.g. when too many probes are lost conscutively).
Normally, this triggers don't cause the FW to be restarted, but in
some cases that may be desired, so we recover from the problem. To
support this, add a flag that indicates that the FW should be
restarted when the trigger fires.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 759931c7 19-Dec-2017 Mordechay Goodstein <mordechay.goodstein@intel.com>

iwlwifi: set default timstamp marker cmd

In case debug configuration is started with LDBG cmd also start timestamp
marker for syncing logs witn the FW.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 8745f12a 11-Jan-2018 Shaul Triebitz <shaul.triebitz@intel.com>

iwlwifi: avoid collecting firmware dump if not loaded

Trying to collect firmware debug data while firmware
is not loaded causes various errors (e.g. failing NIC access).
This causes even a bigger issue if at that time the
HW radio is off.
In that case, when later turning the radio on, the Driver
fails to read the HW (registers contain garbage values).
(It may be that the CSR_GP_CNTRL_REG_FLAG_RFKILL_WAKE_L1A_EN
bit is cleared on faulty NIC access - since the same behavior
was seen in HW RFKILL toggling before setting that bit.)

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# dfd4b08c 31-Oct-2017 Liad Kaufman <liad.kaufman@intel.com>

iwlwifi: dbg: allow wrt collection before ALIVE

Even if no ALIVE was received, the WRT data can still
be collected. Add this.

Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# b88beaf9 04-Sep-2017 Ilan Peer <ilan.peer@intel.com>

iwlwifi: Add few debug prints to the WRT dump flow

This would enable to better catch timing issues with
cases that WRT dump takes too much time.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 1efc3843 11-Sep-2017 Golan Ben Ami <golan.ben.ami@intel.com>

iwlwifi: stop dbgc recording before stopping DMA

Today we stop the device and the DMA without stopping the dbgc
recording before. This causes host crashes when the DMA
rate is high.

Stop dbgc recording when clearing the fw debug configuration
to fix this.

Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# ce27f005 25-Jun-2017 Golan Ben-Ami <golan.ben.ami@intel.com>

iwlwifi: dump smem configuration when firmware crashes

Add the smem configuration to the fw data dump, once
the firmware crashes. This is useful mainly for later
parsing of the smem.

Signed-off-by: Golan Ben-Ami <golan.ben.ami@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>


# 7174beb6 01-Jun-2017 Johannes Berg <johannes.berg@intel.com>

iwlwifi: refactor firmware debug code

Split out the firmware debug code to be more general, so that it
can be used by different subdrivers.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>