Linux Tegra architecture development
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh@nvidia.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
	Thierry Reding <thierry.reding@gmail.com>,
	linux-tegra@vger.kernel.org, linux-mmc@vger.kernel.org
Subject: Re: [PATCH] mmc: sdhci: Fix max_seg_size for 64KiB PAGE_SIZE
Date: Thu, 11 Jul 2024 10:47:11 +0100	[thread overview]
Message-ID: <ffbc49d0-8f4c-4c76-8caa-21203076a592@nvidia.com> (raw)
In-Reply-To: <20240710180737.142504-1-adrian.hunter@intel.com>


On 10/07/2024 19:07, Adrian Hunter wrote:
> blk_queue_max_segment_size() ensured:
> 
> 	if (max_size < PAGE_SIZE)
> 		max_size = PAGE_SIZE;
> 
> whereas:
> 
> blk_validate_limits() makes it an error:
> 
> 	if (WARN_ON_ONCE(lim->max_segment_size < PAGE_SIZE))
> 		return -EINVAL;
> 
> The change from one to the other, exposed sdhci which was setting maximum
> segment size too low in some circumstances.
> 
> Fix the maximum segment size when it is too low.
> 
> Fixes: 616f87661792 ("mmc: pass queue_limits to blk_mq_alloc_disk")
> Cc: stable@vger.kernel.org
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>   drivers/mmc/host/sdhci.c | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index a20df9383b20..4b91c9e96635 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -4708,6 +4708,21 @@ int sdhci_setup_host(struct sdhci_host *host)
>   		if (host->quirks & SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC) {
>   			host->max_adma = 65532; /* 32-bit alignment */
>   			mmc->max_seg_size = 65535;
> +			/*
> +			 * sdhci_adma_table_pre() expects to define 1 DMA
> +			 * descriptor per segment, so the maximum segment size
> +			 * is set accordingly. SDHCI allows up to 64KiB per DMA
> +			 * descriptor (16-bit field), but some controllers do
> +			 * not support "zero means 65536" reducing the maximum
> +			 * for them to 65535. That is a problem if PAGE_SIZE is
> +			 * 64KiB because the block layer does not support
> +			 * max_seg_size < PAGE_SIZE, however
> +			 * sdhci_adma_table_pre() has a workaround to handle
> +			 * that case, and split the descriptor. Refer also
> +			 * comment in sdhci_adma_table_pre().
> +			 */
> +			if (mmc->max_seg_size < PAGE_SIZE)
> +				mmc->max_seg_size = PAGE_SIZE;
>   		} else {
>   			mmc->max_seg_size = 65536;
>   		}

Acked-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>

Thanks!
Jon
-- 
nvpublic

  parent reply	other threads:[~2024-07-11  9:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-10 18:07 [PATCH] mmc: sdhci: Fix max_seg_size for 64KiB PAGE_SIZE Adrian Hunter
2024-07-11  4:01 ` Christoph Hellwig
2024-07-11  5:17   ` Adrian Hunter
2024-07-11  6:48     ` Christoph Hellwig
2024-07-11  9:47 ` Jon Hunter [this message]
2024-07-11 16:03 ` Ulf Hansson

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=ffbc49d0-8f4c-4c76-8caa-21203076a592@nvidia.com \
    --to=jonathanh@nvidia.com \
    --cc=adrian.hunter@intel.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=ulf.hansson@linaro.org \
    /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