aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-05-25 03:22:43 -0400
committerBen Skeggs <bskeggs@redhat.com>2011-06-23 01:57:33 -0400
commitf8522fc80f2e0392fc44b069f61721bd25907270 (patch)
tree0a28182341f949766fd9efc5567fd88e50a7384e /drivers
parentaba99a8400e0b1ca9e6306e3a71013cc7a25bc29 (diff)
drm/nvc0: fix suspend/resume of PGRAPH/PCOPYn
We need the physical VRAM address in vinst, even for objects mapped into a vm, as the gpuobj suspend/resume code uses PMEM to access the object. Previously, vinst was overloaded to mean "VRAM address" for !VM objects, and "VM address" for VM objects, causing the wrong data to be accessed during suspend/resume. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h7
-rw-r--r--drivers/gpu/drm/nouveau/nv50_instmem.c3
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_copy.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_graph.c20
4 files changed, 17 insertions, 17 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 276fac7b7569..7136ad34921d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -176,9 +176,10 @@ struct nouveau_gpuobj {
176 uint32_t flags; 176 uint32_t flags;
177 177
178 u32 size; 178 u32 size;
179 u32 pinst; 179 u32 pinst; /* PRAMIN BAR offset */
180 u32 cinst; 180 u32 cinst; /* Channel offset */
181 u64 vinst; 181 u64 vinst; /* VRAM address */
182 u64 linst; /* VM address */
182 183
183 uint32_t engine; 184 uint32_t engine;
184 uint32_t class; 185 uint32_t class;
diff --git a/drivers/gpu/drm/nouveau/nv50_instmem.c b/drivers/gpu/drm/nouveau/nv50_instmem.c
index 4f95a1e5822e..ccea671346c9 100644
--- a/drivers/gpu/drm/nouveau/nv50_instmem.c
+++ b/drivers/gpu/drm/nouveau/nv50_instmem.c
@@ -305,7 +305,6 @@ struct nv50_gpuobj_node {
305 u32 align; 305 u32 align;
306}; 306};
307 307
308
309int 308int
310nv50_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align) 309nv50_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align)
311{ 310{
@@ -345,7 +344,7 @@ nv50_instmem_get(struct nouveau_gpuobj *gpuobj, u32 size, u32 align)
345 } 344 }
346 345
347 nouveau_vm_map(&node->chan_vma, node->vram); 346 nouveau_vm_map(&node->chan_vma, node->vram);
348 gpuobj->vinst = node->chan_vma.offset; 347 gpuobj->linst = node->chan_vma.offset;
349 } 348 }
350 349
351 gpuobj->size = size; 350 gpuobj->size = size;
diff --git a/drivers/gpu/drm/nouveau/nvc0_copy.c b/drivers/gpu/drm/nouveau/nvc0_copy.c
index 208fa7ab3f42..02c00bbeb9e5 100644
--- a/drivers/gpu/drm/nouveau/nvc0_copy.c
+++ b/drivers/gpu/drm/nouveau/nvc0_copy.c
@@ -54,8 +54,8 @@ nvc0_copy_context_new(struct nouveau_channel *chan, int engine)
54 if (ret) 54 if (ret)
55 return ret; 55 return ret;
56 56
57 nv_wo32(ramin, pcopy->ctx + 0, lower_32_bits(ctx->vinst)); 57 nv_wo32(ramin, pcopy->ctx + 0, lower_32_bits(ctx->linst));
58 nv_wo32(ramin, pcopy->ctx + 4, upper_32_bits(ctx->vinst)); 58 nv_wo32(ramin, pcopy->ctx + 4, upper_32_bits(ctx->linst));
59 dev_priv->engine.instmem.flush(dev); 59 dev_priv->engine.instmem.flush(dev);
60 60
61 chan->engctx[engine] = ctx; 61 chan->engctx[engine] = ctx;
diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau/nvc0_graph.c
index c99b3caa568c..6c06d6636a3c 100644
--- a/drivers/gpu/drm/nouveau/nvc0_graph.c
+++ b/drivers/gpu/drm/nouveau/nvc0_graph.c
@@ -131,27 +131,27 @@ nvc0_graph_create_context_mmio_list(struct nouveau_channel *chan)
131 131
132 132
133 nv_wo32(grch->mmio, i++ * 4, 0x00408004); 133 nv_wo32(grch->mmio, i++ * 4, 0x00408004);
134 nv_wo32(grch->mmio, i++ * 4, grch->unk408004->vinst >> 8); 134 nv_wo32(grch->mmio, i++ * 4, grch->unk408004->linst >> 8);
135 nv_wo32(grch->mmio, i++ * 4, 0x00408008); 135 nv_wo32(grch->mmio, i++ * 4, 0x00408008);
136 nv_wo32(grch->mmio, i++ * 4, 0x80000018); 136 nv_wo32(grch->mmio, i++ * 4, 0x80000018);
137 137
138 nv_wo32(grch->mmio, i++ * 4, 0x0040800c); 138 nv_wo32(grch->mmio, i++ * 4, 0x0040800c);
139 nv_wo32(grch->mmio, i++ * 4, grch->unk40800c->vinst >> 8); 139 nv_wo32(grch->mmio, i++ * 4, grch->unk40800c->linst >> 8);
140 nv_wo32(grch->mmio, i++ * 4, 0x00408010); 140 nv_wo32(grch->mmio, i++ * 4, 0x00408010);
141 nv_wo32(grch->mmio, i++ * 4, 0x80000000); 141 nv_wo32(grch->mmio, i++ * 4, 0x80000000);
142 142
143 nv_wo32(grch->mmio, i++ * 4, 0x00418810); 143 nv_wo32(grch->mmio, i++ * 4, 0x00418810);
144 nv_wo32(grch->mmio, i++ * 4, 0x80000000 | grch->unk418810->vinst >> 12); 144 nv_wo32(grch->mmio, i++ * 4, 0x80000000 | grch->unk418810->linst >> 12);
145 nv_wo32(grch->mmio, i++ * 4, 0x00419848); 145 nv_wo32(grch->mmio, i++ * 4, 0x00419848);
146 nv_wo32(grch->mmio, i++ * 4, 0x10000000 | grch->unk418810->vinst >> 12); 146 nv_wo32(grch->mmio, i++ * 4, 0x10000000 | grch->unk418810->linst >> 12);
147 147
148 nv_wo32(grch->mmio, i++ * 4, 0x00419004); 148 nv_wo32(grch->mmio, i++ * 4, 0x00419004);
149 nv_wo32(grch->mmio, i++ * 4, grch->unk40800c->vinst >> 8); 149 nv_wo32(grch->mmio, i++ * 4, grch->unk40800c->linst >> 8);
150 nv_wo32(grch->mmio, i++ * 4, 0x00419008); 150 nv_wo32(grch->mmio, i++ * 4, 0x00419008);
151 nv_wo32(grch->mmio, i++ * 4, 0x00000000); 151 nv_wo32(grch->mmio, i++ * 4, 0x00000000);
152 152
153 nv_wo32(grch->mmio, i++ * 4, 0x00418808); 153 nv_wo32(grch->mmio, i++ * 4, 0x00418808);
154 nv_wo32(grch->mmio, i++ * 4, grch->unk408004->vinst >> 8); 154 nv_wo32(grch->mmio, i++ * 4, grch->unk408004->linst >> 8);
155 nv_wo32(grch->mmio, i++ * 4, 0x0041880c); 155 nv_wo32(grch->mmio, i++ * 4, 0x0041880c);
156 nv_wo32(grch->mmio, i++ * 4, 0x80000018); 156 nv_wo32(grch->mmio, i++ * 4, 0x80000018);
157 157
@@ -197,8 +197,8 @@ nvc0_graph_context_new(struct nouveau_channel *chan, int engine)
197 if (ret) 197 if (ret)
198 goto error; 198 goto error;
199 199
200 nv_wo32(chan->ramin, 0x0210, lower_32_bits(grctx->vinst) | 4); 200 nv_wo32(chan->ramin, 0x0210, lower_32_bits(grctx->linst) | 4);
201 nv_wo32(chan->ramin, 0x0214, upper_32_bits(grctx->vinst)); 201 nv_wo32(chan->ramin, 0x0214, upper_32_bits(grctx->linst));
202 pinstmem->flush(dev); 202 pinstmem->flush(dev);
203 203
204 if (!priv->grctx_vals) { 204 if (!priv->grctx_vals) {
@@ -213,8 +213,8 @@ nvc0_graph_context_new(struct nouveau_channel *chan, int engine)
213 nv_wo32(grctx, 0xf4, 0); 213 nv_wo32(grctx, 0xf4, 0);
214 nv_wo32(grctx, 0xf8, 0); 214 nv_wo32(grctx, 0xf8, 0);
215 nv_wo32(grctx, 0x10, grch->mmio_nr); 215 nv_wo32(grctx, 0x10, grch->mmio_nr);
216 nv_wo32(grctx, 0x14, lower_32_bits(grch->mmio->vinst)); 216 nv_wo32(grctx, 0x14, lower_32_bits(grch->mmio->linst));
217 nv_wo32(grctx, 0x18, upper_32_bits(grch->mmio->vinst)); 217 nv_wo32(grctx, 0x18, upper_32_bits(grch->mmio->linst));
218 nv_wo32(grctx, 0x1c, 1); 218 nv_wo32(grctx, 0x1c, 1);
219 nv_wo32(grctx, 0x20, 0); 219 nv_wo32(grctx, 0x20, 0);
220 nv_wo32(grctx, 0x28, 0); 220 nv_wo32(grctx, 0x28, 0);