> - dev->ctrl.max_hw_sectors = min_t(u32,
> - NVME_MAX_KB_SZ << 1, dma_opt_mapping_size(&pdev->dev) >> 9);
> + dev->ctrl.max_hw_sectors = min3(NVME_MAX_KB_SZ << 1,
> + dma_opt_mapping_size(&pdev->dev) >> 9,
> + dma_max_mapping_size(&pdev->dev) >> 9);
dma_opt_mapping_size is already capped by dma_max_mapping_size, so no
need for this hunk.
> dev->ctrl.max_segments = NVME_MAX_SEGS;
>
> /*
> diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
> index 946bd56f0ac53..0e6c6c25d154f 100644
> --- a/drivers/xen/swiotlb-xen.c
> +++ b/drivers/xen/swiotlb-xen.c
> @@ -405,4 +405,5 @@ const struct dma_map_ops xen_swiotlb_dma_ops = {
> .get_sgtable = dma_common_get_sgtable,
> .alloc_pages = dma_common_alloc_pages,
> .free_pages = dma_common_free_pages,
> + .max_mapping_size = swiotlb_max_mapping_size,
> };
> --
And this is the right thing to do. I'm pretty sure I wrote this
myself a while ago, but I must not have sent it out in the end.