Revert "BACKPORT: FROMGIT: ath10k: pci: use mutex for diagnostic window CE polling"

This reverts commit 1a421f6d0797fcc28207292383fb7da53d3e524d.

Reason for revert: caused regressions during firmware crashes.
See chromium:945504

Original change's description:
> BACKPORT: FROMGIT: ath10k: pci: use mutex for diagnostic window CE polling
>
> The DIAG copy engine is only used via polling, but it holds a spinlock
> with softirqs disabled. Each iteration of our read/write loops can
> theoretically take 20ms (two 10ms timeout loops), and this loop can be
> run an unbounded number of times while holding the spinlock -- dependent
> on the request size given by the caller.
>
> As of commit 39501ea64116 ("ath10k: download firmware via diag Copy
> Engine for QCA6174 and QCA9377."), we transfer large chunks of firmware
> memory using this mechanism. With large enough firmware segments, this
> becomes an exceedingly long period for disabling soft IRQs. For example,
> with a 500KiB firmware segment, in testing QCA6174A, I see 200 loop
> iterations of about 50-100us each, which can total about 10-20ms.
>
> In reality, we don't really need to block softirqs for this duration.
> The DIAG CE is only used in polling mode, and we only need to hold
> ce_lock to make sure any CE bookkeeping is done without screwing up
> another CE. Otherwise, we only need to ensure exclusion between
> ath10k_pci_diag_{read,write}_mem() contexts.
>
> This patch moves to use fine-grained locking for the shared ce_lock,
> while adding a new mutex just to ensure mutual exclusion of diag
> read/write operations.
>
> Tested on QCA6174A, firmware version WLAN.RM.4.4.1-00132-QCARMSWPZ-1.
>
> Fixes: 39501ea64116 ("ath10k: download firmware via diag Copy Engine for QCA6174 and QCA9377.")
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
> (cherry picked from commit 25733c4e67df7f29a599bbd9ed313c172d72a02b
>  https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git ath-next)
>
> Conflicts:
>   drivers/net/wireless/ar10k/ath/ath10k/pci.c
>   [missing some additional CE indirection from upstream; adapted to the
>   similar calls in our version of ar10k]
>
> BUG=chromium:925959
> TEST=QCA6174A and WCN3990 -- suite:wifi_matfunc; reboot and
>      suspend/resume tests (watching firmware initialization time)
> TEST=benchmark msleep()/softirq delays
>
> Change-Id: I9cee7f421d309e20042e93908fd24004a1acc90d
> Reviewed-on: https://chromium-review.googlesource.com/1475803
> Commit-Ready: Brian Norris <briannorris@chromium.org>
> Tested-by: Brian Norris <briannorris@chromium.org>
> Reviewed-by: Brian Norris <briannorris@chromium.org>

BUG=chromium:925959, chromium:945504
TEST=force a firmware crash; e.g.,
     dd if=/sys/kernel/debug/ieee80211/phy0/ath10k/mem_value bs=4K \
       count=1 of=/dev/null

Change-Id: I98bac9d7a8cbd311ba90c7af97becba7e9863e42
Reviewed-on: https://chromium-review.googlesource.com/1540254
Commit-Ready: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
2 files changed