Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gpu: host1x: Select context device based on attached IOMMU

On Tegra234, engines that are programmed through Host1x channels can
be attached to either the NISO0 or NISO1 SMMU. Because of that, when
selecting a context device to use with an engine, we need to select
one that is also attached to the same SMMU.

Add a parameter to host1x_memory_context_alloc to specify which device
we are allocating a context for, and use it to pick an appropriate
context device.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
[treding@nvidia.com: update !IOMMU_API stub signature]
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Mikko Perttunen and committed by
Thierry Reding
8935002f c2418f91

+7 -1
+1 -1
drivers/gpu/drm/tegra/uapi.c
··· 116 116 117 117 if (supported) 118 118 context->memory_context = host1x_memory_context_alloc( 119 - host, get_task_pid(current, PIDTYPE_TGID)); 119 + host, client->base.dev, get_task_pid(current, PIDTYPE_TGID)); 120 120 121 121 if (IS_ERR(context->memory_context)) { 122 122 if (PTR_ERR(context->memory_context) != -EOPNOTSUPP) {
+4
drivers/gpu/host1x/context.c
··· 104 104 } 105 105 106 106 struct host1x_memory_context *host1x_memory_context_alloc(struct host1x *host1x, 107 + struct device *dev, 107 108 struct pid *pid) 108 109 { 109 110 struct host1x_memory_context_list *cdl = &host1x->context_list; ··· 118 117 119 118 for (i = 0; i < cdl->len; i++) { 120 119 struct host1x_memory_context *cd = &cdl->devs[i]; 120 + 121 + if (cd->dev.iommu->iommu_dev != dev->iommu->iommu_dev) 122 + continue; 121 123 122 124 if (cd->owner == pid) { 123 125 refcount_inc(&cd->ref);
+2
include/linux/host1x.h
··· 469 469 470 470 #ifdef CONFIG_IOMMU_API 471 471 struct host1x_memory_context *host1x_memory_context_alloc(struct host1x *host1x, 472 + struct device *dev, 472 473 struct pid *pid); 473 474 void host1x_memory_context_get(struct host1x_memory_context *cd); 474 475 void host1x_memory_context_put(struct host1x_memory_context *cd); 475 476 #else 476 477 static inline struct host1x_memory_context *host1x_memory_context_alloc(struct host1x *host1x, 478 + struct device *dev, 477 479 struct pid *pid) 478 480 { 479 481 return NULL;