Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c74eb7f authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nvc0: import initial vm backend



Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 3ee01281
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \
             nv10_gpio.o nv50_gpio.o \
	     nv50_calc.o \
	     nv04_pm.o nv50_pm.o nva3_pm.o \
	     nv50_vram.o nv50_vm.o
	     nv50_vram.o nv50_vm.o nvc0_vm.o

nouveau-$(CONFIG_DRM_NOUVEAU_DEBUG) += nouveau_debugfs.o
nouveau-$(CONFIG_COMPAT) += nouveau_ioc32.o
+3 −2
Original line number Diff line number Diff line
@@ -909,8 +909,9 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
			break;
		}

		ret = nouveau_vm_get(dev_priv->bar1_vm, mem->bus.size, 12,
				     NV_MEM_ACCESS_RW, &vram->bar_vma);
		ret = nouveau_vm_get(dev_priv->bar1_vm, mem->bus.size,
				     vram->page_shift, NV_MEM_ACCESS_RW,
				     &vram->bar_vma);
		if (ret)
			return ret;

+1 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ struct nouveau_vram {
	struct drm_device *dev;

	struct nouveau_vma bar_vma;
	u8  page_shift;

	struct list_head regions;
	u32 memtype;
+4 −0
Original line number Diff line number Diff line
@@ -731,6 +731,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man,
	if (ret)
		return ret;

	node->page_shift = 12;
	if (nvbo->vma.node)
		node->page_shift = nvbo->vma.node->type;

	mem->mm_node = node;
	mem->start   = node->offset >> PAGE_SHIFT;
	return 0;
+27 −4
Original line number Diff line number Diff line
@@ -295,7 +295,34 @@ nouveau_vm_new(struct drm_device *dev, u64 offset, u64 length, u64 mm_offset,
		vm->flush = nv50_vm_flush;
		vm->spg_shift = 12;
		vm->lpg_shift = 16;

		pgt_bits = 29;
		block = (1 << pgt_bits);
		if (length < block)
			block = length;

	} else
	if (dev_priv->card_type == NV_C0) {
		vm->map_pgt = nvc0_vm_map_pgt;
		vm->map = nvc0_vm_map;
		vm->map_sg = nvc0_vm_map_sg;
		vm->unmap = nvc0_vm_unmap;
		vm->flush = nvc0_vm_flush;
		vm->spg_shift = 12;
		vm->lpg_shift = 17;
		pgt_bits = 27;

		/* Should be 4096 everywhere, this is a hack that's
		 * currently necessary to avoid an elusive bug that
		 * causes corruption when mixing small/large pages
		 */
		if (length < (1ULL << 40))
			block = 4096;
		else {
			block = (1 << pgt_bits);
			if (length < block)
				block = length;
		}
	} else {
		kfree(vm);
		return -ENOSYS;
@@ -314,10 +341,6 @@ nouveau_vm_new(struct drm_device *dev, u64 offset, u64 length, u64 mm_offset,
	vm->refcount = 1;
	vm->pgt_bits = pgt_bits - 12;

	block = (1 << pgt_bits);
	if (length < block)
		block = length;

	ret = nouveau_mm_init(&vm->mm, mm_offset >> 12, mm_length >> 12,
			      block >> 12);
	if (ret) {
Loading