]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
swiotlb: max mapping size takes min align mask into account
authorTianyu Lan <Tianyu.Lan@microsoft.com>
Tue, 10 May 2022 14:21:09 +0000 (10:21 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 14 Nov 2022 10:25:29 +0000 (11:25 +0100)
commit1b3301517e5c4175c5df9b5ffd0a04be5e1d030f
treeafb3dbb0ce794c06851643db2f19d4b282af4890
parentc15723f0dfd1f654253d26c1d2974766e0e14503
swiotlb: max mapping size takes min align mask into account

BugLink: https://bugs.launchpad.net/bugs/1995517
commit 82806744fd7dde603b64c151eeddaa4ee62193fd upstream.

swiotlb_find_slots() skips slots according to io tlb aligned mask
calculated from min aligned mask and original physical address
offset. This affects max mapping size. The mapping size can't
achieve the IO_TLB_SEGSIZE * IO_TLB_SIZE when original offset is
non-zero. This will cause system boot up failure in Hyper-V
Isolation VM where swiotlb force is enabled. Scsi layer use return
value of dma_max_mapping_size() to set max segment size and it
finally calls swiotlb_max_mapping_size(). Hyper-V storage driver
sets min align mask to 4k - 1. Scsi layer may pass 256k length of
request buffer with 0~4k offset and Hyper-V storage driver can't
get swiotlb bounce buffer via DMA API. Swiotlb_find_slots() can't
find 256k length bounce buffer with offset. Make swiotlb_max_mapping
_size() take min align mask into account.

Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rishabh Bhatnagar <risbhat@amazon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
kernel/dma/swiotlb.c