• Emmanuel Grumbach's avatar
    iwlwifi: mei: retry mapping the shared area · 44bf7c46
    Emmanuel Grumbach authored
    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: 2da4366f ("iwlwifi: mei: add the driver to allow cooperation with CSME")
    Fixes: bcbddc4f ("iwlwifi: mei: wait before mapping the shared area")
    Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
    Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
    Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
    Link: https://lore.kernel.org/r/iwlwifi.20220128142706.cc51e6a6d635.I4b74a082eb8d89f9e4f556a27c4339c15444dc6c@changeid
    44bf7c46
main.c 50.7 KB