summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMikko Perttunen <mperttunen@nvidia.com>2026-06-22 15:57:40 +0900
committerThierry Reding <treding@nvidia.com>2026-07-16 20:31:21 +0200
commit5db6378b32ec133b32bdf8eff01e1bb54a4e2e2a (patch)
treeccee70f4e86e896433812d8cda0b5d88e42acd6b /drivers
parentfd58cd8974a3e36e677d59baeae4a5a2913d76d4 (diff)
downloadlinux-next-5db6378b32ec133b32bdf8eff01e1bb54a4e2e2a.tar.gz
linux-next-5db6378b32ec133b32bdf8eff01e1bb54a4e2e2a.zip
gpu: host1x: Correctly parse linear ranges of context devices
The previous parsing of the iommu-map property assumed each context device has its own one-length entry in the device tree. This has worked fine so far, but on Tegra264 larger numbers of context devices are usable, so it's better to support linear ranges as well. Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Link: https://patch.msgid.link/20260622-t264-host1x-v2-3-ff7364d9ff7b@nvidia.com
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/host1x/context.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/host1x/context.c b/drivers/gpu/host1x/context.c
index 512f3d189ebf..94ecc8769c93 100644
--- a/drivers/gpu/host1x/context.c
+++ b/drivers/gpu/host1x/context.c
@@ -24,7 +24,7 @@ int host1x_memory_context_list_init(struct host1x *host1x)
struct host1x_memory_context_list *cdl = &host1x->context_list;
struct device_node *node = host1x->dev->of_node;
struct host1x_memory_context *ctx;
- unsigned int i;
+ unsigned int devs, i;
int err;
cdl->devs = NULL;
@@ -35,7 +35,16 @@ int host1x_memory_context_list_init(struct host1x *host1x)
if (err < 0)
return 0;
- cdl->len = err / 4;
+ devs = 0;
+
+ for (i = 0; i < err / 4; i++) {
+ u32 length;
+
+ of_property_read_u32_index(node, "iommu-map", i * 4 + 3, &length);
+ devs += length;
+ }
+
+ cdl->len = devs;
cdl->devs = kzalloc_objs(*cdl->devs, cdl->len);
if (!cdl->devs)
return -ENOMEM;