Re: WinLink E850-96: WARNING: at block/blk-settings.c:204 blk_validate_limits

From: Sam Protsenko
Date: Fri Mar 01 2024 - 15:52:20 EST


On Thu, Feb 29, 2024 at 8:56 AM Arnd Bergmann <arnd@xxxxxxxx> wrote:
>
> On Thu, Feb 29, 2024, at 15:14, Naresh Kamboju wrote:
> > The arm64 WinLink E850-96 Board boot failed with 16K and 64K page size builds
> > Please find the below warning log on Linux next-20240229.
> > First noticed on the next-20240220 tag.
> >
> > This issue arises only when one of these Kconfig options is enabled.
> > CONFIG_ARM64_16K_PAGES=y
> > CONFIG_ARM64_64K_PAGES=y
> >
> > Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
> >
> > Warning log:
> > -------
> > [ 2.231008] mmc_host mmc0: Bus speed (slot 0) = 49968750Hz (slot
> > req 52000000Hz, actual 49968750HZ div = 0)
> > [ 2.231714] mmc_host mmc0: Bus speed (slot 0) = 399750000Hz (slot
> > req 200000000Hz, actual 199875000HZ div = 1)
> > [ 2.241961] mmc0: new HS400 Enhanced strobe MMC card at address 0001
> > [ 2.249182] ------------[ cut here ]------------
> > [ 2.252371] WARNING: CPU: 3 PID: 90 at block/blk-settings.c:204
> > blk_validate_limits (block/blk-settings.c:204 (discriminator 1))
>
>
> The warning was added with commit d690cb8ae14b ("block: add
> an API to atomically update queue limits")
>
> + if (!lim->max_segment_size)
> + lim->max_segment_size = BLK_MAX_SEGMENT_SIZE;
> + if (WARN_ON_ONCE(lim->max_segment_size < PAGE_SIZE))
> + return -EINVAL;
>
> Whereas mmc_alloc_disk sets the limit as
>
> /*
> * Setting a virt_boundary implicity sets a max_segment_size, so try
> * to set the hardware one here.
> */
> if (host->can_dma_map_merge) {
> lim.virt_boundary_mask = dma_get_merge_boundary(mmc_dev(host));
> lim.max_segments = MMC_DMA_MAP_MERGE_SEGMENTS;
> } else {
> lim.max_segment_size =
> round_down(host->max_seg_size, lim.logical_block_size);
> lim.max_segments = host->max_segs;
> }
>
> and max_seg_size gets initialized to either one less
> than 64k, or to exactly 4k in the dwmmc driver here:
>
> /* Useful defaults if platform data is unset. */
> if (host->use_dma == TRANS_MODE_IDMAC) {
> mmc->max_segs = host->ring_size;
> mmc->max_blk_size = 65535;

Changing this value here to PAGE_SIZE (instead of 65535) makes E850-96
functional again (tested with CONFIG_ARM64_16K_PAGES=y). I'm sure this
is just a quick hack, but maybe it can be helpful in further analysis.
If anybody wants me to run some tests on E850-96 -- please let me
know.

[snip]