From 5db6378b32ec133b32bdf8eff01e1bb54a4e2e2a Mon Sep 17 00:00:00 2001 From: Mikko Perttunen Date: Mon, 22 Jun 2026 15:57:40 +0900 Subject: [PATCH] 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 Signed-off-by: Thierry Reding Link: https://patch.msgid.link/20260622-t264-host1x-v2-3-ff7364d9ff7b@nvidia.com --- drivers/gpu/host1x/context.c | 13 +++++++++++-- 1 file 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;