aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-07-19 21:22:33 -0400
committerBen Skeggs <bskeggs@redhat.com>2011-07-24 19:43:22 -0400
commit6c320fef5835240bf414b54e697e517a160663f4 (patch)
tree791f610df2eef6e7534fb23099a29a41dd508329 /drivers/gpu/drm
parent70ad25ab735a016c48183875f657d90d592b773d (diff)
drm/nouveau: pass flag to engine fini() method on suspend
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>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.c11
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c4
-rw-r--r--drivers/gpu/drm/nouveau/nv04_graph.c2
-rw-r--r--drivers/gpu/drm/nouveau/nv10_graph.c2
-rw-r--r--drivers/gpu/drm/nouveau/nv20_graph.c2
-rw-r--r--drivers/gpu/drm/nouveau/nv40_graph.c2
-rw-r--r--drivers/gpu/drm/nouveau/nv40_mpeg.c2
-rw-r--r--drivers/gpu/drm/nouveau/nv50_graph.c4
-rw-r--r--drivers/gpu/drm/nouveau/nv50_mpeg.c2
-rw-r--r--drivers/gpu/drm/nouveau/nv84_crypt.c2
-rw-r--r--drivers/gpu/drm/nouveau/nva3_copy.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_copy.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_graph.c2
14 files changed, 21 insertions, 20 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c
index 8256370e5938..b30ddd8d2e2a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.c
@@ -214,10 +214,13 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)
214 pfifo->unload_context(dev); 214 pfifo->unload_context(dev);
215 215
216 for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) { 216 for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) {
217 if (dev_priv->eng[e]) { 217 if (!dev_priv->eng[e])
218 ret = dev_priv->eng[e]->fini(dev, e); 218 continue;
219 if (ret) 219
220 goto out_abort; 220 ret = dev_priv->eng[e]->fini(dev, e, true);
221 if (ret) {
222 NV_ERROR(dev, "... engine %d failed: %d\n", i, ret);
223 goto out_abort;
221 } 224 }
222 } 225 }
223 226
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index d0bd010585ab..d7d51deb34b6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -312,7 +312,7 @@ struct nouveau_channel {
312struct nouveau_exec_engine { 312struct nouveau_exec_engine {
313 void (*destroy)(struct drm_device *, int engine); 313 void (*destroy)(struct drm_device *, int engine);
314 int (*init)(struct drm_device *, int engine); 314 int (*init)(struct drm_device *, int engine);
315 int (*fini)(struct drm_device *, int engine); 315 int (*fini)(struct drm_device *, int engine, bool suspend);
316 int (*context_new)(struct nouveau_channel *, int engine); 316 int (*context_new)(struct nouveau_channel *, int engine);
317 void (*context_del)(struct nouveau_channel *, int engine); 317 void (*context_del)(struct nouveau_channel *, int engine);
318 int (*object_new)(struct nouveau_channel *, int engine, 318 int (*object_new)(struct nouveau_channel *, int engine,
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index 1d08875dc8a3..c7d87bc1e936 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -695,7 +695,7 @@ out_engine:
695 for (e = e - 1; e >= 0; e--) { 695 for (e = e - 1; e >= 0; e--) {
696 if (!dev_priv->eng[e]) 696 if (!dev_priv->eng[e])
697 continue; 697 continue;
698 dev_priv->eng[e]->fini(dev, e); 698 dev_priv->eng[e]->fini(dev, e, false);
699 dev_priv->eng[e]->destroy(dev,e ); 699 dev_priv->eng[e]->destroy(dev,e );
700 } 700 }
701 } 701 }
@@ -747,7 +747,7 @@ static void nouveau_card_takedown(struct drm_device *dev)
747 engine->fifo.takedown(dev); 747 engine->fifo.takedown(dev);
748 for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) { 748 for (e = NVOBJ_ENGINE_NR - 1; e >= 0; e--) {
749 if (dev_priv->eng[e]) { 749 if (dev_priv->eng[e]) {
750 dev_priv->eng[e]->fini(dev, e); 750 dev_priv->eng[e]->fini(dev, e, false);
751 dev_priv->eng[e]->destroy(dev,e ); 751 dev_priv->eng[e]->destroy(dev,e );
752 } 752 }
753 } 753 }
diff --git a/drivers/gpu/drm/nouveau/nv04_graph.c b/drivers/gpu/drm/nouveau/nv04_graph.c
index 412979352c35..774cb7ab79f2 100644
--- a/drivers/gpu/drm/nouveau/nv04_graph.c
+++ b/drivers/gpu/drm/nouveau/nv04_graph.c
@@ -538,7 +538,7 @@ nv04_graph_init(struct drm_device *dev, int engine)
538} 538}
539 539
540static int 540static int
541nv04_graph_fini(struct drm_device *dev, int engine) 541nv04_graph_fini(struct drm_device *dev, int engine, bool suspend)
542{ 542{
543 nv04_graph_unload_context(dev); 543 nv04_graph_unload_context(dev);
544 nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0x00000000); 544 nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nv10_graph.c b/drivers/gpu/drm/nouveau/nv10_graph.c
index 25675225750c..f22b323080a5 100644
--- a/drivers/gpu/drm/nouveau/nv10_graph.c
+++ b/drivers/gpu/drm/nouveau/nv10_graph.c
@@ -957,7 +957,7 @@ nv10_graph_init(struct drm_device *dev, int engine)
957} 957}
958 958
959static int 959static int
960nv10_graph_fini(struct drm_device *dev, int engine) 960nv10_graph_fini(struct drm_device *dev, int engine, bool suspend)
961{ 961{
962 nv10_graph_unload_context(dev); 962 nv10_graph_unload_context(dev);
963 nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0x00000000); 963 nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nv20_graph.c b/drivers/gpu/drm/nouveau/nv20_graph.c
index 3791222f20b9..a54b7d9e7e26 100644
--- a/drivers/gpu/drm/nouveau/nv20_graph.c
+++ b/drivers/gpu/drm/nouveau/nv20_graph.c
@@ -654,7 +654,7 @@ nv30_graph_init(struct drm_device *dev, int engine)
654} 654}
655 655
656int 656int
657nv20_graph_fini(struct drm_device *dev, int engine) 657nv20_graph_fini(struct drm_device *dev, int engine, bool suspend)
658{ 658{
659 nv20_graph_unload_context(dev); 659 nv20_graph_unload_context(dev);
660 nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0x00000000); 660 nv_wr32(dev, NV03_PGRAPH_INTR_EN, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nv40_graph.c b/drivers/gpu/drm/nouveau/nv40_graph.c
index c7885e990937..ba14a93d8afa 100644
--- a/drivers/gpu/drm/nouveau/nv40_graph.c
+++ b/drivers/gpu/drm/nouveau/nv40_graph.c
@@ -346,7 +346,7 @@ nv40_graph_init(struct drm_device *dev, int engine)
346} 346}
347 347
348static int 348static int
349nv40_graph_fini(struct drm_device *dev, int engine) 349nv40_graph_fini(struct drm_device *dev, int engine, bool suspend)
350{ 350{
351 u32 inst = nv_rd32(dev, 0x40032c); 351 u32 inst = nv_rd32(dev, 0x40032c);
352 if (inst & 0x01000000) { 352 if (inst & 0x01000000) {
diff --git a/drivers/gpu/drm/nouveau/nv40_mpeg.c b/drivers/gpu/drm/nouveau/nv40_mpeg.c
index 6d2af292a2e3..ad03a0e1fc7d 100644
--- a/drivers/gpu/drm/nouveau/nv40_mpeg.c
+++ b/drivers/gpu/drm/nouveau/nv40_mpeg.c
@@ -137,7 +137,7 @@ nv40_mpeg_init(struct drm_device *dev, int engine)
137} 137}
138 138
139static int 139static int
140nv40_mpeg_fini(struct drm_device *dev, int engine) 140nv40_mpeg_fini(struct drm_device *dev, int engine, bool suspend)
141{ 141{
142 /*XXX: context save? */ 142 /*XXX: context save? */
143 nv_mask(dev, 0x00b32c, 0x00000001, 0x00000000); 143 nv_mask(dev, 0x00b32c, 0x00000001, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c
index e25cbb46789a..cce95dd99901 100644
--- a/drivers/gpu/drm/nouveau/nv50_graph.c
+++ b/drivers/gpu/drm/nouveau/nv50_graph.c
@@ -125,7 +125,6 @@ static void
125nv50_graph_init_reset(struct drm_device *dev) 125nv50_graph_init_reset(struct drm_device *dev)
126{ 126{
127 uint32_t pmc_e = NV_PMC_ENABLE_PGRAPH | (1 << 21); 127 uint32_t pmc_e = NV_PMC_ENABLE_PGRAPH | (1 << 21);
128
129 NV_DEBUG(dev, "\n"); 128 NV_DEBUG(dev, "\n");
130 129
131 nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & ~pmc_e); 130 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)
255} 254}
256 255
257static int 256static int
258nv50_graph_fini(struct drm_device *dev, int engine) 257nv50_graph_fini(struct drm_device *dev, int engine, bool suspend)
259{ 258{
260 NV_DEBUG(dev, "\n");
261 nv50_graph_unload_context(dev); 259 nv50_graph_unload_context(dev);
262 nv_wr32(dev, 0x40013c, 0x00000000); 260 nv_wr32(dev, 0x40013c, 0x00000000);
263 return 0; 261 return 0;
diff --git a/drivers/gpu/drm/nouveau/nv50_mpeg.c b/drivers/gpu/drm/nouveau/nv50_mpeg.c
index 1dc5913f78c5..b57a2d180ad2 100644
--- a/drivers/gpu/drm/nouveau/nv50_mpeg.c
+++ b/drivers/gpu/drm/nouveau/nv50_mpeg.c
@@ -160,7 +160,7 @@ nv50_mpeg_init(struct drm_device *dev, int engine)
160} 160}
161 161
162static int 162static int
163nv50_mpeg_fini(struct drm_device *dev, int engine) 163nv50_mpeg_fini(struct drm_device *dev, int engine, bool suspend)
164{ 164{
165 /*XXX: context save for s/r */ 165 /*XXX: context save for s/r */
166 nv_mask(dev, 0x00b32c, 0x00000001, 0x00000000); 166 nv_mask(dev, 0x00b32c, 0x00000001, 0x00000000);
diff --git a/drivers/gpu/drm/nouveau/nv84_crypt.c b/drivers/gpu/drm/nouveau/nv84_crypt.c
index 75b809a51748..edece9c616eb 100644
--- a/drivers/gpu/drm/nouveau/nv84_crypt.c
+++ b/drivers/gpu/drm/nouveau/nv84_crypt.c
@@ -138,7 +138,7 @@ nv84_crypt_isr(struct drm_device *dev)
138} 138}
139 139
140static int 140static int
141nv84_crypt_fini(struct drm_device *dev, int engine) 141nv84_crypt_fini(struct drm_device *dev, int engine, bool suspend)
142{ 142{
143 nv_wr32(dev, 0x102140, 0x00000000); 143 nv_wr32(dev, 0x102140, 0x00000000);
144 return 0; 144 return 0;
diff --git a/drivers/gpu/drm/nouveau/nva3_copy.c b/drivers/gpu/drm/nouveau/nva3_copy.c
index b86820a61220..8f356d58e409 100644
--- a/drivers/gpu/drm/nouveau/nva3_copy.c
+++ b/drivers/gpu/drm/nouveau/nva3_copy.c
@@ -140,7 +140,7 @@ nva3_copy_init(struct drm_device *dev, int engine)
140} 140}
141 141
142static int 142static int
143nva3_copy_fini(struct drm_device *dev, int engine) 143nva3_copy_fini(struct drm_device *dev, int engine, bool suspend)
144{ 144{
145 nv_mask(dev, 0x104048, 0x00000003, 0x00000000); 145 nv_mask(dev, 0x104048, 0x00000003, 0x00000000);
146 146
diff --git a/drivers/gpu/drm/nouveau/nvc0_copy.c b/drivers/gpu/drm/nouveau/nvc0_copy.c
index 5ebcd74244db..dddf006f6d88 100644
--- a/drivers/gpu/drm/nouveau/nvc0_copy.c
+++ b/drivers/gpu/drm/nouveau/nvc0_copy.c
@@ -127,7 +127,7 @@ nvc0_copy_init(struct drm_device *dev, int engine)
127} 127}
128 128
129static int 129static int
130nvc0_copy_fini(struct drm_device *dev, int engine) 130nvc0_copy_fini(struct drm_device *dev, int engine, bool suspend)
131{ 131{
132 struct nvc0_copy_engine *pcopy = nv_engine(dev, engine); 132 struct nvc0_copy_engine *pcopy = nv_engine(dev, engine);
133 133
diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau/nvc0_graph.c
index 3a97431996c5..5b2f6f420468 100644
--- a/drivers/gpu/drm/nouveau/nvc0_graph.c
+++ b/drivers/gpu/drm/nouveau/nvc0_graph.c
@@ -304,7 +304,7 @@ nvc0_graph_object_new(struct nouveau_channel *chan, int engine,
304} 304}
305 305
306static int 306static int
307nvc0_graph_fini(struct drm_device *dev, int engine) 307nvc0_graph_fini(struct drm_device *dev, int engine, bool suspend)
308{ 308{
309 return 0; 309 return 0;
310} 310}