summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/host1x
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2023-04-06 15:02:16 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2023-04-06 15:02:17 +0200
commit8904a1e20ba8ee82c1d24d6f8091ba464b878a54 (patch)
treebc13057b1c0d748fe7e32bd6f2308cb84b0417eb /drivers/gpu/host1x
parent52b113e968be66b57f792b2e2a9b8b77f382bd5f (diff)
parent2429b3c529da29d4277d519bd66d034842dcd70c (diff)
downloadlinux-8904a1e20ba8ee82c1d24d6f8091ba464b878a54.tar.gz
linux-8904a1e20ba8ee82c1d24d6f8091ba464b878a54.tar.bz2
linux-8904a1e20ba8ee82c1d24d6f8091ba464b878a54.zip
Merge tag 'drm/tegra/for-6.4-rc1' of https://gitlab.freedesktop.org/drm/tegra into drm-next
drm/tegra: Changes for v6.4-rc1 The majority of this is minor cleanups and fixes. Other than those, this contains Uwe's conversion to the new driver remove callback and Thomas' fbdev DRM client conversion. The driver can now also be built on other architectures to easy compile coverage. Finally, this adds Mikko as a second maintainer for the driver. As a next step we also want Tegra DRM to move into drm-misc to streamline the maintenance process. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> From: Thierry Reding <thierry.reding@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230406121404.967704-1-thierry.reding@gmail.com
Diffstat (limited to 'drivers/gpu/host1x')
-rw-r--r--drivers/gpu/host1x/Kconfig2
-rw-r--r--drivers/gpu/host1x/bus.c6
-rw-r--r--drivers/gpu/host1x/context.c24
-rw-r--r--drivers/gpu/host1x/mipi.c4
-rw-r--r--drivers/gpu/host1x/syncpt.c8
5 files changed, 27 insertions, 17 deletions
diff --git a/drivers/gpu/host1x/Kconfig b/drivers/gpu/host1x/Kconfig
index 1861a8180d3f..e6c78ae2003a 100644
--- a/drivers/gpu/host1x/Kconfig
+++ b/drivers/gpu/host1x/Kconfig
@@ -5,7 +5,7 @@ config TEGRA_HOST1X_CONTEXT_BUS
config TEGRA_HOST1X
tristate "NVIDIA Tegra host1x driver"
- depends on ARCH_TEGRA || (ARM && COMPILE_TEST)
+ depends on ARCH_TEGRA || COMPILE_TEST
select DMA_SHARED_BUFFER
select TEGRA_HOST1X_CONTEXT_BUS
select IOMMU_IOVA
diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
index bc7271a00a94..4d16a3396c4a 100644
--- a/drivers/gpu/host1x/bus.c
+++ b/drivers/gpu/host1x/bus.c
@@ -803,7 +803,7 @@ EXPORT_SYMBOL(__host1x_client_register);
* Removes a host1x client from its host1x controller instance. If a logical
* device has already been initialized, it will be torn down.
*/
-int host1x_client_unregister(struct host1x_client *client)
+void host1x_client_unregister(struct host1x_client *client)
{
struct host1x_client *c;
struct host1x *host1x;
@@ -815,7 +815,7 @@ int host1x_client_unregister(struct host1x_client *client)
err = host1x_del_client(host1x, client);
if (!err) {
mutex_unlock(&devices_lock);
- return 0;
+ return;
}
}
@@ -832,8 +832,6 @@ int host1x_client_unregister(struct host1x_client *client)
mutex_unlock(&clients_lock);
host1x_bo_cache_destroy(&client->cache);
-
- return 0;
}
EXPORT_SYMBOL(host1x_client_unregister);
diff --git a/drivers/gpu/host1x/context.c b/drivers/gpu/host1x/context.c
index 8beedcf080ab..9ad89d22c0ca 100644
--- a/drivers/gpu/host1x/context.c
+++ b/drivers/gpu/host1x/context.c
@@ -13,6 +13,11 @@
#include "context.h"
#include "dev.h"
+static void host1x_memory_context_release(struct device *dev)
+{
+ /* context device is freed in host1x_memory_context_list_free() */
+}
+
int host1x_memory_context_list_init(struct host1x *host1x)
{
struct host1x_memory_context_list *cdl = &host1x->context_list;
@@ -51,38 +56,41 @@ int host1x_memory_context_list_init(struct host1x *host1x)
dev_set_name(&ctx->dev, "host1x-ctx.%d", i);
ctx->dev.bus = &host1x_context_device_bus_type;
ctx->dev.parent = host1x->dev;
+ ctx->dev.release = host1x_memory_context_release;
dma_set_max_seg_size(&ctx->dev, UINT_MAX);
err = device_add(&ctx->dev);
if (err) {
dev_err(host1x->dev, "could not add context device %d: %d\n", i, err);
- goto del_devices;
+ put_device(&ctx->dev);
+ goto unreg_devices;
}
err = of_dma_configure_id(&ctx->dev, node, true, &i);
if (err) {
dev_err(host1x->dev, "IOMMU configuration failed for context device %d: %d\n",
i, err);
- device_del(&ctx->dev);
- goto del_devices;
+ device_unregister(&ctx->dev);
+ goto unreg_devices;
}
if (!tegra_dev_iommu_get_stream_id(&ctx->dev, &ctx->stream_id) ||
!device_iommu_mapped(&ctx->dev)) {
dev_err(host1x->dev, "Context device %d has no IOMMU!\n", i);
- device_del(&ctx->dev);
- goto del_devices;
+ device_unregister(&ctx->dev);
+ goto unreg_devices;
}
}
return 0;
-del_devices:
+unreg_devices:
while (i--)
- device_del(&cdl->devs[i].dev);
+ device_unregister(&cdl->devs[i].dev);
kfree(cdl->devs);
+ cdl->devs = NULL;
cdl->len = 0;
return err;
@@ -93,7 +101,7 @@ void host1x_memory_context_list_free(struct host1x_memory_context_list *cdl)
unsigned int i;
for (i = 0; i < cdl->len; i++)
- device_del(&cdl->devs[i].dev);
+ device_unregister(&cdl->devs[i].dev);
kfree(cdl->devs);
cdl->len = 0;
diff --git a/drivers/gpu/host1x/mipi.c b/drivers/gpu/host1x/mipi.c
index 2efe12dde8bc..4dcec535ec21 100644
--- a/drivers/gpu/host1x/mipi.c
+++ b/drivers/gpu/host1x/mipi.c
@@ -501,7 +501,6 @@ static int tegra_mipi_probe(struct platform_device *pdev)
{
const struct of_device_id *match;
struct tegra_mipi *mipi;
- struct resource *res;
int err;
match = of_match_node(tegra_mipi_of_match, pdev->dev.of_node);
@@ -515,8 +514,7 @@ static int tegra_mipi_probe(struct platform_device *pdev)
mipi->soc = match->data;
mipi->dev = &pdev->dev;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- mipi->regs = devm_ioremap_resource(&pdev->dev, res);
+ mipi->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
if (IS_ERR(mipi->regs))
return PTR_ERR(mipi->regs);
diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
index 2d2007760eac..f63d14a57a1d 100644
--- a/drivers/gpu/host1x/syncpt.c
+++ b/drivers/gpu/host1x/syncpt.c
@@ -248,7 +248,13 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
if (value)
*value = host1x_syncpt_load(sp);
- if (wait_err == 0)
+ /*
+ * Don't rely on dma_fence_wait_timeout return value,
+ * since it returns zero both on timeout and if the
+ * wait completed with 0 jiffies left.
+ */
+ host1x_hw_syncpt_load(sp->host, sp);
+ if (wait_err == 0 && !host1x_syncpt_is_expired(sp, thresh))
return -EAGAIN;
else if (wait_err < 0)
return wait_err;