All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] dma-buf: Flag vmap'ed memory as system or I/O memory
@ 2020-09-14 11:25 ` Thomas Zimmermann
  0 siblings, 0 replies; 57+ messages in thread
From: Thomas Zimmermann @ 2020-09-14 11:25 UTC (permalink / raw)
  To: sumit.semwal, christian.koenig, daniel, airlied, sam,
	mark.cave-ayland, kraxel, davem, maarten.lankhorst, mripard,
	l.stach, linux+etnaviv, christian.gmeiner, jani.nikula,
	joonas.lahtinen, rodrigo.vivi, thierry.reding, jonathanh, pawel,
	m.szyprowski, kyungmin.park, tfiga, mchehab, chris, matthew.auld,
	thomas.hellstrom
  Cc: linux-media, dri-devel, linaro-mm-sig, etnaviv, intel-gfx,
	linux-tegra, sparclinux, Thomas Zimmermann

Dma-buf provides vmap() and vunmap() for retrieving and releasing mappings
of dma-buf memory in kernel address space. The functions operate with plain
addresses and the assumption is that the memory can be accessed with load
and store operations. This is not the case on some architectures (e.g.,
sparc64) where I/O memory can only be accessed with dedicated instructions.

This patchset introduces struct dma_buf_map, which contains the address of
a buffer and a flag that tells whether system- or I/O-memory instructions
are required.

Some background: updating the DRM framebuffer console on sparc64 makes the
kernel panic. This is because the framebuffer memory cannot be accessed with
system-memory instructions. We currently employ a workaround in DRM to
address this specific problem. [1]

To resolve the problem, we'd like to address it at the most common point,
which is the dma-buf framework. The dma-buf mapping ideally knows if I/O
instructions are required and exports this information to it's users. The
new structure struct dma_buf_map stores the buffer address and a flag that
signals I/O memory. Affected users of the buffer (e.g., drivers, frameworks)
can then access the memory accordingly.

This patchset only introduces struct dma_buf_map, and updates struct dma_buf
and it's interfaces. Further patches can update dma-buf users. For example,
there's a prototype patchset for DRM that fixes the framebuffer problem. [2]

Further work: TTM, one of DRM's memory managers, already exports an
is_iomem flag of its own. It could later be switched over to exporting struct
dma_buf_map, thus simplifying some code. Several DRM drivers expect their
fbdev console to operate on I/O memory. These could possibly be switched over
to the generic fbdev emulation, as soon as the generic code uses struct
dma_buf_map.

[1] https://lore.kernel.org/dri-devel/20200725191012.GA434957@ravnborg.org/
[2] https://lore.kernel.org/dri-devel/20200806085239.4606-1-tzimmermann@suse.de/

Thomas Zimmermann (3):
  dma-buf: Add struct dma-buf-map for storing struct dma_buf.vaddr_ptr
  dma-buf: Use struct dma_buf_map in dma_buf_vmap() interfaces
  dma-buf: Use struct dma_buf_map in dma_buf_vunmap() interfaces

 Documentation/driver-api/dma-buf.rst          |   3 +
 drivers/dma-buf/dma-buf.c                     |  40 +++---
 drivers/gpu/drm/drm_gem_cma_helper.c          |  16 ++-
 drivers/gpu/drm/drm_gem_shmem_helper.c        |  17 ++-
 drivers/gpu/drm/drm_prime.c                   |  14 +-
 drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c   |  13 +-
 drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c    |  13 +-
 .../drm/i915/gem/selftests/i915_gem_dmabuf.c  |  18 ++-
 drivers/gpu/drm/tegra/gem.c                   |  23 ++--
 .../common/videobuf2/videobuf2-dma-contig.c   |  17 ++-
 .../media/common/videobuf2/videobuf2-dma-sg.c |  19 ++-
 .../common/videobuf2/videobuf2-vmalloc.c      |  21 ++-
 include/drm/drm_prime.h                       |   5 +-
 include/linux/dma-buf-map.h                   | 126 ++++++++++++++++++
 include/linux/dma-buf.h                       |  11 +-
 15 files changed, 274 insertions(+), 82 deletions(-)
 create mode 100644 include/linux/dma-buf-map.h

--
2.28.0


^ permalink raw reply	[flat|nested] 57+ messages in thread

end of thread, other threads:[~2020-09-18  8:44 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 11:25 [PATCH 0/3] dma-buf: Flag vmap'ed memory as system or I/O memory Thomas Zimmermann
2020-09-14 11:25 ` [Intel-gfx] " Thomas Zimmermann
2020-09-14 11:25 ` Thomas Zimmermann
2020-09-14 11:25 ` Thomas Zimmermann
2020-09-14 11:25 ` [PATCH 1/3] dma-buf: Add struct dma-buf-map for storing struct dma_buf.vaddr_ptr Thomas Zimmermann
2020-09-14 11:25   ` [Intel-gfx] " Thomas Zimmermann
2020-09-14 11:25   ` Thomas Zimmermann
2020-09-14 11:25   ` Thomas Zimmermann
2020-09-14 11:25 ` [PATCH 2/3] dma-buf: Use struct dma_buf_map in dma_buf_vmap() interfaces Thomas Zimmermann
2020-09-14 11:25   ` [Intel-gfx] " Thomas Zimmermann
2020-09-14 11:25   ` Thomas Zimmermann
2020-09-14 11:25   ` Thomas Zimmermann
2020-09-14 18:33   ` [Intel-gfx] " kernel test robot
2020-09-14 23:54   ` kernel test robot
2020-09-15  1:56   ` kernel test robot
2020-09-16  9:35   ` Daniel Vetter
2020-09-16  9:35     ` [Intel-gfx] " Daniel Vetter
2020-09-16  9:35     ` Daniel Vetter
2020-09-16  9:35     ` Daniel Vetter
2020-09-14 11:25 ` [PATCH 3/3] dma-buf: Use struct dma_buf_map in dma_buf_vunmap() interfaces Thomas Zimmermann
2020-09-14 11:25   ` [Intel-gfx] " Thomas Zimmermann
2020-09-14 11:25   ` Thomas Zimmermann
2020-09-14 11:25   ` Thomas Zimmermann
2020-09-14 17:22   ` [Intel-gfx] " kernel test robot
2020-09-14 19:28   ` kernel test robot
2020-09-14 17:41 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for dma-buf: Flag vmap'ed memory as system or I/O memory Patchwork
2020-09-16  9:37 ` [PATCH 0/3] " Daniel Vetter
2020-09-16  9:37   ` [Intel-gfx] " Daniel Vetter
2020-09-16  9:37   ` Daniel Vetter
2020-09-16  9:37   ` Daniel Vetter
2020-09-16 10:48   ` Thomas Zimmermann
2020-09-16 10:48     ` [Intel-gfx] " Thomas Zimmermann
2020-09-16 10:48     ` Thomas Zimmermann
2020-09-16 10:48     ` Thomas Zimmermann
2020-09-16 12:24     ` Daniel Vetter
2020-09-16 12:24       ` [Intel-gfx] " Daniel Vetter
2020-09-16 12:24       ` Daniel Vetter
2020-09-16 12:24       ` Daniel Vetter
2020-09-16 12:59       ` Christian König
2020-09-16 12:59         ` [Intel-gfx] " Christian König
2020-09-16 12:59         ` Christian König
2020-09-16 12:59         ` Christian König
2020-09-16 13:12         ` Thomas Zimmermann
2020-09-16 13:12           ` [Intel-gfx] " Thomas Zimmermann
2020-09-16 13:12           ` Thomas Zimmermann
2020-09-16 13:12           ` Thomas Zimmermann
2020-09-16 13:37         ` Thomas Hellström (Intel)
2020-09-17  7:16           ` Thomas Zimmermann
2020-09-17  8:04             ` Christian König
2020-09-18  6:06 ` Sumit Semwal
2020-09-18  6:18   ` Sumit Semwal
2020-09-18  6:06   ` [Intel-gfx] " Sumit Semwal
2020-09-18  6:06   ` Sumit Semwal
2020-09-18  8:32   ` Sumit Semwal
2020-09-18  8:44     ` Sumit Semwal
2020-09-18  8:32     ` [Intel-gfx] " Sumit Semwal
2020-09-18  8:32     ` Sumit Semwal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.