linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@kernel.org>
To: Luca Coelho <luca@coelho.fi>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH for v5.17 6/8] iwlwifi: mei: retry mapping the shared area
Date: Thu, 03 Feb 2022 10:16:03 +0200	[thread overview]
Message-ID: <87leyscqm4.fsf@kernel.org> (raw)
In-Reply-To: <iwlwifi.20220128142706.cc51e6a6d635.I4b74a082eb8d89f9e4f556a27c4339c15444dc6c@changeid> (Luca Coelho's message of "Fri, 28 Jan 2022 14:30:55 +0200")

Luca Coelho <luca@coelho.fi> writes:

> From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
>
> 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")
> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> Fixes: bcbddc4f9d02 ("iwlwifi: mei: wait before mapping the shared area")

I'll move the latter Fixes before s-o-b tag.

> -	/*
> -	 * The CSME firmware needs to boot the internal WLAN client. Wait here
> -	 * so that the DMA map request will succeed.
> -	 */
> -	msleep(20);
> +	do {
> +		ret = iwl_mei_alloc_shared_mem(cldev);
> +		if (!ret)
> +			break;
> +		/*
> +		 * The CSME firmware needs to boot the internal WLAN client.
> +		 * This can take time in certain configurations (usually
> +		 * upon resume and when the whole CSME firmware is shut down
> +		 * during suspend).
> +		 *
> +		 * Wait a bit before retrying and hope we'll succeed next time.
> +		 */
>  
> -	ret = iwl_mei_alloc_shared_mem(cldev);
> -	if (ret)
> +		dev_dbg(&cldev->dev,
> +			"Couldn't allocate the shared memory: %d, attempt %d / %d\n",
> +			ret, alloc_retry, ALLOC_SHARED_MEM_RETRY_MAX_NUM);
> +		msleep(100);
> +		alloc_retry--;
> +	} while (alloc_retry);

Nitpicking, but this could have been:

while (alloc_retry--);

But no need to resend because of this.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

  reply	other threads:[~2022-02-03  8:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 12:30 [PATCH for v5.17 0/8] iwlwifi: fixes intended for v5.17 2022-01-28 Luca Coelho
2022-01-28 12:30 ` [PATCH for v5.17 1/8] iwlwifi: mvm: fix condition which checks the version of rate_n_flags Luca Coelho
2022-02-03  8:25   ` Kalle Valo
2022-01-28 12:30 ` [PATCH for v5.17 2/8] iwlwifi: fix iwl_legacy_rate_to_fw_idx Luca Coelho
2022-01-28 12:30 ` [PATCH for v5.17 3/8] iwlwifi: pcie: fix locking when "HW not ready" Luca Coelho
2022-01-28 12:30 ` [PATCH for v5.17 4/8] iwlwifi: pcie: gen2: " Luca Coelho
2022-01-28 12:30 ` [PATCH for v5.17 5/8] iwlwifi: mei: fix the pskb_may_pull check in ipv4 Luca Coelho
2022-01-28 12:30 ` [PATCH for v5.17 6/8] iwlwifi: mei: retry mapping the shared area Luca Coelho
2022-02-03  8:16   ` Kalle Valo [this message]
2022-01-28 12:30 ` [PATCH for v5.17 7/8] iwlwifi: mvm: don't feed the hardware RFKILL into iwlmei Luca Coelho
2022-01-28 12:30 ` [PATCH for v5.17 8/8] iwlwifi: mei: report RFKILL upon register when needed Luca Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87leyscqm4.fsf@kernel.org \
    --to=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luca@coelho.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).