struct nv50_instobj {
struct nvkm_instobj base;
struct nv50_instmem *imem;
- struct nvkm_mem *mem;
+ struct nvkm_memory *ram;
struct nvkm_vma bar;
refcount_t maps;
void *map;
struct nv50_instobj *iobj = nv50_instobj(memory);
struct nv50_instmem *imem = iobj->imem;
struct nvkm_device *device = imem->base.subdev.device;
- u64 base = (iobj->mem->offset + offset) & 0xffffff00000ULL;
- u64 addr = (iobj->mem->offset + offset) & 0x000000fffffULL;
+ u64 base = (nvkm_memory_addr(iobj->ram) + offset) & 0xffffff00000ULL;
+ u64 addr = (nvkm_memory_addr(iobj->ram) + offset) & 0x000000fffffULL;
unsigned long flags;
spin_lock_irqsave(&imem->base.lock, flags);
struct nv50_instobj *iobj = nv50_instobj(memory);
struct nv50_instmem *imem = iobj->imem;
struct nvkm_device *device = imem->base.subdev.device;
- u64 base = (iobj->mem->offset + offset) & 0xffffff00000ULL;
- u64 addr = (iobj->mem->offset + offset) & 0x000000fffffULL;
+ u64 base = (nvkm_memory_addr(iobj->ram) + offset) & 0xffffff00000ULL;
+ u64 addr = (nvkm_memory_addr(iobj->ram) + offset) & 0x000000fffffULL;
u32 data;
unsigned long flags;
nv50_instobj_map(struct nvkm_memory *memory, u64 offset, struct nvkm_vmm *vmm,
struct nvkm_vma *vma, void *argv, u32 argc)
{
- struct nv50_instobj *iobj = nv50_instobj(memory);
- nvkm_vm_map_at(vma, offset, iobj->mem);
- return 0;
+ memory = nv50_instobj(memory)->ram;
+ return nvkm_memory_map(memory, offset, vmm, vma, argv, argc);
}
static void
static u64
nv50_instobj_size(struct nvkm_memory *memory)
{
- return (u64)nv50_instobj(memory)->mem->size << NVKM_RAM_MM_SHIFT;
+ return nvkm_memory_size(nv50_instobj(memory)->ram);
}
static u64
nv50_instobj_addr(struct nvkm_memory *memory)
{
- return nv50_instobj(memory)->mem->offset;
+ return nvkm_memory_addr(nv50_instobj(memory)->ram);
}
static enum nvkm_memory_target
nv50_instobj_target(struct nvkm_memory *memory)
{
- return NVKM_MEM_TARGET_VRAM;
+ return nvkm_memory_target(nv50_instobj(memory)->ram);
}
static void *
{
struct nv50_instobj *iobj = nv50_instobj(memory);
struct nvkm_instmem *imem = &iobj->imem->base;
- struct nvkm_ram *ram = imem->subdev.device->fb->ram;
struct nvkm_vma bar;
void *map = map;
nvkm_vm_put(&bar);
}
- ram->func->put(ram, &iobj->mem);
+ nvkm_memory_unref(&iobj->ram);
nvkm_instobj_dtor(imem, &iobj->base);
return iobj;
}
{
struct nv50_instmem *imem = nv50_instmem(base);
struct nv50_instobj *iobj;
- struct nvkm_ram *ram = imem->base.subdev.device->fb->ram;
- int ret;
+ struct nvkm_device *device = imem->base.subdev.device;
+ u8 page = max(order_base_2(align), 12);
if (!(iobj = kzalloc(sizeof(*iobj), GFP_KERNEL)))
return -ENOMEM;
refcount_set(&iobj->maps, 0);
INIT_LIST_HEAD(&iobj->lru);
- size = max((size + 4095) & ~4095, (u32)4096);
- align = max((align + 4095) & ~4095, (u32)4096);
-
- ret = ram->func->get(ram, size, align, 0, 0x800, &iobj->mem);
- if (ret)
- return ret;
-
- return 0;
+ return nvkm_ram_get(device, 0, 1, page, size, true, true, &iobj->ram);
}
/******************************************************************************