From: Tomasz Figa <tfiga@chromium.org>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: sumit.semwal@linaro.org, christian.koenig@amd.com, afd@ti.com,
corbet@lwn.net, benjamin.gaignard@linaro.org,
lmark@codeaurora.org, labbott@redhat.com, Brian.Starkey@arm.com,
john.stultz@linaro.org, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, airlied@linux.ie, daniel@ffwll.ch,
l.stach@pengutronix.de, linux+etnaviv@armlinux.org.uk,
christian.gmeiner@gmail.com, jani.nikula@linux.intel.com,
joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com,
thierry.reding@gmail.com, jonathanh@nvidia.com, pawel@osciak.com,
m.szyprowski@samsung.com, kyungmin.park@samsung.com,
mchehab@kernel.org, matthew.auld@intel.com, robin.murphy@arm.com,
thomas.hellstrom@intel.com, sam@ravnborg.org, kraxel@redhat.com,
arnd@arndb.de, gregkh@linuxfoundation.org,
linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
linaro-mm-sig@lists.linaro.org, linux-doc@vger.kernel.org,
etnaviv@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
linux-tegra@vger.kernel.org
Subject: Re: [PATCH v3 0/4] dma-buf: Flag vmap'ed memory as system or I/O memory
Date: Fri, 25 Sep 2020 18:57:19 +0000 [thread overview]
Message-ID: <20200925185719.GD3607091@chromium.org> (raw)
In-Reply-To: <20200925115601.23955-1-tzimmermann@suse.de>
Hi Thomas,
On Fri, Sep 25, 2020 at 01:55:57PM +0200, Thomas Zimmermann wrote:
> Dma-buf provides vmap() and vunmap() for retriving 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.
>
> v3:
> * update fastrpc driver (kernel test robot)
> * expand documentation (Daniel)
> * move documentation into separate patch
> v2:
> * always clear map parameter in dma_buf_vmap() (Daniel)
> * include dma-buf-heaps and i915 selftests (kernel test robot)
> * initialize cma_obj before using it in drm_gem_cma_free_object()
> (kernel test robot)
>
> [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 (4):
> 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
> dma-buf: Document struct dma_buf_map
>
> Documentation/driver-api/dma-buf.rst | 9 +
> drivers/dma-buf/dma-buf.c | 42 ++--
> drivers/dma-buf/heaps/heap-helpers.c | 10 +-
> drivers/gpu/drm/drm_gem_cma_helper.c | 20 +-
> drivers/gpu/drm/drm_gem_shmem_helper.c | 17 +-
> drivers/gpu/drm/drm_prime.c | 15 +-
> 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 +-
> .../gpu/drm/i915/gem/selftests/mock_dmabuf.c | 14 +-
> 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 +-
> drivers/misc/fastrpc.c | 6 +-
> include/drm/drm_prime.h | 5 +-
> include/linux/dma-buf-map.h | 193 ++++++++++++++++++
> include/linux/dma-buf.h | 11 +-
> 18 files changed, 372 insertions(+), 94 deletions(-)
> create mode 100644 include/linux/dma-buf-map.h
For drivers/media/common/videobuf2 changes:
Acked-by: Tomasz Figa <tfiga@chromium.org>
Best regards,
Tomasz
next prev parent reply other threads:[~2020-09-25 18:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-25 11:55 [PATCH v3 0/4] dma-buf: Flag vmap'ed memory as system or I/O memory Thomas Zimmermann
2020-09-25 11:55 ` [PATCH v3 1/4] dma-buf: Add struct dma-buf-map for storing struct dma_buf.vaddr_ptr Thomas Zimmermann
2020-09-25 11:55 ` [PATCH v3 2/4] dma-buf: Use struct dma_buf_map in dma_buf_vmap() interfaces Thomas Zimmermann
2020-09-25 11:56 ` [PATCH v3 3/4] dma-buf: Use struct dma_buf_map in dma_buf_vunmap() interfaces Thomas Zimmermann
2020-09-25 11:56 ` [PATCH v3 4/4] dma-buf: Document struct dma_buf_map Thomas Zimmermann
2020-09-25 18:57 ` Tomasz Figa [this message]
2020-09-26 7:13 ` [PATCH v3 0/4] dma-buf: Flag vmap'ed memory as system or I/O memory Sam Ravnborg
2020-09-27 18:36 ` Thomas Zimmermann
2020-09-27 19:16 ` Sam Ravnborg
2020-09-28 6:50 ` Christian König
2020-09-28 7:37 ` Thomas Zimmermann
2020-09-28 11:22 ` Christian König
2020-09-29 9:14 ` Daniel Vetter
2020-09-29 11:09 ` Christian König
2020-09-29 11:14 ` Thomas Zimmermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200925185719.GD3607091@chromium.org \
--to=tfiga@chromium.org \
--cc=Brian.Starkey@arm.com \
--cc=afd@ti.com \
--cc=airlied@linux.ie \
--cc=arnd@arndb.de \
--cc=benjamin.gaignard@linaro.org \
--cc=christian.gmeiner@gmail.com \
--cc=christian.koenig@amd.com \
--cc=corbet@lwn.net \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=etnaviv@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=john.stultz@linaro.org \
--cc=jonathanh@nvidia.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=kraxel@redhat.com \
--cc=kyungmin.park@samsung.com \
--cc=l.stach@pengutronix.de \
--cc=labbott@redhat.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux+etnaviv@armlinux.org.uk \
--cc=linux-doc@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=lmark@codeaurora.org \
--cc=m.szyprowski@samsung.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.auld@intel.com \
--cc=mchehab@kernel.org \
--cc=mripard@kernel.org \
--cc=pawel@osciak.com \
--cc=robin.murphy@arm.com \
--cc=rodrigo.vivi@intel.com \
--cc=sam@ravnborg.org \
--cc=sumit.semwal@linaro.org \
--cc=thierry.reding@gmail.com \
--cc=thomas.hellstrom@intel.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).