mirror of
https://github.com/torvalds/linux.git
synced 2024-12-31 23:31:29 +00:00
drm/nouveau/bar: modify interface to bar2 vmm mapping
Match API with the BAR1 version. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
570889dc50
commit
a78dbce9a1
@ -17,8 +17,8 @@ struct nvkm_bar {
|
||||
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 **);
|
||||
|
@ -30,21 +30,24 @@ nvkm_bar_flush(struct nvkm_bar *bar)
|
||||
bar->func->flush(bar);
|
||||
}
|
||||
|
||||
struct nvkm_vm *
|
||||
nvkm_bar_kmap(struct nvkm_bar *bar)
|
||||
{
|
||||
/* disallow kmap() until after vm has been bootstrapped */
|
||||
if (bar && bar->func->kmap && bar->subdev.oneinit)
|
||||
return bar->func->kmap(bar);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct nvkm_vmm *
|
||||
nvkm_bar_bar1_vmm(struct nvkm_device *device)
|
||||
{
|
||||
return device->bar->func->bar1.vmm(device->bar);
|
||||
}
|
||||
|
||||
struct nvkm_vmm *
|
||||
nvkm_bar_bar2_vmm(struct nvkm_device *device)
|
||||
{
|
||||
/* 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
|
||||
nvkm_bar_bar2_fini(struct nvkm_device *device)
|
||||
{
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 *);
|
||||
};
|
||||
|
||||
|
@ -107,11 +107,10 @@ nv50_instobj_acquire(struct nvkm_memory *memory)
|
||||
{
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user