[PATCH] nvme-apple: fix DMA-API warning

Eric Curtin ecurtin at redhat.com
Wed Oct 12 05:10:47 PDT 2022


On Wed, 12 Oct 2022 at 12:53, Russell King (Oracle)
<rmk+kernel at armlinux.org.uk> wrote:
>
> Fix the following DMA-API warning:
>
> DMA-API: nvme-apple 27bcc0000.nvme: mapping sg segment longer than device claims to support [len=69632] [max=65536]
> WARNING: CPU: 3 PID: 1 at kernel/dma/debug.c:1160 debug_dma_map_sg+0x310/0x3a0
> Modules linked in: tps6598x roles typec rtc_macsmc gpio_macsmc nvme_apple apple_mailbox apple_sart pcie_apple macsmc_rtkit macsmc pinctrl_apple_gpio i2c_apple
> CPU: 3 PID: 1 Comm: init Not tainted 6.0.0+ #1081
> Hardware name: Apple Mac mini (M1, 2020) (DT)
> pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> pc : debug_dma_map_sg+0x310/0x3a0
> lr : debug_dma_map_sg+0x310/0x3a0
> ...
> Call trace:
>  debug_dma_map_sg+0x310/0x3a0
>  __dma_map_sg_attrs+0x98/0xf4
>  dma_map_sg_attrs+0xc/0x1c
>  apple_nvme_queue_rq+0x218/0x67c [nvme_apple]
>  blk_mq_dispatch_rq_list+0x198/0x81c
>  blk_mq_do_dispatch_sched+0x2b0/0x340
>  __blk_mq_sched_dispatch_requests+0x104/0x154
>  blk_mq_sched_dispatch_requests+0x38/0x70
>  __blk_mq_run_hw_queue+0x80/0x130
>  __blk_mq_delay_run_hw_queue+0x84/0x90
>  blk_mq_run_hw_queue+0x134/0x170
>  blk_mq_sched_insert_requests+0xec/0x300
>  blk_mq_flush_plug_list+0x104/0x430
>  __blk_flush_plug+0xe8/0x130
>  blk_finish_plug+0x30/0x1f0
>  read_pages+0x1ec/0x334
>  page_cache_ra_unbounded+0x158/0x1bc
>  page_cache_ra_order+0x80/0x2c0
>  filemap_fault+0x4bc/0x970
>  __do_fault+0x38/0x144
>  __handle_mm_fault+0x7c4/0xc60
>  handle_mm_fault+0x120/0x2a0
>  do_page_fault+0x130/0x47c
>  do_translation_fault+0xa0/0xb0
>  do_mem_abort+0x40/0x90
>  el0_da+0x2c/0x80
>  el0t_64_sync_handler+0x60/0xb4
>  el0t_64_sync+0x168/0x16c
> ---[ end trace 0000000000000000 ]---
>
> Suggested-by: Sven Peter <sven at svenpeter.dev>
> Signed-off-by: Russell King (Oracle) <rmk+kernel at armlinux.org.uk>

Seems reasonable, the same as nvme_reset_work, wouldn't be the worst
thing in the world if we duplicated the "Don't limit the IOMMU merged
segment size" comment from the generic driver for the apple version
also if there ends up being a v2.

Reviewed-by: Eric Curtin <ecurtin at redhat.com>


> ---
>  drivers/nvme/host/apple.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c
> index 5fc5ea196b40..ff8b083dc5c6 100644
> --- a/drivers/nvme/host/apple.c
> +++ b/drivers/nvme/host/apple.c
> @@ -1039,6 +1039,8 @@ static void apple_nvme_reset_work(struct work_struct *work)
>                                          dma_max_mapping_size(anv->dev) >> 9);
>         anv->ctrl.max_segments = NVME_MAX_SEGS;
>
> +       dma_set_max_seg_size(anv->dev, 0xffffffff);
> +
>         /*
>          * Enable NVMMU and linear submission queues.
>          * While we could keep those disabled and pretend this is slightly
> --
> 2.30.2
>
>




More information about the linux-arm-kernel mailing list