Commit e988952e authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/bar: expose interface to bar2 teardown

Will prevent spurious MMU fault interrupts if something decides to touch
BAR1 after we've unloaded the driver.

Exposed external to BAR so that INSTMEM can use it to better control the
suspend/resume fast-path access.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 48fe0247
...@@ -15,6 +15,7 @@ struct nvkm_bar { ...@@ -15,6 +15,7 @@ struct nvkm_bar {
}; };
void nvkm_bar_bar2_init(struct nvkm_device *); void nvkm_bar_bar2_init(struct nvkm_device *);
void nvkm_bar_bar2_fini(struct nvkm_device *);
void nvkm_bar_flush(struct nvkm_bar *); void nvkm_bar_flush(struct nvkm_bar *);
struct nvkm_vm *nvkm_bar_kmap(struct nvkm_bar *); struct nvkm_vm *nvkm_bar_kmap(struct nvkm_bar *);
int nvkm_bar_umap(struct nvkm_bar *, u64 size, int type, struct nvkm_vma *); int nvkm_bar_umap(struct nvkm_bar *, u64 size, int type, struct nvkm_vma *);
......
...@@ -45,6 +45,16 @@ nvkm_bar_umap(struct nvkm_bar *bar, u64 size, int type, struct nvkm_vma *vma) ...@@ -45,6 +45,16 @@ nvkm_bar_umap(struct nvkm_bar *bar, u64 size, int type, struct nvkm_vma *vma)
return bar->func->umap(bar, size, type, vma); return bar->func->umap(bar, size, type, vma);
} }
void
nvkm_bar_bar2_fini(struct nvkm_device *device)
{
struct nvkm_bar *bar = device->bar;
if (bar && bar->bar2) {
bar->func->bar2.fini(bar);
bar->bar2 = false;
}
}
void void
nvkm_bar_bar2_init(struct nvkm_device *device) nvkm_bar_bar2_init(struct nvkm_device *device)
{ {
...@@ -61,7 +71,7 @@ nvkm_bar_fini(struct nvkm_subdev *subdev, bool suspend) ...@@ -61,7 +71,7 @@ nvkm_bar_fini(struct nvkm_subdev *subdev, bool suspend)
{ {
struct nvkm_bar *bar = nvkm_bar(subdev); struct nvkm_bar *bar = nvkm_bar(subdev);
bar->func->bar1.fini(bar); bar->func->bar1.fini(bar);
bar->bar2 = false; nvkm_bar_bar2_fini(subdev->device);
return 0; return 0;
} }
......
...@@ -48,6 +48,7 @@ g84_bar_func = { ...@@ -48,6 +48,7 @@ g84_bar_func = {
.bar1.fini = nv50_bar_bar1_fini, .bar1.fini = nv50_bar_bar1_fini,
.bar1.wait = nv50_bar_bar1_wait, .bar1.wait = nv50_bar_bar1_wait,
.bar2.init = nv50_bar_bar2_init, .bar2.init = nv50_bar_bar2_init,
.bar2.fini = nv50_bar_bar2_fini,
.bar2.wait = nv50_bar_bar1_wait, .bar2.wait = nv50_bar_bar1_wait,
.kmap = nv50_bar_kmap, .kmap = nv50_bar_kmap,
.umap = nv50_bar_umap, .umap = nv50_bar_umap,
......
...@@ -64,6 +64,12 @@ gf100_bar_bar1_init(struct nvkm_bar *base) ...@@ -64,6 +64,12 @@ gf100_bar_bar1_init(struct nvkm_bar *base)
nvkm_wr32(device, 0x001704, 0x80000000 | addr); nvkm_wr32(device, 0x001704, 0x80000000 | addr);
} }
void
gf100_bar_bar2_fini(struct nvkm_bar *bar)
{
nvkm_mask(bar->subdev.device, 0x001714, 0x80000000, 0x00000000);
}
void void
gf100_bar_bar2_init(struct nvkm_bar *base) gf100_bar_bar2_init(struct nvkm_bar *base)
{ {
...@@ -190,6 +196,7 @@ gf100_bar_func = { ...@@ -190,6 +196,7 @@ gf100_bar_func = {
.bar1.fini = gf100_bar_bar1_fini, .bar1.fini = gf100_bar_bar1_fini,
.bar1.wait = gf100_bar_bar1_wait, .bar1.wait = gf100_bar_bar1_wait,
.bar2.init = gf100_bar_bar2_init, .bar2.init = gf100_bar_bar2_init,
.bar2.fini = gf100_bar_bar2_fini,
.bar2.wait = gf100_bar_bar1_wait, .bar2.wait = gf100_bar_bar1_wait,
.kmap = gf100_bar_kmap, .kmap = gf100_bar_kmap,
.umap = gf100_bar_umap, .umap = gf100_bar_umap,
......
...@@ -76,6 +76,12 @@ nv50_bar_bar1_init(struct nvkm_bar *base) ...@@ -76,6 +76,12 @@ nv50_bar_bar1_init(struct nvkm_bar *base)
nvkm_wr32(device, 0x001708, 0x80000000 | bar->bar1->node->offset >> 4); nvkm_wr32(device, 0x001708, 0x80000000 | bar->bar1->node->offset >> 4);
} }
void
nv50_bar_bar2_fini(struct nvkm_bar *bar)
{
nvkm_wr32(bar->subdev.device, 0x00170c, 0x00000000);
}
void void
nv50_bar_bar2_init(struct nvkm_bar *base) nv50_bar_bar2_init(struct nvkm_bar *base)
{ {
...@@ -224,6 +230,7 @@ nv50_bar_func = { ...@@ -224,6 +230,7 @@ nv50_bar_func = {
.bar1.fini = nv50_bar_bar1_fini, .bar1.fini = nv50_bar_bar1_fini,
.bar1.wait = nv50_bar_bar1_wait, .bar1.wait = nv50_bar_bar1_wait,
.bar2.init = nv50_bar_bar2_init, .bar2.init = nv50_bar_bar2_init,
.bar2.fini = nv50_bar_bar2_fini,
.bar2.wait = nv50_bar_bar1_wait, .bar2.wait = nv50_bar_bar1_wait,
.kmap = nv50_bar_kmap, .kmap = nv50_bar_kmap,
.umap = nv50_bar_umap, .umap = nv50_bar_umap,
......
...@@ -23,8 +23,10 @@ struct nvkm_bar_func { ...@@ -23,8 +23,10 @@ struct nvkm_bar_func {
}; };
void nv50_bar_bar1_fini(struct nvkm_bar *); void nv50_bar_bar1_fini(struct nvkm_bar *);
void nv50_bar_bar2_fini(struct nvkm_bar *);
void g84_bar_flush(struct nvkm_bar *); void g84_bar_flush(struct nvkm_bar *);
void gf100_bar_bar1_fini(struct nvkm_bar *); void gf100_bar_bar1_fini(struct nvkm_bar *);
void gf100_bar_bar2_fini(struct nvkm_bar *);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment