- also removes umem list hack - no more users Signed-off-by: Ben Skeggs <bskeggs@xxxxxxxxxx> --- .../gpu/drm/nouveau/include/nvif/driverif.h | 2 +- .../gpu/drm/nouveau/include/nvkm/subdev/mmu.h | 4 --- drivers/gpu/drm/nouveau/nvif/mem.c | 3 +- .../gpu/drm/nouveau/nvkm/subdev/mmu/base.c | 2 -- .../gpu/drm/nouveau/nvkm/subdev/mmu/umem.c | 36 ------------------- .../gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c | 5 +-- 6 files changed, 5 insertions(+), 47 deletions(-) diff --git a/drivers/gpu/drm/nouveau/include/nvif/driverif.h b/drivers/gpu/drm/nouveau/include/nvif/driverif.h index cc858955a97b..0a460eaaf76b 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/driverif.h +++ b/drivers/gpu/drm/nouveau/include/nvif/driverif.h @@ -202,7 +202,7 @@ struct nvif_mmu_impl { struct { s32 oclass; int (*new)(struct nvif_mmu_priv *, u8 type, u8 page, u64 size, void *argv, u32 argc, - const struct nvif_mem_impl **, struct nvif_mem_priv **, u64 handle); + const struct nvif_mem_impl **, struct nvif_mem_priv **); } mem; struct { diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h index f2d23bfdf29a..6a1472b9499f 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/mmu.h @@ -109,7 +109,6 @@ int nvkm_vmm_map(struct nvkm_vmm *, struct nvkm_vma *, void *argv, u32 argc, struct nvkm_vmm_map *); void nvkm_vmm_unmap(struct nvkm_vmm *, struct nvkm_vma *); -struct nvkm_memory *nvkm_umem_search(struct nvkm_mmu *, struct nvkm_client *, u64); struct nvkm_vmm *nvkm_uvmm_search(struct nvkm_client *, u64 handle); struct nvkm_mmu { @@ -148,9 +147,6 @@ struct nvkm_mmu { struct mutex mutex; /* serialises mmu invalidations */ struct nvkm_device_oclass user; - - spinlock_t umem_lock; - struct list_head umem; }; int nv04_mmu_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_mmu **); diff --git a/drivers/gpu/drm/nouveau/nvif/mem.c b/drivers/gpu/drm/nouveau/nvif/mem.c index 91faecc4c080..3aa04ed651c8 100644 --- a/drivers/gpu/drm/nouveau/nvif/mem.c +++ b/drivers/gpu/drm/nouveau/nvif/mem.c @@ -105,8 +105,7 @@ nvif_mem_ctor_type(struct nvif_mmu *mmu, const char *name, if (type < 0) return -EINVAL; - ret = mmu->impl->mem.new(mmu->priv, type, page, size, argv, argc, &mem->impl, &mem->priv, - nvif_handle(&mem->object)); + ret = mmu->impl->mem.new(mmu->priv, type, page, size, argv, argc, &mem->impl, &mem->priv); NVIF_DEBUG(&mmu->object, "[NEW mem%08x] (ret:%d)", oclass, ret); if (ret) return ret; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c index 08ad3ed84631..c7fe7222c3a3 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c @@ -427,8 +427,6 @@ nvkm_mmu_ctor(const struct nvkm_mmu_func *func, struct nvkm_device *device, nvkm_mmu_ptc_init(mmu); mutex_init(&mmu->mutex); mmu->user.base = func->mmu.user; - spin_lock_init(&mmu->umem_lock); - INIT_LIST_HEAD(&mmu->umem); } int diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c index 0676615093bb..93324d4f9d22 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/umem.c @@ -57,35 +57,6 @@ nvkm_umem_ref(struct nvif_mem_priv *umem) return NULL; } -static const struct nvkm_object_func nvkm_umem; -struct nvkm_memory * -nvkm_umem_search(struct nvkm_mmu *mmu, struct nvkm_client *client, u64 handle) -{ - struct nvkm_client *master = client->object.client; - struct nvkm_memory *memory = NULL; - struct nvkm_object *object; - struct nvif_mem_priv *umem; - - object = nvkm_object_search(client, handle, &nvkm_umem); - if (IS_ERR(object)) { - if (client != master) { - spin_lock(&mmu->umem_lock); - list_for_each_entry(umem, &mmu->umem, head) { - if (umem->object.object == handle) { - memory = nvkm_memory_ref(umem->memory); - break; - } - } - spin_unlock(&mmu->umem_lock); - } - } else { - umem = container_of(object, typeof(*umem), object); - memory = nvkm_memory_ref(umem->memory); - } - - return memory ? memory : ERR_PTR(-ENOENT); -} - static int nvkm_umem_unmap(struct nvif_mem_priv *umem) { @@ -163,9 +134,6 @@ nvkm_umem_dtor(struct nvkm_object *object) { struct nvif_mem_priv *umem = container_of(object, typeof(*umem), object); - spin_lock(&umem->mmu->umem_lock); - list_del_init(&umem->head); - spin_unlock(&umem->mmu->umem_lock); nvkm_memory_unref(&umem->memory); return umem; } @@ -203,10 +171,6 @@ nvkm_umem_new(struct nvkm_mmu *mmu, u8 type, u8 page, u64 size, void *argv, u32 if (ret) return ret; - spin_lock(&mmu->umem_lock); - list_add(&umem->head, &mmu->umem); - spin_unlock(&mmu->umem_lock); - umem->impl = nvkm_umem_impl; umem->impl.page = nvkm_memory_page(umem->memory); umem->impl.addr = nvkm_memory_addr(umem->memory); diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c index 7afb68dc4bed..b3883758828d 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c @@ -42,7 +42,7 @@ nvkm_ummu_vmm_new(struct nvif_mmu_priv *ummu, enum nvif_vmm_type type, u64 addr, static int nvkm_ummu_mem_new(struct nvif_mmu_priv *ummu, u8 type, u8 page, u64 size, void *argv, u32 argc, - const struct nvif_mem_impl **pimpl, struct nvif_mem_priv **ppriv, u64 handle) + const struct nvif_mem_impl **pimpl, struct nvif_mem_priv **ppriv) { struct nvkm_object *object; int ret; @@ -51,7 +51,8 @@ nvkm_ummu_mem_new(struct nvif_mmu_priv *ummu, u8 type, u8 page, u64 size, void * if (ret) return ret; - return nvkm_object_link_rb(ummu->object.client, &ummu->object, handle, object); + nvkm_object_link(&ummu->object, object); + return 0; } static void -- 2.41.0