linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Andy Gospodarek <andrew.gospodarek@broadcom.com>,
	Aron Silverton <aron.silverton@oracle.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Dave Jiang <dave.jiang@intel.com>,
	David Ahern <dsahern@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	Christoph Hellwig <hch@infradead.org>,
	Itay Avraham <itayavr@nvidia.com>, Jiri Pirko <jiri@nvidia.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Leonid Bloch <lbloch@nvidia.com>,
	Leon Romanovsky <leonro@nvidia.com>, <linux-cxl@vger.kernel.org>,
	<linux-rdma@vger.kernel.org>, Saeed Mahameed <saeedm@nvidia.com>
Subject: Re: [PATCH v3 03/10] fwctl: FWCTL_INFO to return basic information about the device
Date: Fri, 23 Aug 2024 15:14:11 +0100	[thread overview]
Message-ID: <20240823151411.00004b30@Huawei.com> (raw)
In-Reply-To: <3-v3-960f17f90f17+516-fwctl_jgg@nvidia.com>

On Wed, 21 Aug 2024 15:10:55 -0300
Jason Gunthorpe <jgg@nvidia.com> wrote:

> Userspace will need to know some details about the fwctl interface being
> used to locate the correct userspace code to communicate with the
> kernel. Provide a simple device_type enum indicating what the kernel
> driver is.
> 
> Allow the device to provide a device specific info struct that contains
> any additional information that the driver may need to provide to
> userspace.
> 
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

Just one minor question: How likely is the data being passed back
from the driver to be const?  Feels like it might be and should
be easy enough to support either const or not.

Either way, LGTM
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> diff --git a/include/linux/fwctl.h b/include/linux/fwctl.h
> index ca4245825e91bf..6b596931a55169 100644
> --- a/include/linux/fwctl.h
> +++ b/include/linux/fwctl.h
> @@ -7,6 +7,7 @@
>  #include <linux/device.h>
>  #include <linux/cdev.h>
>  #include <linux/cleanup.h>
> +#include <uapi/fwctl/fwctl.h>
>  
>  struct fwctl_device;
>  struct fwctl_uctx;
> @@ -19,6 +20,10 @@ struct fwctl_uctx;
>   * it will block device hot unplug and module unloading.
>   */
>  struct fwctl_ops {
> +	/**
> +	 * @device_type: The drivers assigned device_type number. This is uABI.
> +	 */
> +	enum fwctl_device_type device_type;
>  	/**
>  	 * @uctx_size: The size of the fwctl_uctx struct to allocate. The first
>  	 * bytes of this memory will be a fwctl_uctx. The driver can use the
> @@ -35,6 +40,13 @@ struct fwctl_ops {
>  	 * is closed.
>  	 */
>  	void (*close_uctx)(struct fwctl_uctx *uctx);
> +	/**
> +	 * @info: Implement FWCTL_INFO. Return a kmalloc() memory that is copied
> +	 * to out_device_data. On input length indicates the size of the user
> +	 * buffer on output it indicates the size of the memory. The driver can
> +	 * ignore length on input, the core code will handle everything.
> +	 */

Maybe it's worth supporting const data as well?

> +	void *(*info)(struct fwctl_uctx *uctx, size_t *length);
>  };
>  
>  /**



  reply	other threads:[~2024-08-23 14:14 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21 18:10 [PATCH v3 00/10] Introduce fwctl subystem Jason Gunthorpe
2024-08-21 18:10 ` [PATCH v3 01/10] fwctl: Add basic structure for a class subsystem with a cdev Jason Gunthorpe
2024-08-23 13:48   ` Jonathan Cameron
2024-08-21 18:10 ` [PATCH v3 02/10] fwctl: Basic ioctl dispatch for the character device Jason Gunthorpe
2024-08-23 14:02   ` Jonathan Cameron
2024-08-27 14:56     ` Jason Gunthorpe
2024-08-21 18:10 ` [PATCH v3 03/10] fwctl: FWCTL_INFO to return basic information about the device Jason Gunthorpe
2024-08-23 14:14   ` Jonathan Cameron [this message]
2024-08-27 14:47     ` Jason Gunthorpe
2024-08-27 14:55       ` Andy Gospodarek
2024-08-21 18:10 ` [PATCH v3 04/10] taint: Add TAINT_FWCTL Jason Gunthorpe
2024-08-21 23:35   ` Greg Kroah-Hartman
2024-08-22 15:34     ` Jason Gunthorpe
2024-08-21 18:10 ` [PATCH v3 05/10] fwctl: FWCTL_RPC to execute a Remote Procedure Call to device firmware Jason Gunthorpe
2024-08-21 23:49   ` Jakub Kicinski
2024-08-22  0:14     ` Jason Gunthorpe
2024-08-22  0:30       ` Jakub Kicinski
2024-08-27 15:27         ` Jason Gunthorpe
2024-08-23 14:23   ` Jonathan Cameron
2024-08-21 18:10 ` [PATCH v3 06/10] fwctl: Add documentation Jason Gunthorpe
2024-08-23 14:35   ` Jonathan Cameron
2024-08-27 14:58     ` Jason Gunthorpe
2024-08-21 18:10 ` [PATCH v3 07/10] fwctl/mlx5: Support for communicating with mlx5 fw Jason Gunthorpe
2024-08-23 14:48   ` Jonathan Cameron
2024-08-27 15:07     ` Jason Gunthorpe
2024-08-21 18:11 ` [PATCH v3 08/10] mlx5: Create an auxiliary device for fwctl_mlx5 Jason Gunthorpe
2024-08-21 18:11 ` [PATCH v3 09/10] fwctl/cxl: Add driver for CXL mailbox for handling CXL features commands (RFC) Jason Gunthorpe
2024-08-21 18:11 ` [PATCH v3 10/10] cxl: Create an auxiliary device for fwctl_cxl Jason Gunthorpe
2024-09-13 22:39 ` [PATCH v3 00/10] Introduce fwctl subystem Dave Jiang
2024-09-16  7:54   ` Leon Romanovsky
2024-09-17 20:59   ` Dave Jiang
2024-12-05 22:28 ` Shannon Nelson
2024-12-05 23:58   ` Jason Gunthorpe

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=20240823151411.00004b30@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=aron.silverton@oracle.com \
    --cc=dan.j.williams@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dave.jiang@intel.com \
    --cc=dsahern@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=itayavr@nvidia.com \
    --cc=jgg@nvidia.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=lbloch@nvidia.com \
    --cc=leonro@nvidia.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).