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 <[email protected]> --- 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 d50d41c20561..52ca663902ad 100644 --- a/drivers/gpu/host1x/context.c +++ b/drivers/gpu/host1x/context.c @@ -23,7 +23,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; @@ -34,7 +34,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; -- 2.53.0
