summaryrefslogtreecommitdiffstats
path: root/Documentation/netlink/specs
diff options
context:
space:
mode:
authorPetr Tesarik <petr.tesarik1@huawei-partners.com>2024-03-25 09:31:04 +0100
committerChristoph Hellwig <hch@lst.de>2024-04-02 17:07:57 +0200
commitaf133562d5aff41fcdbe51f1a504ae04788b5fc0 (patch)
tree844dc0a716055379a5ecc3610b011199c8ba0353 /Documentation/netlink/specs
parent026e680b0a08a62b1d948e5a8ca78700bfac0e6e (diff)
downloadlinux-stable-af133562d5aff41fcdbe51f1a504ae04788b5fc0.tar.gz
linux-stable-af133562d5aff41fcdbe51f1a504ae04788b5fc0.tar.bz2
linux-stable-af133562d5aff41fcdbe51f1a504ae04788b5fc0.zip
swiotlb: extend buffer pre-padding to alloc_align_mask if necessary
Allow a buffer pre-padding of up to alloc_align_mask, even if it requires allocating additional IO TLB slots. If the allocation alignment is bigger than IO_TLB_SIZE and min_align_mask covers any non-zero bits in the original address between IO_TLB_SIZE and alloc_align_mask, these bits are not preserved in the swiotlb buffer address. To fix this case, increase the allocation size and use a larger offset within the allocated buffer. As a result, extra padding slots may be allocated before the mapping start address. Leave orig_addr in these padding slots initialized to INVALID_PHYS_ADDR. These slots do not correspond to any CPU buffer, so attempts to sync the data should be ignored. The padding slots should be automatically released when the buffer is unmapped. However, swiotlb_tbl_unmap_single() takes only the address of the DMA buffer slot, not the first padding slot. Save the number of padding slots in struct io_tlb_slot and use it to adjust the slot index in swiotlb_release_slots(), so all allocated slots are properly freed. Fixes: 2fd4fa5d3fb5 ("swiotlb: Fix alignment checks when both allocation and DMA masks are present") Link: https://lore.kernel.org/linux-iommu/20240311210507.217daf8b@meshulam.tesarici.cz/ Signed-off-by: Petr Tesarik <petr.tesarik1@huawei-partners.com> Reviewed-by: Michael Kelley <mhklinux@outlook.com> Tested-by: Michael Kelley <mhklinux@outlook.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'Documentation/netlink/specs')
0 files changed, 0 insertions, 0 deletions