]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
drm/nouveau: pass flag to engine fini() method on suspend
authorBen Skeggs <bskeggs@redhat.com>
Wed, 20 Jul 2011 01:22:33 +0000 (11:22 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Sun, 24 Jul 2011 23:43:22 +0000 (09:43 +1000)
It may not be necessary to fail in certain cases (such as failing to idle)
on module unload, whereas on suspend it's important to ensure a consistent
state can be restored on resume.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 files changed:
drivers/gpu/drm/nouveau/nouveau_drv.c
drivers/gpu/drm/nouveau/nouveau_drv.h
drivers/gpu/drm/nouveau/nouveau_state.c
drivers/gpu/drm/nouveau/nv04_graph.c
drivers/gpu/drm/nouveau/nv10_graph.c
drivers/gpu/drm/nouveau/nv20_graph.c
drivers/gpu/drm/nouveau/nv40_graph.c
drivers/gpu/drm/nouveau/nv40_mpeg.c
drivers/gpu/drm/nouveau/nv50_graph.c
drivers/gpu/drm/nouveau/nv50_mpeg.c
drivers/gpu/drm/nouveau/nv84_crypt.c
drivers/gpu/drm/nouveau/nva3_copy.c
drivers/gpu/drm/nouveau/nvc0_copy.c
drivers/gpu/drm/nouveau/nvc0_graph.c

index 8256370e5938bc9dd81359d22b27e8fd4f065a9c..b30ddd8d2e2a2dbf1b3b9f65389e7ea778bbe7b0 100644 (file)
@@ -214,10 +214,13 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)
        pfifo->unload_context(dev);
 
        for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) {
-               if (dev_priv->eng[e]) {
-                       ret = dev_priv->eng[e]->fini(dev, e);
-                       if (ret)
-                               goto out_abort;
+               if (!dev_priv->eng[e])
+                       continue;
+
+               ret = dev_priv->eng[e]->fini(dev, e, true);
+               if (ret) {
+                       NV_ERROR(dev, "... engine %d failed: %d\n", i, ret);
+                       goto out_abort;
                }
        }
 
index d0bd010585ab0888ea7c8f7ea08f056ffd25e0d1..d7d51deb34b6564aab6ca87ef02b4fd1408077be 100644 (file)
@@ -312,7 +312,7 @@ struct nouveau_channel {
 struct nouveau_exec_engine {
        void (*destroy)(struct drm_device *, int engine);
        int  (*init)(struct drm_device *, int engine);
-       int  (*fini)(struct drm_device *, int engine);
+       int  (*fini)(struct drm_device *, int engine, bool suspend);
        int  (*context_new)(struct nouveau_channel *, int engine);
        void (*context_del)(struct nouveau_channel *, int engine);
        int  (*object_new)(struct nouveau_channel *, int engine,
index 1d08875dc8a3cea24febe1fb65544063ee3506ea..c7d87bc1e93602addcf937f77229e95c4f8d20e0 100644 (file)
@@ -695,7 +695,7 @@ out_engine:
                for (e = e - 1; e >= 0; e--) {
                        if (!dev_priv->eng[e])
                                continue;
-                       dev_priv->eng[e]->fini(dev, e);
+                       dev_priv->eng[e]->fini(dev, e, false);
                        dev_priv->eng[e]->destroy(dev,e );
                }
        }
@@ -747,7 +747,7 @@ static void nouveau_card_takedown(struct drm_device *dev)
                engine->fifo.takedown(dev);
                for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) {
                        if (dev_priv->eng[e]) {
-                               dev_priv->eng[e]->fini(dev, e);
+                               dev_priv->eng[e]->fini(dev, e, false);
                                dev_priv->eng[e]->destroy(dev,e );
                        }
                }
index 412979352c3586082d7a96b06593193a2382de2f..774cb7ab79f2750e335749e7ee4138345be20a43 100644 (file)
@@ -538,7 +538,7 @@ nv04_graph_init(struct drm_device *dev, int engine)
 }
 
 static int
-nv04_graph_fini(struct drm_device *dev, int engine)
+nv04_graph_fini(struct drm_device *dev, int engine, bool suspend)
 {
        nv04_graph_unload_context(dev);
        nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0x00000000);
index 25675225750c856b52a9ff0eb99c861ae45cf5c6..f22b323080a54e501e695091680f455e40b76639 100644 (file)
@@ -957,7 +957,7 @@ nv10_graph_init(struct drm_device *dev, int engine)
 }
 
 static int
-nv10_graph_fini(struct drm_device *dev, int engine)
+nv10_graph_fini(struct drm_device *dev, int engine, bool suspend)
 {
        nv10_graph_unload_context(dev);
        nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0x00000000);
index 3791222f20b9e7cd22577e0b1a6f1343be00472b..a54b7d9e7e262a8ea2323a5df08b1c06e4b8499a 100644 (file)
@@ -654,7 +654,7 @@ nv30_graph_init(struct drm_device *dev, int engine)
 }
 
 int
-nv20_graph_fini(struct drm_device *dev, int engine)
+nv20_graph_fini(struct drm_device *dev, int engine, bool suspend)
 {
        nv20_graph_unload_context(dev);
        nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0x00000000);
index c7885e990937a2dfe5fa7c051a15a5712b91ce10..ba14a93d8afa5f07ed43474d9a560a04415b5964 100644 (file)
@@ -346,7 +346,7 @@ nv40_graph_init(struct drm_device *dev, int engine)
 }
 
 static int
-nv40_graph_fini(struct drm_device *dev, int engine)
+nv40_graph_fini(struct drm_device *dev, int engine, bool suspend)
 {
        u32 inst = nv_rd32(dev, 0x40032c);
        if (inst & 0x01000000) {
index 6d2af292a2e392cdf6bb8516c0f3047d0e436428..ad03a0e1fc7ddbfb38ca8c94fe354462f034ccd9 100644 (file)
@@ -137,7 +137,7 @@ nv40_mpeg_init(struct drm_device *dev, int engine)
 }
 
 static int
-nv40_mpeg_fini(struct drm_device *dev, int engine)
+nv40_mpeg_fini(struct drm_device *dev, int engine, bool suspend)
 {
        /*XXX: context save? */
        nv_mask(dev, 0x00b32c, 0x00000001, 0x00000000);
index e25cbb46789a6780b5cf9611680468a835a09cff..cce95dd99901a4307a6d44563f92c7ca8e980b12 100644 (file)
@@ -125,7 +125,6 @@ static void
 nv50_graph_init_reset(struct drm_device *dev)
 {
        uint32_t pmc_e = NV_PMC_ENABLE_PGRAPH | (1 << 21);
-
        NV_DEBUG(dev, "\n");
 
        nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & ~pmc_e);
@@ -255,9 +254,8 @@ nv50_graph_init(struct drm_device *dev, int engine)
 }
 
 static int
-nv50_graph_fini(struct drm_device *dev, int engine)
+nv50_graph_fini(struct drm_device *dev, int engine, bool suspend)
 {
-       NV_DEBUG(dev, "\n");
        nv50_graph_unload_context(dev);
        nv_wr32(dev, 0x40013c, 0x00000000);
        return 0;
index 1dc5913f78c5c32ad059578f26c01f3b0afab4aa..b57a2d180ad2fa61169fd09260856a7f10fc546f 100644 (file)
@@ -160,7 +160,7 @@ nv50_mpeg_init(struct drm_device *dev, int engine)
 }
 
 static int
-nv50_mpeg_fini(struct drm_device *dev, int engine)
+nv50_mpeg_fini(struct drm_device *dev, int engine, bool suspend)
 {
        /*XXX: context save for s/r */
        nv_mask(dev, 0x00b32c, 0x00000001, 0x00000000);
index 75b809a51748e09eaa78cd8e07d5a7b754b3e408..edece9c616eb59dac75d5b5e30500576689deafd 100644 (file)
@@ -138,7 +138,7 @@ nv84_crypt_isr(struct drm_device *dev)
 }
 
 static int
-nv84_crypt_fini(struct drm_device *dev, int engine)
+nv84_crypt_fini(struct drm_device *dev, int engine, bool suspend)
 {
        nv_wr32(dev, 0x102140, 0x00000000);
        return 0;
index b86820a61220a40d39b2bd8020a2def945888cc5..8f356d58e4091a30cec4d06a972361c3f4ca0ce2 100644 (file)
@@ -140,7 +140,7 @@ nva3_copy_init(struct drm_device *dev, int engine)
 }
 
 static int
-nva3_copy_fini(struct drm_device *dev, int engine)
+nva3_copy_fini(struct drm_device *dev, int engine, bool suspend)
 {
        nv_mask(dev, 0x104048, 0x00000003, 0x00000000);
 
index 5ebcd74244dbc1819bb7dc78e4525a842a7efe27..dddf006f6d88721451abe4d9634892bd139e8662 100644 (file)
@@ -127,7 +127,7 @@ nvc0_copy_init(struct drm_device *dev, int engine)
 }
 
 static int
-nvc0_copy_fini(struct drm_device *dev, int engine)
+nvc0_copy_fini(struct drm_device *dev, int engine, bool suspend)
 {
        struct nvc0_copy_engine *pcopy = nv_engine(dev, engine);
 
index 3a97431996c5a8121950b8ec9c5c655bd7d53f81..5b2f6f420468e4c4919663b058aecebffc9c5185 100644 (file)
@@ -304,7 +304,7 @@ nvc0_graph_object_new(struct nouveau_channel *chan, int engine,
 }
 
 static int
-nvc0_graph_fini(struct drm_device *dev, int engine)
+nvc0_graph_fini(struct drm_device *dev, int engine, bool suspend)
 {
        return 0;
 }