[PATCH v3 25/37] drm/nouveau/nvif: remove device rd/wr

Zhi Wang zhiw at nvidia.com
Wed Jul 31 17:38:45 UTC 2024


On Fri, 26 Jul 2024 14:38:16 +1000
Ben Skeggs <bskeggs at nvidia.com> wrote:

Curious why the "(*{rd, wr}_32)()" are not removed together with others
in this patch?

Also, it would be better to put the removal of the udevice {rd, wr}*
callbacks in another new patch? As the tittle of this patch is for
cleaning the nvif, while udevice layer uses the nvkm_{rd,wr}, which
directly use io{read, write}*. I suppose it is not tied to nvif.

> The previous commit ensures the device is always mapped, so these
> are unneeded.
> 
> Signed-off-by: Ben Skeggs <bskeggs at nvidia.com>
> ---
>  .../drm/nouveau/include/nvkm/core/object.h    |  8 ---
>  drivers/gpu/drm/nouveau/nvkm/core/ioctl.c     | 10 ----
>  drivers/gpu/drm/nouveau/nvkm/core/object.c    | 32 -----------
>  drivers/gpu/drm/nouveau/nvkm/core/oproxy.c    | 28 ----------
>  .../gpu/drm/nouveau/nvkm/engine/device/user.c | 54
> ------------------- 5 files changed, 132 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/object.h
> b/drivers/gpu/drm/nouveau/include/nvkm/core/object.h index
> d4f1c964ba31..c91abac44bd6 100644 ---
> a/drivers/gpu/drm/nouveau/include/nvkm/core/object.h +++
> b/drivers/gpu/drm/nouveau/include/nvkm/core/object.h @@ -33,11 +33,7
> @@ struct nvkm_object_func { int (*map)(struct nvkm_object *, void
> *argv, u32 argc, enum nvkm_object_map *, u64 *addr, u64 *size);
>  	int (*unmap)(struct nvkm_object *);
> -	int (*rd08)(struct nvkm_object *, u64 addr, u8 *data);
> -	int (*rd16)(struct nvkm_object *, u64 addr, u16 *data);
>  	int (*rd32)(struct nvkm_object *, u64 addr, u32 *data);
> -	int (*wr08)(struct nvkm_object *, u64 addr, u8 data);
> -	int (*wr16)(struct nvkm_object *, u64 addr, u16 data);
>  	int (*wr32)(struct nvkm_object *, u64 addr, u32 data);
>  	int (*bind)(struct nvkm_object *, struct nvkm_gpuobj *, int
> align, struct nvkm_gpuobj **);
> @@ -61,11 +57,7 @@ int nvkm_object_ntfy(struct nvkm_object *, u32
> mthd, struct nvkm_event **); int nvkm_object_map(struct nvkm_object
> *, void *argv, u32 argc, enum nvkm_object_map *, u64 *addr, u64
> *size); int nvkm_object_unmap(struct nvkm_object *);
> -int nvkm_object_rd08(struct nvkm_object *, u64 addr, u8  *data);
> -int nvkm_object_rd16(struct nvkm_object *, u64 addr, u16 *data);
>  int nvkm_object_rd32(struct nvkm_object *, u64 addr, u32 *data);
> -int nvkm_object_wr08(struct nvkm_object *, u64 addr, u8   data);
> -int nvkm_object_wr16(struct nvkm_object *, u64 addr, u16  data);
>  int nvkm_object_wr32(struct nvkm_object *, u64 addr, u32  data);
>  int nvkm_object_bind(struct nvkm_object *, struct nvkm_gpuobj *, int
> align, struct nvkm_gpuobj **);
> diff --git a/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c
> b/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c index
> 584fc43c0d75..95e9537e1d7c 100644 ---
> a/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c +++
> b/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c @@ -206,14 +206,6 @@
> nvkm_ioctl_rd(struct nvkm_client *client, nvif_ioctl(object, "rd vers
> %d size %d addr %016llx\n", args->v0.version, args->v0.size,
> args->v0.addr); switch (args->v0.size) {
> -		case 1:
> -			ret = nvkm_object_rd08(object,
> args->v0.addr, &v.b08);
> -			args->v0.data = v.b08;
> -			break;
> -		case 2:
> -			ret = nvkm_object_rd16(object,
> args->v0.addr, &v.b16);
> -			args->v0.data = v.b16;
> -			break;
>  		case 4:
>  			ret = nvkm_object_rd32(object,
> args->v0.addr, &v.b32); args->v0.data = v.b32;
> @@ -246,8 +238,6 @@ nvkm_ioctl_wr(struct nvkm_client *client,
>  		return ret;
>  
>  	switch (args->v0.size) {
> -	case 1: return nvkm_object_wr08(object, args->v0.addr,
> args->v0.data);
> -	case 2: return nvkm_object_wr16(object, args->v0.addr,
> args->v0.data); case 4: return nvkm_object_wr32(object,
> args->v0.addr, args->v0.data); default:
>  		break;
> diff --git a/drivers/gpu/drm/nouveau/nvkm/core/object.c
> b/drivers/gpu/drm/nouveau/nvkm/core/object.c index
> 580b8c7f25af..913c3bae51f7 100644 ---
> a/drivers/gpu/drm/nouveau/nvkm/core/object.c +++
> b/drivers/gpu/drm/nouveau/nvkm/core/object.c @@ -132,22 +132,6 @@
> nvkm_object_unmap(struct nvkm_object *object) return -ENODEV;
>  }
>  
> -int
> -nvkm_object_rd08(struct nvkm_object *object, u64 addr, u8 *data)
> -{
> -	if (likely(object->func->rd08))
> -		return object->func->rd08(object, addr, data);
> -	return -ENODEV;
> -}
> -
> -int
> -nvkm_object_rd16(struct nvkm_object *object, u64 addr, u16 *data)
> -{
> -	if (likely(object->func->rd16))
> -		return object->func->rd16(object, addr, data);
> -	return -ENODEV;
> -}
> -
>  int
>  nvkm_object_rd32(struct nvkm_object *object, u64 addr, u32 *data)
>  {
> @@ -156,22 +140,6 @@ nvkm_object_rd32(struct nvkm_object *object, u64
> addr, u32 *data) return -ENODEV;
>  }
>  
> -int
> -nvkm_object_wr08(struct nvkm_object *object, u64 addr, u8 data)
> -{
> -	if (likely(object->func->wr08))
> -		return object->func->wr08(object, addr, data);
> -	return -ENODEV;
> -}
> -
> -int
> -nvkm_object_wr16(struct nvkm_object *object, u64 addr, u16 data)
> -{
> -	if (likely(object->func->wr16))
> -		return object->func->wr16(object, addr, data);
> -	return -ENODEV;
> -}
> -
>  int
>  nvkm_object_wr32(struct nvkm_object *object, u64 addr, u32 data)
>  {
> diff --git a/drivers/gpu/drm/nouveau/nvkm/core/oproxy.c
> b/drivers/gpu/drm/nouveau/nvkm/core/oproxy.c index
> 3385528da650..afc10ec256a7 100644 ---
> a/drivers/gpu/drm/nouveau/nvkm/core/oproxy.c +++
> b/drivers/gpu/drm/nouveau/nvkm/core/oproxy.c @@ -55,36 +55,12 @@
> nvkm_oproxy_unmap(struct nvkm_object *object) return
> nvkm_object_unmap(oproxy->object); }
>  
> -static int
> -nvkm_oproxy_rd08(struct nvkm_object *object, u64 addr, u8 *data)
> -{
> -	return nvkm_object_rd08(nvkm_oproxy(object)->object, addr,
> data); -}
> -
> -static int
> -nvkm_oproxy_rd16(struct nvkm_object *object, u64 addr, u16 *data)
> -{
> -	return nvkm_object_rd16(nvkm_oproxy(object)->object, addr,
> data); -}
> -
>  static int
>  nvkm_oproxy_rd32(struct nvkm_object *object, u64 addr, u32 *data)
>  {
>  	return nvkm_object_rd32(nvkm_oproxy(object)->object, addr,
> data); }
>  
> -static int
> -nvkm_oproxy_wr08(struct nvkm_object *object, u64 addr, u8 data)
> -{
> -	return nvkm_object_wr08(nvkm_oproxy(object)->object, addr,
> data); -}
> -
> -static int
> -nvkm_oproxy_wr16(struct nvkm_object *object, u64 addr, u16 data)
> -{
> -	return nvkm_object_wr16(nvkm_oproxy(object)->object, addr,
> data); -}
> -
>  static int
>  nvkm_oproxy_wr32(struct nvkm_object *object, u64 addr, u32 data)
>  {
> @@ -197,11 +173,7 @@ nvkm_oproxy_func = {
>  	.ntfy = nvkm_oproxy_ntfy,
>  	.map = nvkm_oproxy_map,
>  	.unmap = nvkm_oproxy_unmap,
> -	.rd08 = nvkm_oproxy_rd08,
> -	.rd16 = nvkm_oproxy_rd16,
>  	.rd32 = nvkm_oproxy_rd32,
> -	.wr08 = nvkm_oproxy_wr08,
> -	.wr16 = nvkm_oproxy_wr16,
>  	.wr32 = nvkm_oproxy_wr32,
>  	.bind = nvkm_oproxy_bind,
>  	.sclass = nvkm_oproxy_sclass,
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
> b/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c index
> 65bd6712bce2..d7f75b3a43c8 100644 ---
> a/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c +++
> b/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c @@ -202,54 +202,6
> @@ nvkm_udevice_mthd(struct nvkm_object *object, u32 mthd, void
> *data, u32 size) return -EINVAL; }
>  
> -static int
> -nvkm_udevice_rd08(struct nvkm_object *object, u64 addr, u8 *data)
> -{
> -	struct nvkm_udevice *udev = nvkm_udevice(object);
> -	*data = nvkm_rd08(udev->device, addr);
> -	return 0;
> -}
> -
> -static int
> -nvkm_udevice_rd16(struct nvkm_object *object, u64 addr, u16 *data)
> -{
> -	struct nvkm_udevice *udev = nvkm_udevice(object);
> -	*data = nvkm_rd16(udev->device, addr);
> -	return 0;
> -}
> -
> -static int
> -nvkm_udevice_rd32(struct nvkm_object *object, u64 addr, u32 *data)
> -{
> -	struct nvkm_udevice *udev = nvkm_udevice(object);
> -	*data = nvkm_rd32(udev->device, addr);
> -	return 0;
> -}
> -
> -static int
> -nvkm_udevice_wr08(struct nvkm_object *object, u64 addr, u8 data)
> -{
> -	struct nvkm_udevice *udev = nvkm_udevice(object);
> -	nvkm_wr08(udev->device, addr, data);
> -	return 0;
> -}
> -
> -static int
> -nvkm_udevice_wr16(struct nvkm_object *object, u64 addr, u16 data)
> -{
> -	struct nvkm_udevice *udev = nvkm_udevice(object);
> -	nvkm_wr16(udev->device, addr, data);
> -	return 0;
> -}
> -
> -static int
> -nvkm_udevice_wr32(struct nvkm_object *object, u64 addr, u32 data)
> -{
> -	struct nvkm_udevice *udev = nvkm_udevice(object);
> -	nvkm_wr32(udev->device, addr, data);
> -	return 0;
> -}
> -
>  static int
>  nvkm_udevice_map(struct nvkm_object *object, void *argv, u32 argc,
>  		 enum nvkm_object_map *type, u64 *addr, u64 *size)
> @@ -362,12 +314,6 @@ nvkm_udevice = {
>  	.fini = nvkm_udevice_fini,
>  	.mthd = nvkm_udevice_mthd,
>  	.map = nvkm_udevice_map,
> -	.rd08 = nvkm_udevice_rd08,
> -	.rd16 = nvkm_udevice_rd16,
> -	.rd32 = nvkm_udevice_rd32,
> -	.wr08 = nvkm_udevice_wr08,
> -	.wr16 = nvkm_udevice_wr16,
> -	.wr32 = nvkm_udevice_wr32,
>  	.sclass = nvkm_udevice_child_get,
>  };
>  



More information about the Nouveau mailing list