Match API with the BAR1 version.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
struct nvkm_vmm *nvkm_bar_bar1_vmm(struct nvkm_device *);
void nvkm_bar_bar2_init(struct nvkm_device *);
void nvkm_bar_bar2_fini(struct nvkm_device *);
+struct nvkm_vmm *nvkm_bar_bar2_vmm(struct nvkm_device *);
void nvkm_bar_flush(struct nvkm_bar *);
-struct nvkm_vm *nvkm_bar_kmap(struct nvkm_bar *);
int nv50_bar_new(struct nvkm_device *, int, struct nvkm_bar **);
int g84_bar_new(struct nvkm_device *, int, struct nvkm_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
.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,
};
#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)
{
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)
{
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;
.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,
};
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
#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)
{
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)
{
.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,
};
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
struct nvkm_vmm *(*vmm)(struct nvkm_bar *);
} bar1, bar2;
- struct nvkm_vm *(*kmap)(struct nvkm_bar *);
void (*flush)(struct nvkm_bar *);
};
{
struct nv50_instobj *iobj = nv50_instobj(memory);
struct nv50_instmem *imem = iobj->imem;
- struct nvkm_bar *bar = imem->base.subdev.device->bar;
struct nvkm_vm *vm;
unsigned long flags;
- if (!iobj->map && (vm = nvkm_bar_kmap(bar)))
+ if (!iobj->map && (vm = nvkm_bar_bar2_vmm(imem->base.subdev.device)))
nvkm_memory_boot(memory, vm);
if (!IS_ERR_OR_NULL(iobj->map))
return iobj->map;