summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/nouveau/nvkm/subdev/bar
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2017-10-31 20:56:19 +0300
committerBen Skeggs <bskeggs@redhat.com>2017-11-02 06:32:18 +0300
commita78dbce9a161a3a985b837bd07afd8651d42cabd (patch)
tree0ecaec788cb83ca34841962a75937d02579a6538 /drivers/gpu/drm/nouveau/nvkm/subdev/bar
parent570889dc5070e1f98b5898dce426f970c9b9329b (diff)
downloadlinux-a78dbce9a161a3a985b837bd07afd8651d42cabd.tar.xz
drm/nouveau/bar: modify interface to bar2 vmm mapping
Match API with the BAR1 version. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/subdev/bar')
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c19
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bar/g84.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c16
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.h1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c14
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.h3
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bar/priv.h1
7 files changed, 29 insertions, 27 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c
index 5a80cf5f9eb0..d600aafae315 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c
@@ -30,19 +30,22 @@ nvkm_bar_flush(struct nvkm_bar *bar)
bar->func->flush(bar);
}
-struct nvkm_vm *
-nvkm_bar_kmap(struct nvkm_bar *bar)
+struct nvkm_vmm *
+nvkm_bar_bar1_vmm(struct nvkm_device *device)
{
- /* disallow kmap() until after vm has been bootstrapped */
- if (bar && bar->func->kmap && bar->subdev.oneinit)
- return bar->func->kmap(bar);
- return NULL;
+ return device->bar->func->bar1.vmm(device->bar);
}
struct nvkm_vmm *
-nvkm_bar_bar1_vmm(struct nvkm_device *device)
+nvkm_bar_bar2_vmm(struct nvkm_device *device)
{
- return device->bar->func->bar1.vmm(device->bar);
+ /* Denies access to BAR2 when it's not initialised, used by INSTMEM
+ * to know when object access needs to go through the BAR0 window.
+ */
+ struct nvkm_bar *bar = device->bar;
+ if (bar && bar->func->bar2.vmm && bar->subdev.oneinit)
+ return bar->func->bar2.vmm(bar);
+ return NULL;
}
void
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/g84.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/g84.c
index f88f5d6e64b9..87f26f54b481 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/g84.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/g84.c
@@ -51,7 +51,7 @@ g84_bar_func = {
.bar2.init = nv50_bar_bar2_init,
.bar2.fini = nv50_bar_bar2_fini,
.bar2.wait = nv50_bar_bar1_wait,
- .kmap = nv50_bar_kmap,
+ .bar2.vmm = nv50_bar_bar2_vmm,
.flush = g84_bar_flush,
};
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
index 379fa339dbaf..c6317a0f04a7 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
@@ -28,12 +28,6 @@
#include <subdev/fb.h>
#include <subdev/mmu.h>
-static struct nvkm_vm *
-gf100_bar_kmap(struct nvkm_bar *base)
-{
- return gf100_bar(base)->bar[0].vm;
-}
-
struct nvkm_vmm *
gf100_bar_bar1_vmm(struct nvkm_bar *base)
{
@@ -63,6 +57,12 @@ gf100_bar_bar1_init(struct nvkm_bar *base)
nvkm_wr32(device, 0x001704, 0x80000000 | addr);
}
+struct nvkm_vmm *
+gf100_bar_bar2_vmm(struct nvkm_bar *base)
+{
+ return gf100_bar(base)->bar[0].vm;
+}
+
void
gf100_bar_bar2_fini(struct nvkm_bar *bar)
{
@@ -142,7 +142,7 @@ gf100_bar_oneinit(struct nvkm_bar *base)
int ret;
/* BAR2 */
- if (bar->base.func->kmap) {
+ if (bar->base.func->bar2.init) {
ret = gf100_bar_oneinit_bar(bar, &bar->bar[0], &bar2_lock, 3);
if (ret)
return ret;
@@ -198,7 +198,7 @@ gf100_bar_func = {
.bar2.init = gf100_bar_bar2_init,
.bar2.fini = gf100_bar_bar2_fini,
.bar2.wait = gf100_bar_bar1_wait,
- .kmap = gf100_bar_kmap,
+ .bar2.vmm = gf100_bar_bar2_vmm,
.flush = g84_bar_flush,
};
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.h b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.h
index c56c8989b2a1..fc1a7bd975a7 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.h
@@ -23,4 +23,5 @@ void gf100_bar_bar1_init(struct nvkm_bar *);
void gf100_bar_bar1_wait(struct nvkm_bar *);
struct nvkm_vmm *gf100_bar_bar1_vmm(struct nvkm_bar *);
void gf100_bar_bar2_init(struct nvkm_bar *);
+struct nvkm_vmm *gf100_bar_bar2_vmm(struct nvkm_bar *);
#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c
index 8020cc996d1a..4b912c905551 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c
@@ -28,12 +28,6 @@
#include <subdev/mmu.h>
#include <subdev/timer.h>
-struct nvkm_vm *
-nv50_bar_kmap(struct nvkm_bar *base)
-{
- return nv50_bar(base)->bar2_vm;
-}
-
static void
nv50_bar_flush(struct nvkm_bar *base)
{
@@ -75,6 +69,12 @@ nv50_bar_bar1_init(struct nvkm_bar *base)
nvkm_wr32(device, 0x001708, 0x80000000 | bar->bar1->node->offset >> 4);
}
+struct nvkm_vmm *
+nv50_bar_bar2_vmm(struct nvkm_bar *base)
+{
+ return nv50_bar(base)->bar2_vm;
+}
+
void
nv50_bar_bar2_fini(struct nvkm_bar *bar)
{
@@ -232,7 +232,7 @@ nv50_bar_func = {
.bar2.init = nv50_bar_bar2_init,
.bar2.fini = nv50_bar_bar2_fini,
.bar2.wait = nv50_bar_bar1_wait,
- .kmap = nv50_bar_kmap,
+ .bar2.vmm = nv50_bar_bar2_vmm,
.flush = nv50_bar_flush,
};
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.h b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.h
index 24ca9a52cb42..b5fe26aab118 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.h
@@ -24,6 +24,5 @@ void nv50_bar_bar1_init(struct nvkm_bar *);
void nv50_bar_bar1_wait(struct nvkm_bar *);
struct nvkm_vmm *nv50_bar_bar1_vmm(struct nvkm_bar *);
void nv50_bar_bar2_init(struct nvkm_bar *);
-struct nvkm_vm *nv50_bar_kmap(struct nvkm_bar *);
-void nv50_bar_unmap(struct nvkm_bar *, struct nvkm_vma *);
+struct nvkm_vmm *nv50_bar_bar2_vmm(struct nvkm_bar *);
#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/priv.h
index 5aa220e204ee..f9a07b6d2860 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/priv.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/priv.h
@@ -18,7 +18,6 @@ struct nvkm_bar_func {
struct nvkm_vmm *(*vmm)(struct nvkm_bar *);
} bar1, bar2;
- struct nvkm_vm *(*kmap)(struct nvkm_bar *);
void (*flush)(struct nvkm_bar *);
};