#ifndef __NVKM_FB_H__
#define __NVKM_FB_H__
#include <core/subdev.h>
+#include <core/memory.h>
#include <subdev/mmu.h>
u64 offset;
u64 size;
struct sg_table *sg;
+
+ struct nvkm_memory *memory;
};
struct nvkm_fb_tile {
else mem->__mem.pages = tt->dma_address;
mem->_mem = &mem->__mem;
mem->mem.page = 12;
+ mem->_mem->memory = &mem->memory;
return 0;
}
int ret;
mem->mem.page = page;
+ mem->_mem->memory = &mem->memory;
ret = ram->func->get(ram, size, 1 << page, contig ? 0 : 1 << page,
(mem->comp << 8) | mem->kind, &mem->_mem);
reg->mm_node = NULL;
}
+static enum nvkm_memory_target
+nouveau_mem_memory_target(struct nvkm_memory *memory)
+{
+ struct nouveau_mem *mem = container_of(memory, typeof(*mem), memory);
+ if (mem->_mem->mem)
+ return NVKM_MEM_TARGET_VRAM;
+ return NVKM_MEM_TARGET_HOST;
+};
+
+static u8
+nouveau_mem_memory_page(struct nvkm_memory *memory)
+{
+ struct nouveau_mem *mem = container_of(memory, typeof(*mem), memory);
+ return mem->mem.page;
+};
+
+static u64
+nouveau_mem_memory_size(struct nvkm_memory *memory)
+{
+ struct nouveau_mem *mem = container_of(memory, typeof(*mem), memory);
+ return mem->_mem->size << 12;
+}
+
+static const struct nvkm_memory_func
+nouveau_mem_memory = {
+ .target = nouveau_mem_memory_target,
+ .page = nouveau_mem_memory_page,
+ .size = nouveau_mem_memory_size,
+};
+
int
nouveau_mem_new(struct nouveau_cli *cli, u8 kind, u8 comp,
struct ttm_mem_reg *reg)
mem->cli = cli;
mem->kind = kind;
mem->comp = comp;
+ nvkm_memory_ctor(&nouveau_mem_memory, &mem->memory);
reg->mm_node = mem;
return 0;
struct nvkm_mem __mem;
struct nvkm_mem *_mem;
struct nvkm_vma bar_vma;
+
+ struct nvkm_memory memory;
+};
+
+enum nvif_vmm_get {
+ PTES,
+ LAZY,
};
int nouveau_mem_new(struct nouveau_cli *, u8 kind, u8 comp,
struct nvkm_vram *vram = nvkm_vram(memory);
struct nvkm_mem mem = {
.mem = vram->mn,
+ .memory = &vram->memory,
};
nvkm_vm_map_at(vma, offset, &mem);
return 0;
return NVKM_MEM_TARGET_NCOH;
}
+static u8
+gk20a_instobj_page(struct nvkm_memory *memory)
+{
+ return 12;
+}
+
static u64
gk20a_instobj_addr(struct nvkm_memory *memory)
{
gk20a_instobj_func_dma = {
.dtor = gk20a_instobj_dtor_dma,
.target = gk20a_instobj_target,
+ .page = gk20a_instobj_page,
.addr = gk20a_instobj_addr,
.size = gk20a_instobj_size,
.acquire = gk20a_instobj_acquire_dma,
gk20a_instobj_func_iommu = {
.dtor = gk20a_instobj_dtor_iommu,
.target = gk20a_instobj_target,
+ .page = gk20a_instobj_page,
.addr = gk20a_instobj_addr,
.size = gk20a_instobj_size,
.acquire = gk20a_instobj_acquire_iommu,
/* present memory for being mapped using small pages */
node->mem.size = size >> 12;
node->mem.memtype = 0;
+ node->mem.memory = &node->memory;
nvkm_debug(subdev, "alloc size: 0x%x, align: 0x%x, gaddr: 0x%llx\n",
size, align, node->mem.offset);