Commit 1786bf56 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/imem/nv50: support pinning objects in BAR2 and returning address

Various structures are accessed by the GPU through BAR2 for some reason
on newer GPUs.  This commit makes it more convenient to handle.

Will be used for GP100- fault buffers, and GV100- fault method buffers.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent e4f90a35
...@@ -29,6 +29,7 @@ struct nvkm_memory_func { ...@@ -29,6 +29,7 @@ struct nvkm_memory_func {
void *(*dtor)(struct nvkm_memory *); void *(*dtor)(struct nvkm_memory *);
enum nvkm_memory_target (*target)(struct nvkm_memory *); enum nvkm_memory_target (*target)(struct nvkm_memory *);
u8 (*page)(struct nvkm_memory *); u8 (*page)(struct nvkm_memory *);
u64 (*bar2)(struct nvkm_memory *);
u64 (*addr)(struct nvkm_memory *); u64 (*addr)(struct nvkm_memory *);
u64 (*size)(struct nvkm_memory *); u64 (*size)(struct nvkm_memory *);
void (*boot)(struct nvkm_memory *, struct nvkm_vmm *); void (*boot)(struct nvkm_memory *, struct nvkm_vmm *);
...@@ -56,6 +57,7 @@ void nvkm_memory_tags_put(struct nvkm_memory *, struct nvkm_device *, ...@@ -56,6 +57,7 @@ void nvkm_memory_tags_put(struct nvkm_memory *, struct nvkm_device *,
#define nvkm_memory_target(p) (p)->func->target(p) #define nvkm_memory_target(p) (p)->func->target(p)
#define nvkm_memory_page(p) (p)->func->page(p) #define nvkm_memory_page(p) (p)->func->page(p)
#define nvkm_memory_bar2(p) (p)->func->bar2(p)
#define nvkm_memory_addr(p) (p)->func->addr(p) #define nvkm_memory_addr(p) (p)->func->addr(p)
#define nvkm_memory_size(p) (p)->func->size(p) #define nvkm_memory_size(p) (p)->func->size(p)
#define nvkm_memory_boot(p,v) (p)->func->boot((p),(v)) #define nvkm_memory_boot(p,v) (p)->func->boot((p),(v))
......
...@@ -288,6 +288,19 @@ nv50_instobj_addr(struct nvkm_memory *memory) ...@@ -288,6 +288,19 @@ nv50_instobj_addr(struct nvkm_memory *memory)
return nvkm_memory_addr(nv50_instobj(memory)->ram); return nvkm_memory_addr(nv50_instobj(memory)->ram);
} }
static u64
nv50_instobj_bar2(struct nvkm_memory *memory)
{
struct nv50_instobj *iobj = nv50_instobj(memory);
u64 addr = ~0ULL;
if (nv50_instobj_acquire(&iobj->base.memory)) {
iobj->lru.next = NULL; /* Exclude from eviction. */
addr = iobj->bar->addr;
}
nv50_instobj_release(&iobj->base.memory);
return addr;
}
static enum nvkm_memory_target static enum nvkm_memory_target
nv50_instobj_target(struct nvkm_memory *memory) nv50_instobj_target(struct nvkm_memory *memory)
{ {
...@@ -325,8 +338,9 @@ static const struct nvkm_memory_func ...@@ -325,8 +338,9 @@ static const struct nvkm_memory_func
nv50_instobj_func = { nv50_instobj_func = {
.dtor = nv50_instobj_dtor, .dtor = nv50_instobj_dtor,
.target = nv50_instobj_target, .target = nv50_instobj_target,
.size = nv50_instobj_size, .bar2 = nv50_instobj_bar2,
.addr = nv50_instobj_addr, .addr = nv50_instobj_addr,
.size = nv50_instobj_size,
.boot = nv50_instobj_boot, .boot = nv50_instobj_boot,
.acquire = nv50_instobj_acquire, .acquire = nv50_instobj_acquire,
.release = nv50_instobj_release, .release = nv50_instobj_release,
......
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