]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
swiotlb: Support aligned swiotlb buffers
authorDavid Stevens <stevensd@chromium.org>
Wed, 29 Sep 2021 02:32:59 +0000 (11:32 +0900)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:40:27 +0000 (14:40 +0200)
commita9e3bd56f3e8ce2d2ad86ebe472126ba3096cb0e
treee8604bc45b34f41ed90913877906b49a6cc0fa20
parent7104db629258a3c9ab52a1bc475147cbeed48bff
swiotlb: Support aligned swiotlb buffers

BugLink: https://bugs.launchpad.net/bugs/1969110
commit e81e99bacc9f9347bda7808a949c1ce9fcc2bbf4 upstream.

Add an argument to swiotlb_tbl_map_single that specifies the desired
alignment of the allocated buffer. This is used by dma-iommu to ensure
the buffer is aligned to the iova granule size when using swiotlb with
untrusted sub-granule mappings. This addresses an issue where adjacent
slots could be exposed to the untrusted device if IO_TLB_SIZE < iova
granule < PAGE_SIZE.

Signed-off-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20210929023300.335969-7-stevensd@google.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Cc: Mario Limonciello <Mario.Limonciello@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 3e44e136560cb66dd5156889f811b870789b9499)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/iommu/dma-iommu.c
drivers/xen/swiotlb-xen.c
include/linux/swiotlb.h
kernel/dma/swiotlb.c