From: Thomas Zimmermann <tzimmermann@suse.de>
To: "Christian König" <christian.koenig@amd.com>,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
airlied@linux.ie, daniel@ffwll.ch, sam@ravnborg.org,
alexander.deucher@amd.com, kraxel@redhat.com,
l.stach@pengutronix.de, linux+etnaviv@armlinux.org.uk,
christian.gmeiner@gmail.com, inki.dae@samsung.com,
jy0922.shim@samsung.com, sw0312.kim@samsung.com,
kyungmin.park@samsung.com, kgene@kernel.org, krzk@kernel.org,
yuq825@gmail.com, bskeggs@redhat.com, robh@kernel.org,
tomeu.vizoso@collabora.com, steven.price@arm.com,
alyssa.rosenzweig@collabora.com, hjc@rock-chips.com,
heiko@sntech.de, hdegoede@redhat.com, sean@poorly.run,
eric@anholt.net, oleksandr_andrushchenko@epam.com,
ray.huang@amd.com, sumit.semwal@linaro.org,
emil.velikov@collabora.com, luben.tuikov@amd.com,
apaneers@amd.com, linus.walleij@linaro.org,
melissa.srw@gmail.com, chris@chris-wilson.co.uk,
miaoqinglang@huawei.com
Cc: linux-samsung-soc@vger.kernel.org, lima@lists.freedesktop.org,
nouveau@lists.freedesktop.org, etnaviv@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org,
virtualization@lists.linux-foundation.org,
linaro-mm-sig@lists.linaro.org,
linux-rockchip@lists.infradead.org,
dri-devel@lists.freedesktop.org,
spice-devel@lists.freedesktop.org,
xen-devel@lists.xenproject.org,
linux-arm-kernel@lists.infradead.org,
linux-media@vger.kernel.org
Subject: Re: [PATCH v3 2/7] drm/ttm: Add ttm_kmap_obj_to_dma_buf_map() for type conversion
Date: Tue, 29 Sep 2020 19:49:30 +0200 [thread overview]
Message-ID: <2614314a-81f7-4722-c400-68d90e48e09a@suse.de> (raw)
In-Reply-To: <8fad0114-064a-4ed5-c21d-d1b4294de0a1@amd.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 4465 bytes --]
Hi Christian
Am 29.09.20 um 17:35 schrieb Christian König:
> Am 29.09.20 um 17:14 schrieb Thomas Zimmermann:
>> The new helper ttm_kmap_obj_to_dma_buf() extracts address and location
>> from and instance of TTM's kmap_obj and initializes struct dma_buf_map
>> with these values. Helpful for TTM-based drivers.
>
> We could completely drop that if we use the same structure inside TTM as
> well.
>
> Additional to that which driver is going to use this?
As Daniel mentioned, it's in patch 3. The TTM-based drivers will
retrieve the pointer via this function.
I do want to see all that being more tightly integrated into TTM, but
not in this series. This one is about fixing the bochs-on-sparc64
problem for good. Patch 7 adds an update to TTM to the DRM TODO list.
Best regards
Thomas
>
> Regards,
> Christian.
>
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>> include/drm/ttm/ttm_bo_api.h | 24 ++++++++++++++++++++++++
>> include/linux/dma-buf-map.h | 20 ++++++++++++++++++++
>> 2 files changed, 44 insertions(+)
>>
>> diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
>> index c96a25d571c8..62d89f05a801 100644
>> --- a/include/drm/ttm/ttm_bo_api.h
>> +++ b/include/drm/ttm/ttm_bo_api.h
>> @@ -34,6 +34,7 @@
>> #include <drm/drm_gem.h>
>> #include <drm/drm_hashtab.h>
>> #include <drm/drm_vma_manager.h>
>> +#include <linux/dma-buf-map.h>
>> #include <linux/kref.h>
>> #include <linux/list.h>
>> #include <linux/wait.h>
>> @@ -486,6 +487,29 @@ static inline void *ttm_kmap_obj_virtual(struct
>> ttm_bo_kmap_obj *map,
>> return map->virtual;
>> }
>> +/**
>> + * ttm_kmap_obj_to_dma_buf_map
>> + *
>> + * @kmap: A struct ttm_bo_kmap_obj returned from ttm_bo_kmap.
>> + * @map: Returns the mapping as struct dma_buf_map
>> + *
>> + * Converts struct ttm_bo_kmap_obj to struct dma_buf_map. If the memory
>> + * is not mapped, the returned mapping is initialized to NULL.
>> + */
>> +static inline void ttm_kmap_obj_to_dma_buf_map(struct ttm_bo_kmap_obj
>> *kmap,
>> + struct dma_buf_map *map)
>> +{
>> + bool is_iomem;
>> + void *vaddr = ttm_kmap_obj_virtual(kmap, &is_iomem);
>> +
>> + if (!vaddr)
>> + dma_buf_map_clear(map);
>> + else if (is_iomem)
>> + dma_buf_map_set_vaddr_iomem(map, (void __force __iomem *)vaddr);
>> + else
>> + dma_buf_map_set_vaddr(map, vaddr);
>> +}
>> +
>> /**
>> * ttm_bo_kmap
>> *
>> diff --git a/include/linux/dma-buf-map.h b/include/linux/dma-buf-map.h
>> index fd1aba545fdf..2e8bbecb5091 100644
>> --- a/include/linux/dma-buf-map.h
>> +++ b/include/linux/dma-buf-map.h
>> @@ -45,6 +45,12 @@
>> *
>> * dma_buf_map_set_vaddr(&map. 0xdeadbeaf);
>> *
>> + * To set an address in I/O memory, use dma_buf_map_set_vaddr_iomem().
>> + *
>> + * .. code-block:: c
>> + *
>> + * dma_buf_map_set_vaddr_iomem(&map. 0xdeadbeaf);
>> + *
>> * Test if a mapping is valid with either dma_buf_map_is_set() or
>> * dma_buf_map_is_null().
>> *
>> @@ -118,6 +124,20 @@ static inline void dma_buf_map_set_vaddr(struct
>> dma_buf_map *map, void *vaddr)
>> map->is_iomem = false;
>> }
>> +/**
>> + * dma_buf_map_set_vaddr_iomem - Sets a dma-buf mapping structure to
>> an address in I/O memory
>> + * @map: The dma-buf mapping structure
>> + * @vaddr_iomem: An I/O-memory address
>> + *
>> + * Sets the address and the I/O-memory flag.
>> + */
>> +static inline void dma_buf_map_set_vaddr_iomem(struct dma_buf_map *map,
>> + void __iomem *vaddr_iomem)
>> +{
>> + map->vaddr_iomem = vaddr_iomem;
>> + map->is_iomem = true;
>> +}
>> +
>> /**
>> * dma_buf_map_is_equal - Compares two dma-buf mapping structures
>> for equality
>> * @lhs: The dma-buf mapping structure
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 516 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2020-09-29 17:49 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-29 15:14 [PATCH v3 0/7] Support GEM object mappings from I/O memory Thomas Zimmermann
2020-09-29 15:14 ` [PATCH v3 1/7] drm/vram-helper: Remove invariant parameters from internal kmap function Thomas Zimmermann
2020-10-02 9:48 ` Daniel Vetter
2020-09-29 15:14 ` [PATCH v3 2/7] drm/ttm: Add ttm_kmap_obj_to_dma_buf_map() for type conversion Thomas Zimmermann
2020-09-29 15:35 ` Christian König
2020-09-29 15:44 ` Daniel Vetter
2020-09-29 17:49 ` Thomas Zimmermann [this message]
[not found] ` <8a84f62b-33f3-f44c-52af-c859a0e0d1fb@gmail.com>
2020-09-30 8:19 ` Thomas Zimmermann
[not found] ` <b569b7e3-68f0-edcc-c8f4-170e9042d348@gmail.com>
2020-09-30 9:47 ` Daniel Vetter
2020-09-30 12:34 ` Christian König
2020-09-30 12:51 ` Daniel Vetter
2020-10-02 9:58 ` Daniel Vetter
2020-10-02 11:30 ` Christian König
2020-10-02 12:21 ` Daniel Vetter
2020-10-07 12:57 ` Thomas Zimmermann
2020-10-07 13:10 ` Daniel Vetter
2020-10-07 13:20 ` Thomas Zimmermann
2020-10-07 13:24 ` Christian König
2020-10-07 14:30 ` Daniel Vetter
2020-10-08 9:00 ` Thomas Zimmermann
2020-09-29 15:14 ` [PATCH v3 3/7] drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends Thomas Zimmermann
2020-10-02 13:02 ` Daniel Vetter
2020-09-29 15:14 ` [PATCH v3 4/7] drm/gem: Update internal GEM vmap/vunmap interfaces to use struct dma_buf_map Thomas Zimmermann
2020-10-02 13:04 ` Daniel Vetter
2020-09-29 15:14 ` [PATCH v3 5/7] drm/gem: Store client buffer mappings as " Thomas Zimmermann
2020-10-02 13:05 ` Daniel Vetter
2020-09-29 15:14 ` [PATCH v3 6/7] drm/fb_helper: Support framebuffers in I/O memory Thomas Zimmermann
2020-10-02 18:05 ` Daniel Vetter
2020-10-02 18:44 ` Daniel Vetter
2020-10-08 9:25 ` Thomas Zimmermann
2020-10-08 9:35 ` Daniel Vetter
2020-09-29 15:14 ` [PATCH v3 7/7] drm/todo: Update entries around struct dma_buf_map Thomas Zimmermann
2020-10-02 18:45 ` Daniel Vetter
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=2614314a-81f7-4722-c400-68d90e48e09a@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=alyssa.rosenzweig@collabora.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=apaneers@amd.com \
--cc=bskeggs@redhat.com \
--cc=chris@chris-wilson.co.uk \
--cc=christian.gmeiner@gmail.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.velikov@collabora.com \
--cc=eric@anholt.net \
--cc=etnaviv@lists.freedesktop.org \
--cc=hdegoede@redhat.com \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=inki.dae@samsung.com \
--cc=jy0922.shim@samsung.com \
--cc=kgene@kernel.org \
--cc=kraxel@redhat.com \
--cc=krzk@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=l.stach@pengutronix.de \
--cc=lima@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux+etnaviv@armlinux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=luben.tuikov@amd.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=melissa.srw@gmail.com \
--cc=miaoqinglang@huawei.com \
--cc=mripard@kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=oleksandr_andrushchenko@epam.com \
--cc=ray.huang@amd.com \
--cc=robh@kernel.org \
--cc=sam@ravnborg.org \
--cc=sean@poorly.run \
--cc=spice-devel@lists.freedesktop.org \
--cc=steven.price@arm.com \
--cc=sumit.semwal@linaro.org \
--cc=sw0312.kim@samsung.com \
--cc=tomeu.vizoso@collabora.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=xen-devel@lists.xenproject.org \
--cc=yuq825@gmail.com \
/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