summaryrefslogtreecommitdiff
path: root/drivers/amba
diff options
context:
space:
mode:
authorLu Baolu <baolu.lu@linux.intel.com>2022-04-18 03:49:51 +0300
committerJoerg Roedel <jroedel@suse.de>2022-04-28 16:32:20 +0300
commit25f3bcfc54bcf7b0e45d140ec8bfbbf10ba11869 (patch)
tree2d4047c7edde658fce81efe6038e7be73610139f /drivers/amba
parent1ea2a07a532b0e22aabe7e8483f935c672b9e7ed (diff)
downloadlinux-25f3bcfc54bcf7b0e45d140ec8bfbbf10ba11869.tar.xz
driver core: Add dma_cleanup callback in bus_type
The bus_type structure defines dma_configure() callback for bus drivers to configure DMA on the devices. This adds the paired dma_cleanup() callback and calls it during driver unbinding so that bus drivers can do some cleanup work. One use case for this paired DMA callbacks is for the bus driver to check for DMA ownership conflicts during driver binding, where multiple devices belonging to a same IOMMU group (the minimum granularity of isolation and protection) may be assigned to kernel drivers or user space respectively. Without this change, for example, the vfio driver has to listen to a bus BOUND_DRIVER event and then BUG_ON() in case of dma ownership conflict. This leads to bad user experience since careless driver binding operation may crash the system if the admin overlooks the group restriction. Aside from bad design, this leads to a security problem as a root user, even with lockdown=integrity, can force the kernel to BUG. With this change, the bus driver could check and set the DMA ownership in driver binding process and fail on ownership conflicts. The DMA ownership should be released during driver unbinding. Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/20220418005000.897664-3-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/amba')
0 files changed, 0 insertions, 0 deletions