[PATCH v4 0/2] DMA IOMMU static calls

Leon Romanovsky posted 2 patches 1 year, 4 months ago
MAINTAINERS                 |   1 +
drivers/iommu/Kconfig       |   2 +-
drivers/iommu/dma-iommu.c   | 121 ++++++++++----------------
drivers/iommu/intel/Kconfig |   1 -
include/linux/device.h      |   5 ++
include/linux/dma-map-ops.h |  39 +++++----
include/linux/iommu-dma.h   | 169 ++++++++++++++++++++++++++++++++++++
kernel/dma/Kconfig          |   6 ++
kernel/dma/Makefile         |   2 +-
kernel/dma/dummy.c          |  21 +++++
kernel/dma/mapping.c        |  90 ++++++++++++++++---
11 files changed, 348 insertions(+), 109 deletions(-)
create mode 100644 include/linux/iommu-dma.h
[PATCH v4 0/2] DMA IOMMU static calls
Posted by Leon Romanovsky 1 year, 4 months ago
Changelog:
v4:
 * Added extra hidden config option to build ops_helper.c without CONFIG_DMA_OPS
 * Tried to keep dma-iommu.c function declaration style.
 * Removed "select DMA_OPS" from intel iommu kconfig. It is not needed.
v3: https://lore.kernel.org/all/cover.1721547902.git.leon@kernel.org/
 * Changed coding style as Christoph asked
 * Moved debug WARN_ON check to dma_set_mask.
 * Slightly updated commit messages
 * Added Greg to the CC list
v2: https://lore.kernel.org/all/cover.1721219730.git.leon@kernel.org/
 * Ditched dma_ops flag in favor of field in struct device (suggested by
   Christoph)
 * Removed CONFIG_DMA_OPS select from dma-iommu.c Kconfig
 * Removed flags field which exist only in default IOMMU
v1: https://lore.kernel.org/all/cover.1721041611.git.leon@kernel.org/
 * Dropped extra layer and called directly to iommu_dma_* functions
 * Added unmap_page and unmap_sg to dummy ops
 * Converted all dma-mapping calls to use iommu directly
 * Updated commit messages
v0: https://lore.kernel.org/all/98d1821780028434ff55b5d2f1feea287409fbc4.1720693745.git.leon@kernel.org/

Leon Romanovsky (2):
  dma: call unconditionally to unmap_page and unmap_sg callbacks
  dma: add IOMMU static calls with clear default ops

 MAINTAINERS                 |   1 +
 drivers/iommu/Kconfig       |   2 +-
 drivers/iommu/dma-iommu.c   | 121 ++++++++++----------------
 drivers/iommu/intel/Kconfig |   1 -
 include/linux/device.h      |   5 ++
 include/linux/dma-map-ops.h |  39 +++++----
 include/linux/iommu-dma.h   | 169 ++++++++++++++++++++++++++++++++++++
 kernel/dma/Kconfig          |   6 ++
 kernel/dma/Makefile         |   2 +-
 kernel/dma/dummy.c          |  21 +++++
 kernel/dma/mapping.c        |  90 ++++++++++++++++---
 11 files changed, 348 insertions(+), 109 deletions(-)
 create mode 100644 include/linux/iommu-dma.h

-- 
2.45.2
Re: [PATCH v4 0/2] DMA IOMMU static calls
Posted by Leon Romanovsky 1 year, 4 months ago
On Wed, Jul 24, 2024 at 09:04:47PM +0300, Leon Romanovsky wrote:

<...>

> Leon Romanovsky (2):
>   dma: call unconditionally to unmap_page and unmap_sg callbacks
>   dma: add IOMMU static calls with clear default ops
> 
>  MAINTAINERS                 |   1 +
>  drivers/iommu/Kconfig       |   2 +-
>  drivers/iommu/dma-iommu.c   | 121 ++++++++++----------------
>  drivers/iommu/intel/Kconfig |   1 -
>  include/linux/device.h      |   5 ++

Greg,

Can you please ack the change in the include/linux/device.h file?

Thanks

>  include/linux/dma-map-ops.h |  39 +++++----
>  include/linux/iommu-dma.h   | 169 ++++++++++++++++++++++++++++++++++++
>  kernel/dma/Kconfig          |   6 ++
>  kernel/dma/Makefile         |   2 +-
>  kernel/dma/dummy.c          |  21 +++++
>  kernel/dma/mapping.c        |  90 ++++++++++++++++---
>  11 files changed, 348 insertions(+), 109 deletions(-)
>  create mode 100644 include/linux/iommu-dma.h
> 
> -- 
> 2.45.2
> 
Re: [PATCH v4 0/2] DMA IOMMU static calls
Posted by Greg Kroah-Hartman 1 year, 4 months ago
On Mon, Aug 05, 2024 at 03:20:50PM +0300, Leon Romanovsky wrote:
> On Wed, Jul 24, 2024 at 09:04:47PM +0300, Leon Romanovsky wrote:
> 
> <...>
> 
> > Leon Romanovsky (2):
> >   dma: call unconditionally to unmap_page and unmap_sg callbacks
> >   dma: add IOMMU static calls with clear default ops
> > 
> >  MAINTAINERS                 |   1 +
> >  drivers/iommu/Kconfig       |   2 +-
> >  drivers/iommu/dma-iommu.c   | 121 ++++++++++----------------
> >  drivers/iommu/intel/Kconfig |   1 -
> >  include/linux/device.h      |   5 ++
> 
> Greg,
> 
> Can you please ack the change in the include/linux/device.h file?

I thought we were trying to get away from adding iommu stuff to struct
device, but oh well :(

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Re: [PATCH v4 0/2] DMA IOMMU static calls
Posted by Christoph Hellwig 1 year, 4 months ago
On Tue, Aug 13, 2024 at 11:58:51AM +0200, Greg Kroah-Hartman wrote:
> I thought we were trying to get away from adding iommu stuff to struct
> device, but oh well :(

Strictly speaking this is DMA-API stuff, despite being related to
dma-iommu.  And yes, I'd like to eventually move this out of
struct device into a separate dma_device, but that's pretty big
lift and for now this uses one of many spare bits without growing the
structure.