iwlwifi: mei: retry mapping the shared area
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Fri, 28 Jan 2022 12:30:55 +0000 (14:30 +0200)
committerKalle Valo <kvalo@kernel.org>
Thu, 3 Feb 2022 08:24:50 +0000 (10:24 +0200)
commit44bf7c4667efe10390aa59eda39833a9a0439b5b
tree160ef1c0dbb62c35e9a3b2ad16adaa8fe82b9027
parente1849784de9b75519f972abd22fb7e9e7bd7f992
iwlwifi: mei: retry mapping the shared area

The shared area is a DMA memory allocated in the host and
mapped so that the host and the CSME firmware can
exchange data. It is mapped through a dedicated PCI device
that is driven by the mei bus driver.

The bus driver is in charge of allocating and mapping this
memory. It also needs to configure the CSME firmware with
a specific set of commands, so that the CSME firmware will
know that this memory is meant to be used by its internal
WLAN module.

For this, the CSME firmware first needs to completely
initialize its WLAN module and only then get the mapping
request.

The problem is that the mei bus enumeration completes
before the WLAN is completely ready. This means that
the WLAN module's initialization is racing with iwlmei's
allocation and mapping flow.

Testing showed a problem in resume flows where iwlmei
was too fast and the DMA mapping failed.

Add a retry mechanism to make sure that we will succeed
to map the memory.

Fixes: 2da4366f9e2c ("iwlwifi: mei: add the driver to allow cooperation with CSME")
Fixes: bcbddc4f9d02 ("iwlwifi: mei: wait before mapping the shared area")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/iwlwifi.20220128142706.cc51e6a6d635.I4b74a082eb8d89f9e4f556a27c4339c15444dc6c@changeid
drivers/net/wireless/intel/iwlwifi/mei/main.c