lkml.org 
[lkml]   [2022]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 04/11] bus: platform,amba,fsl-mc,PCI: Add device DMA ownership management
On Fri, Feb 18, 2022 at 08:55:14AM +0800, Lu Baolu wrote:
> The devices on platform/amba/fsl-mc/PCI buses could be bound to drivers
> with the device DMA managed by kernel drivers or user-space applications.
> Unfortunately, multiple devices may be placed in the same IOMMU group
> because they cannot be isolated from each other. The DMA on these devices
> must either be entirely under kernel control or userspace control, never
> a mixture. Otherwise the driver integrity is not guaranteed because they
> could access each other through the peer-to-peer accesses which by-pass
> the IOMMU protection.
>
> This checks and sets the default DMA mode during driver binding, and
> cleanups during driver unbinding. In the default mode, the device DMA is
> managed by the device driver which handles DMA operations through the
> kernel DMA APIs (see Documentation/core-api/dma-api.rst).
>
> For cases where the devices are assigned for userspace control through the
> userspace driver framework(i.e. VFIO), the drivers(for example, vfio_pci/
> vfio_platfrom etc.) may set a new flag (driver_managed_dma) to skip this
> default setting in the assumption that the drivers know what they are
> doing with the device DMA.
>
> With the IOMMU layer knowing DMA ownership of each device, above problem
> can be solved.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Stuart Yoder <stuyoder@gmail.com>
> Cc: Laurentiu Tudor <laurentiu.tudor@nxp.com>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
> include/linux/amba/bus.h | 8 ++++++++
> include/linux/fsl/mc.h | 8 ++++++++
> include/linux/pci.h | 8 ++++++++
> include/linux/platform_device.h | 8 ++++++++
> drivers/amba/bus.c | 20 ++++++++++++++++++++
> drivers/base/platform.c | 20 ++++++++++++++++++++
> drivers/bus/fsl-mc/fsl-mc-bus.c | 26 ++++++++++++++++++++++++--
> drivers/pci/pci-driver.c | 21 +++++++++++++++++++++
> 8 files changed, 117 insertions(+), 2 deletions(-)

For the platform.c stuff:

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


thanks for renaming this.

greg k-h

\
 
 \ /
  Last update: 2022-02-18 08:56    [W:0.226 / U:1.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site