- transition from "ioctl" interface Signed-off-by: Ben Skeggs <bskeggs@xxxxxxxxxx> --- .../gpu/drm/nouveau/include/nvif/driverif.h | 4 ++++ drivers/gpu/drm/nouveau/include/nvif/if0008.h | 8 ------- drivers/gpu/drm/nouveau/include/nvif/mmu.h | 5 ---- drivers/gpu/drm/nouveau/nvif/mmu.c | 18 +-------------- .../gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c | 23 ++----------------- 5 files changed, 7 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/nouveau/include/nvif/driverif.h b/drivers/gpu/drm/nouveau/include/nvif/driverif.h index a1b97bc5e933..9205c2c3b34e 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/driverif.h +++ b/drivers/gpu/drm/nouveau/include/nvif/driverif.h @@ -85,6 +85,10 @@ struct nvif_mmu_impl { u16 kind_nr; + struct { + u64 size; + } heap[4]; + struct { s32 oclass; } mem; diff --git a/drivers/gpu/drm/nouveau/include/nvif/if0008.h b/drivers/gpu/drm/nouveau/include/nvif/if0008.h index 618df13762d3..551bdf49d6e2 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/if0008.h +++ b/drivers/gpu/drm/nouveau/include/nvif/if0008.h @@ -1,17 +1,9 @@ #ifndef __NVIF_IF0008_H__ #define __NVIF_IF0008_H__ -#define NVIF_MMU_V0_HEAP 0x00 #define NVIF_MMU_V0_TYPE 0x01 #define NVIF_MMU_V0_KIND 0x02 -struct nvif_mmu_heap_v0 { - __u8 version; - __u8 index; - __u8 pad02[6]; - __u64 size; -}; - struct nvif_mmu_type_v0 { __u8 version; __u8 index; diff --git a/drivers/gpu/drm/nouveau/include/nvif/mmu.h b/drivers/gpu/drm/nouveau/include/nvif/mmu.h index ed5d011f4237..ff4938911621 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/mmu.h +++ b/drivers/gpu/drm/nouveau/include/nvif/mmu.h @@ -8,15 +8,10 @@ struct nvif_mmu { const struct nvif_mmu_impl *impl; struct nvif_mmu_priv *priv; struct nvif_object object; - u8 heap_nr; u8 type_nr; u8 kind_inv; u16 kind_nr; - struct { - u64 size; - } *heap; - struct { #define NVIF_MEM_VRAM 0x01 #define NVIF_MEM_HOST 0x02 diff --git a/drivers/gpu/drm/nouveau/nvif/mmu.c b/drivers/gpu/drm/nouveau/nvif/mmu.c index 7e592a6d8530..ec5ec8be98c0 100644 --- a/drivers/gpu/drm/nouveau/nvif/mmu.c +++ b/drivers/gpu/drm/nouveau/nvif/mmu.c @@ -34,7 +34,6 @@ nvif_mmu_dtor(struct nvif_mmu *mmu) kfree(mmu->kind); kfree(mmu->type); - kfree(mmu->heap); mmu->impl->del(mmu->priv); mmu->impl = NULL; } @@ -46,7 +45,6 @@ nvif_mmu_ctor(struct nvif_device *device, const char *name, struct nvif_mmu *mmu int ret, i; mmu->impl = NULL; - mmu->heap = NULL; mmu->type = NULL; mmu->kind = NULL; @@ -58,15 +56,12 @@ nvif_mmu_ctor(struct nvif_device *device, const char *name, struct nvif_mmu *mmu nvif_object_ctor(&device->object, name ?: "nvifMmu", 0, oclass, &mmu->object); - mmu->heap_nr = mmu->impl->heap_nr; mmu->type_nr = mmu->impl->type_nr; mmu->kind_nr = mmu->impl->kind_nr; - mmu->heap = kmalloc_array(mmu->heap_nr, sizeof(*mmu->heap), - GFP_KERNEL); mmu->type = kmalloc_array(mmu->type_nr, sizeof(*mmu->type), GFP_KERNEL); - if (ret = -ENOMEM, !mmu->heap || !mmu->type) + if (ret = -ENOMEM, !mmu->type) goto done; mmu->kind = kmalloc_array(mmu->kind_nr, sizeof(*mmu->kind), @@ -74,17 +69,6 @@ nvif_mmu_ctor(struct nvif_device *device, const char *name, struct nvif_mmu *mmu if (!mmu->kind && mmu->kind_nr) goto done; - for (i = 0; i < mmu->heap_nr; i++) { - struct nvif_mmu_heap_v0 args = { .index = i }; - - ret = nvif_object_mthd(&mmu->object, NVIF_MMU_V0_HEAP, - &args, sizeof(args)); - if (ret) - goto done; - - mmu->heap[i].size = args.size; - } - for (i = 0; i < mmu->type_nr; i++) { struct nvif_mmu_type_v0 args = { .index = i }; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c index 9f44d469b4da..9a42721eabd8 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/ummu.c @@ -53,26 +53,6 @@ nvkm_ummu_sclass(struct nvkm_object *object, int index, return -EINVAL; } -static int -nvkm_ummu_heap(struct nvkm_ummu *ummu, void *argv, u32 argc) -{ - struct nvkm_mmu *mmu = ummu->mmu; - union { - struct nvif_mmu_heap_v0 v0; - } *args = argv; - int ret = -ENOSYS; - u8 index; - - if (!(ret = nvif_unpack(ret, &argv, &argc, args->v0, 0, 0, false))) { - if ((index = args->v0.index) >= mmu->heap_nr) - return -EINVAL; - args->v0.size = mmu->heap[index].size; - } else - return ret; - - return 0; -} - static int nvkm_ummu_type(struct nvkm_ummu *ummu, void *argv, u32 argc) { @@ -147,7 +127,6 @@ nvkm_ummu_mthd(struct nvkm_object *object, u32 mthd, void *argv, u32 argc) { struct nvif_mmu_priv *ummu = container_of(object, typeof(*ummu), object); switch (mthd) { - case NVIF_MMU_V0_HEAP: return nvkm_ummu_heap(ummu, argv, argc); case NVIF_MMU_V0_TYPE: return nvkm_ummu_type(ummu, argv, argc); case NVIF_MMU_V0_KIND: return nvkm_ummu_kind(ummu, argv, argc); default: @@ -185,6 +164,8 @@ nvkm_ummu_new(struct nvkm_device *device, const struct nvif_mmu_impl **pimpl, ummu->impl.heap_nr = mmu->heap_nr; ummu->impl.type_nr = mmu->type_nr; ummu->impl.kind_nr = kinds; + for (int i = 0; i < mmu->heap_nr; i++) + ummu->impl.heap[i].size = mmu->heap[i].size; ummu->impl.mem.oclass = mmu->func->mem.user.oclass; -- 2.41.0