All of lore.kernel.org
 help / color / mirror / Atom feed
From: Danilo Krummrich <dakr@redhat.com>
To: Ben Skeggs <bskeggs@nvidia.com>
Cc: nouveau@lists.freedesktop.org
Subject: Re: [PATCH v2 23/37] drm/nouveau/nvif: remove device args
Date: Tue, 9 Jul 2024 18:18:58 +0200	[thread overview]
Message-ID: <Zo1i8tw00OaFlfg4@pollux> (raw)
In-Reply-To: <20240704183721.25778-24-bskeggs@nvidia.com>

On Fri, Jul 05, 2024 at 04:37:07AM +1000, Ben Skeggs wrote:
> These were once used by used by userspace tools (with nvkm built as a
> library), to access multiple GPUs from a single nvif_client.
> 
> The DRM code just uses the driver's default device, so we can remove
> the arguments.

"so remove the argument."

Sorry for repeating that, I somehow missed the point to say "here and for
subsequent commits".

> 
> Signed-off-by: Ben Skeggs <bskeggs@nvidia.com>
> ---
>  drivers/gpu/drm/nouveau/include/nvif/cl0080.h |  7 ----
>  drivers/gpu/drm/nouveau/include/nvif/device.h |  3 +-
>  drivers/gpu/drm/nouveau/nouveau_drm.c         |  7 +---
>  drivers/gpu/drm/nouveau/nvif/device.c         |  9 +++--
>  .../gpu/drm/nouveau/nvkm/engine/device/user.c | 36 ++-----------------
>  5 files changed, 9 insertions(+), 53 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/include/nvif/cl0080.h b/drivers/gpu/drm/nouveau/include/nvif/cl0080.h
> index fa161b74d967..ea937fa7bc55 100644
> --- a/drivers/gpu/drm/nouveau/include/nvif/cl0080.h
> +++ b/drivers/gpu/drm/nouveau/include/nvif/cl0080.h
> @@ -2,13 +2,6 @@
>  #ifndef __NVIF_CL0080_H__
>  #define __NVIF_CL0080_H__
>  
> -struct nv_device_v0 {
> -	__u8  version;
> -	__u8  priv;
> -	__u8  pad02[6];
> -	__u64 device;	/* device identifier, ~0 for client default */
> -};
> -
>  #define NV_DEVICE_V0_INFO                                                  0x00
>  #define NV_DEVICE_V0_TIME                                                  0x01
>  
> diff --git a/drivers/gpu/drm/nouveau/include/nvif/device.h b/drivers/gpu/drm/nouveau/include/nvif/device.h
> index b0e59800a320..f7c1b3a43c84 100644
> --- a/drivers/gpu/drm/nouveau/include/nvif/device.h
> +++ b/drivers/gpu/drm/nouveau/include/nvif/device.h
> @@ -18,8 +18,7 @@ struct nvif_device {
>  	struct nvif_user user;
>  };
>  
> -int  nvif_device_ctor(struct nvif_object *, const char *name, u32 handle,
> -		      s32 oclass, void *, u32, struct nvif_device *);
> +int  nvif_device_ctor(struct nvif_client *, const char *name, struct nvif_device *);
>  void nvif_device_dtor(struct nvif_device *);
>  u64  nvif_device_time(struct nvif_device *);
>  
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index 8951a0805239..0beeff8552a2 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -261,12 +261,7 @@ nouveau_cli_init(struct nouveau_drm *drm, const char *sname,
>  		goto done;
>  	}
>  
> -	ret = nvif_device_ctor(&cli->base.object, "drmDevice", 0, NV_DEVICE,
> -			       &(struct nv_device_v0) {
> -					.device = ~0,
> -					.priv = true,
> -			       }, sizeof(struct nv_device_v0),
> -			       &cli->device);
> +	ret = nvif_device_ctor(&cli->base, "drmDevice", &cli->device);
>  	if (ret) {
>  		NV_PRINTK(err, cli, "Device allocation failed: %d\n", ret);
>  		goto done;
> diff --git a/drivers/gpu/drm/nouveau/nvif/device.c b/drivers/gpu/drm/nouveau/nvif/device.c
> index 8c3d883f3313..b14bccb9a93f 100644
> --- a/drivers/gpu/drm/nouveau/nvif/device.c
> +++ b/drivers/gpu/drm/nouveau/nvif/device.c
> @@ -21,8 +21,8 @@
>   *
>   * Authors: Ben Skeggs <bskeggs@redhat.com>
>   */
> -
>  #include <nvif/device.h>
> +#include <nvif/client.h>
>  
>  u64
>  nvif_device_time(struct nvif_device *device)
> @@ -48,11 +48,10 @@ nvif_device_dtor(struct nvif_device *device)
>  }
>  
>  int
> -nvif_device_ctor(struct nvif_object *parent, const char *name, u32 handle,
> -		 s32 oclass, void *data, u32 size, struct nvif_device *device)
> +nvif_device_ctor(struct nvif_client *client, const char *name, struct nvif_device *device)
>  {
> -	int ret = nvif_object_ctor(parent, name ? name : "nvifDevice", handle,
> -				   oclass, data, size, &device->object);
> +	int ret = nvif_object_ctor(&client->object, name ? name : "nvifDevice", 0,
> +				   0x0080, NULL, 0, &device->object);
>  	device->runlist = NULL;
>  	device->user.func = NULL;
>  	if (ret == 0) {
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
> index d937c54e8dfa..65bd6712bce2 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
> @@ -357,7 +357,7 @@ nvkm_udevice_child_get(struct nvkm_object *object, int index,
>  }
>  
>  static const struct nvkm_object_func
> -nvkm_udevice_super = {
> +nvkm_udevice = {
>  	.init = nvkm_udevice_init,
>  	.fini = nvkm_udevice_fini,
>  	.mthd = nvkm_udevice_mthd,
> @@ -371,50 +371,20 @@ nvkm_udevice_super = {
>  	.sclass = nvkm_udevice_child_get,
>  };
>  
> -static const struct nvkm_object_func
> -nvkm_udevice = {
> -	.init = nvkm_udevice_init,
> -	.fini = nvkm_udevice_fini,
> -	.mthd = nvkm_udevice_mthd,
> -	.sclass = nvkm_udevice_child_get,
> -};
> -
>  static int
>  nvkm_udevice_new(const struct nvkm_oclass *oclass, void *data, u32 size,
>  		 struct nvkm_object **pobject)
>  {
> -	union {
> -		struct nv_device_v0 v0;
> -	} *args = data;
>  	struct nvkm_client *client = oclass->client;
> -	struct nvkm_object *parent = &client->object;
> -	const struct nvkm_object_func *func;
>  	struct nvkm_udevice *udev;
> -	int ret = -ENOSYS;
> -
> -	nvif_ioctl(parent, "create device size %d\n", size);
> -	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
> -		nvif_ioctl(parent, "create device v%d device %016llx\n",
> -			   args->v0.version, args->v0.device);
> -	} else
> -		return ret;
> -
> -	/* give priviledged clients register access */
> -	if (args->v0.priv)
> -		func = &nvkm_udevice_super;
> -	else
> -		func = &nvkm_udevice;
>  
>  	if (!(udev = kzalloc(sizeof(*udev), GFP_KERNEL)))
>  		return -ENOMEM;
> -	nvkm_object_ctor(func, oclass, &udev->object);
> +	nvkm_object_ctor(&nvkm_udevice, oclass, &udev->object);
>  	*pobject = &udev->object;
>  
>  	/* find the device that matches what the client requested */
> -	if (args->v0.device != ~0)
> -		udev->device = nvkm_device_find(args->v0.device);
> -	else
> -		udev->device = nvkm_device_find(client->device);
> +	udev->device = nvkm_device_find(client->device);
>  	if (!udev->device)
>  		return -ENODEV;
>  
> -- 
> 2.45.1
> 


  reply	other threads:[~2024-07-09 16:19 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04 18:36 [PATCH v2 00/37] drm/nouveau: misc. cleanups and removal of unused apis Ben Skeggs
2024-07-04 18:36 ` [PATCH v2 01/37] drm/nouveau: move nouveau_drm_device_fini() above init() Ben Skeggs
2024-07-09 14:48   ` Danilo Krummrich
2024-07-04 18:36 ` [PATCH v2 02/37] drm/nouveau: handle pci/tegra drm_dev_{alloc, register} from common code Ben Skeggs
2024-07-09 15:16   ` Danilo Krummrich
2024-07-18  7:14     ` Ben Skeggs
2024-07-19 11:10       ` Danilo Krummrich
2024-07-26  4:27         ` Ben Skeggs
2024-07-26 15:41           ` Danilo Krummrich
2024-07-26 13:07             ` Ben Skeggs
2024-07-27  1:54               ` Danilo Krummrich
2024-07-28 18:13               ` Jason Gunthorpe
2024-07-28 21:34                 ` Danilo Krummrich
2024-07-28 23:04                   ` Jason Gunthorpe
2024-07-29  0:55                     ` Danilo Krummrich
2024-07-04 18:36 ` [PATCH v2 03/37] drm/nouveau: replace drm_device* with nouveau_drm* as dev drvdata Ben Skeggs
2024-07-04 18:36 ` [PATCH v2 04/37] drm/nouveau: create pci device once Ben Skeggs
2024-07-04 18:36 ` [PATCH v2 05/37] drm/nouveau: store nvkm_device pointer in nouveau_drm Ben Skeggs
2024-07-04 18:36 ` [PATCH v2 06/37] drm/nouveau: move allocation of root client out of nouveau_cli_init() Ben Skeggs
2024-07-09 15:33   ` Danilo Krummrich
2024-07-18  7:29     ` Ben Skeggs
2024-07-19 11:37       ` Danilo Krummrich
2024-07-26  4:29         ` Ben Skeggs
2024-07-04 18:36 ` [PATCH v2 07/37] drm/nouveau: add nouveau_cli to nouveau_abi16 Ben Skeggs
2024-07-09 15:36   ` Danilo Krummrich
2024-07-04 18:36 ` [PATCH v2 08/37] drm/nouveau: handle limited nvif ioctl in abi16 Ben Skeggs
2024-07-09 16:03   ` Danilo Krummrich
2024-07-18  7:43     ` Ben Skeggs
2024-07-19 12:06       ` Danilo Krummrich
2024-07-04 18:36 ` [PATCH v2 09/37] drm/nouveau: remove abi16->device Ben Skeggs
2024-07-04 18:36 ` [PATCH v2 10/37] drm/nouveau: remove abi16->handles Ben Skeggs
2024-07-04 18:36 ` [PATCH v2 11/37] drm/nouveau/nvkm: remove detect/mmio/subdev_mask from device args Ben Skeggs
2024-07-04 18:36 ` [PATCH v2 12/37] drm/nouveau/nvkm: remove perfmon Ben Skeggs
2024-07-04 18:36 ` [PATCH v2 13/37] drm/nouveau/nvkm: remove nvkm_client_search() Ben Skeggs
2024-07-04 18:36 ` [PATCH v2 14/37] drm/nouveau/nvif: remove support for userspace backends Ben Skeggs
2024-07-04 18:36 ` [PATCH v2 15/37] drm/nouveau/nvif: remove route/token Ben Skeggs
2024-07-09 16:11   ` Danilo Krummrich
2024-07-18  7:52     ` Ben Skeggs
2024-07-19 12:12       ` Danilo Krummrich
2024-07-04 18:37 ` [PATCH v2 16/37] drm/nouveau/nvif: remove nvxx_object() Ben Skeggs
2024-07-09 16:14   ` Danilo Krummrich
2024-07-04 18:37 ` [PATCH v2 17/37] drm/nouveau/nvif: remove nvxx_client() Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 18/37] drm/nouveau/nvif: remove driver keep/fini Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 19/37] drm/nouveau/nvif: remove client device arg Ben Skeggs
2024-07-09 16:16   ` Danilo Krummrich
2024-07-04 18:37 ` [PATCH v2 20/37] drm/nouveau/nvif: remove client version Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 21/37] drm/nouveau/nvif: remove client devlist Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 22/37] drm/nouveau/nvif: remove client fini Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 23/37] drm/nouveau/nvif: remove device args Ben Skeggs
2024-07-09 16:18   ` Danilo Krummrich [this message]
2024-07-04 18:37 ` [PATCH v2 24/37] drm/nouveau: always map device Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 25/37] drm/nouveau/nvif: remove device rd/wr Ben Skeggs
2024-07-09 16:22   ` Danilo Krummrich
2024-07-04 18:37 ` [PATCH v2 26/37] drm/nouveau/nvif: remove disp chan rd/wr Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 27/37] drm/nouveau: move nvxx_* definitions to nouveau_drv.h Ben Skeggs
2024-07-09 16:31   ` Danilo Krummrich
2024-07-18  7:58     ` Ben Skeggs
2024-07-19 12:28       ` Danilo Krummrich
2024-07-26  4:35         ` Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 28/37] drm/nouveau: add nvif_mmu to nouveau_drm Ben Skeggs
2024-07-09 16:34   ` Danilo Krummrich
2024-07-18  8:10     ` Ben Skeggs
2024-07-19 12:47       ` Danilo Krummrich
2024-07-04 18:37 ` [PATCH v2 29/37] drm/nouveau: pass drm to nouveau_mem_new(), instead of cli Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 30/37] drm/nouveau: pass drm to nv50_dmac_create(), rather than device+disp Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 31/37] drm/nouveau: pass cli to nouveau_channel_new() instead of drm+device Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 32/37] drm/nouveau: remove nouveau_chan.device Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 33/37] drm/nouveau: remove chan->drm Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 34/37] drm/nouveau: remove master Ben Skeggs
2024-07-09 16:38   ` Danilo Krummrich
2024-07-18  8:12     ` Ben Skeggs
2024-07-19 12:49       ` Danilo Krummrich
2024-07-04 18:37 ` [PATCH v2 35/37] drm/nouveau: remove push pointer from nouveau_channel Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 36/37] drm/nouveau/kms: remove a few unused struct members and fn decls Ben Skeggs
2024-07-04 18:37 ` [PATCH v2 37/37] drm/nouveau/kms: remove push pointer from nv50_dmac Ben Skeggs
2024-07-09 14:44 ` [PATCH v2 00/37] drm/nouveau: misc. cleanups and removal of unused apis Danilo Krummrich
2024-07-18  7:00   ` Ben Skeggs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zo1i8tw00OaFlfg4@pollux \
    --to=dakr@redhat.com \
    --cc=bskeggs@nvidia.com \
    --cc=nouveau@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.