]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: Fix reset in new policy
authorArto Merilainen <amerilainen@nvidia.com>
Mon, 4 May 2015 11:19:27 +0000 (14:19 +0300)
committerArto Merilainen <amerilainen@nvidia.com>
Sat, 9 May 2015 12:34:08 +0000 (05:34 -0700)
In the new resource policy we allocate a new channel for each active
submit and serialization is handled using MLOCKs. However, in our
current recovery routine implementation we assume that module reset
is always mandatory. Obviously, this is no longer valid in the
new resource policy.

This patch modifies the recovery routine to take into account the
resource policy. If resource-per-instance policy is enabled, we
check if the channel is holding the module specific MLOCK. If yes,
we reset the engine. Otherwise the engine reset is not performed.

Bug 1614168

Change-Id: I15e0db2422d8365b9b100a2ad2b6fcc79760f736
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/738488
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Shridhar Rasal <srasal@nvidia.com>
drivers/video/tegra/host/host1x/host1x_cdma.c

index cc825cf796223640d66bb421ed214ca0d1bcc8d6..277b3ecf54eac289b023ad82abb74de454733417 100644 (file)
@@ -361,6 +361,7 @@ static void cdma_timeout_teardown_begin(struct nvhost_cdma *cdma)
 {
        struct nvhost_master *dev;
        struct nvhost_channel *ch = cdma_to_channel(cdma);
+       struct nvhost_device_data *pdata = platform_get_drvdata(ch->dev);
        u32 cmdproc_stop;
 
        dev = cdma_to_dev(cdma);
@@ -390,7 +391,26 @@ static void cdma_timeout_teardown_begin(struct nvhost_cdma *cdma)
 
        host1x_sync_writel(dev->dev,
                        host1x_sync_ch_teardown_r(), BIT(ch->chid));
-       nvhost_module_reset(ch->dev, true);
+
+       /* if resources are allocated per channel instance, the channel does
+        * not necessaryly hold the mlock */
+       if (pdata->resource_policy == RESOURCE_PER_CHANNEL_INSTANCE) {
+               struct nvhost_syncpt *syncpt = &dev->syncpt;
+               unsigned int owner;
+               bool ch_own, cpu_own;
+
+               /* check the owner */
+               syncpt_op().mutex_owner(syncpt, pdata->modulemutexes[0],
+                                       &cpu_own, &ch_own, &owner);
+
+               /* if this channel owns the lock, we need to reset the engine */
+               if (ch_own && owner == ch->chid)
+                       nvhost_module_reset(ch->dev, true);
+       } else {
+               /* if we allocate the resource per channel, the module is always
+                * contamined */
+               nvhost_module_reset(ch->dev, true);
+       }
 
        cdma_timeout_release_mlocks(cdma);