linux_dsm_epyc7002/drivers/gpu/host1x
Thierry Reding 80327ce3d4 gpu: host1x: Overhaul host1x_bo_{pin,unpin}() API
The host1x_bo_pin() and host1x_bo_unpin() APIs are used to pin and unpin
buffers during host1x job submission. Pinning currently returns the SG
table and the DMA address (an IOVA if an IOMMU is used or a physical
address if no IOMMU is used) of the buffer. The DMA address is only used
for buffers that are relocated, whereas the host1x driver will map
gather buffers into its own IOVA space so that they can be processed by
the CDMA engine.

This approach has a couple of issues. On one hand it's not very useful
to return a DMA address for the buffer if host1x doesn't need it. On the
other hand, returning the SG table of the buffer is suboptimal because a
single SG table cannot be shared for multiple mappings, because the DMA
address is stored within the SG table, and the DMA address may be
different for different devices.

Subsequent patches will move the host1x driver over to the DMA API which
doesn't work with a single shared SG table. Fix this by returning a new
SG table each time a buffer is pinned. This allows the buffer to be
referenced by multiple jobs for different engines.

Change the prototypes of host1x_bo_pin() and host1x_bo_unpin() to take a
struct device *, specifying the device for which the buffer should be
pinned. This is required in order to be able to properly construct the
SG table. While at it, make host1x_bo_pin() return the SG table because
that allows us to return an ERR_PTR()-encoded error code if we need to,
or return NULL to signal that we don't need the SG table to be remapped
and can simply use the DMA address as-is. At the same time, returning
the DMA address is made optional because in the example of command
buffers, host1x doesn't need to know the DMA address since it will have
to create its own mapping anyway.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2019-10-29 15:04:34 +01:00
..
hw treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
bus.c gpu: host1x: Do not limit DMA segment size 2019-10-28 11:18:08 +01:00
bus.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
cdma.c gpu: host1x: Make host1x_cdma_wait_pushbuffer_space() static 2019-10-28 11:18:34 +01:00
cdma.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
channel.c gpu: host1x: Request channels for clients, not devices 2019-10-28 11:18:33 +01:00
channel.h gpu: host1x: Request channels for clients, not devices 2019-10-28 11:18:33 +01:00
debug.c drm/tegra: Changes for v5.3-rc1 2019-06-25 12:59:43 +10:00
debug.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
dev.c gpu: host1x: Explicitly initialize host1x_info structures 2019-10-28 11:18:33 +01:00
dev.h gpu: host1x: Do not limit DMA segment size 2019-10-28 11:18:08 +01:00
intr.c gpu: host1x: Remove gratuitous blank line 2019-10-28 11:18:33 +01:00
intr.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
job.c gpu: host1x: Overhaul host1x_bo_{pin,unpin}() API 2019-10-29 15:04:34 +01:00
job.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile gpu: host1x: Add Tegra194 support 2018-11-29 17:11:49 +01:00
mipi.c drm/tegra: dsi: Enhance runtime power management 2016-08-24 15:58:57 +02:00
syncpt.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
syncpt.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00