From: Dan Williams <dan.j.williams@intel.com>
To: Dave Jiang <dave.jiang@intel.com>, <linux-cxl@vger.kernel.org>
Cc: <dan.j.williams@intel.com>, <ira.weiny@intel.com>,
<vishal.l.verma@intel.com>, <alison.schofield@intel.com>,
<Jonathan.Cameron@huawei.com>, <dave@stgolabs.net>,
<jgg@nvidia.com>, <shiju.jose@huawei.com>
Subject: Re: [PATCH v3 09/16] cxl: Add support for FWCTL get driver information callback
Date: Tue, 4 Feb 2025 17:27:06 -0800 [thread overview]
Message-ID: <67a2be69ebda1_2d2c294cc@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <20250204220430.4146187-10-dave.jiang@intel.com>
Dave Jiang wrote:
> Add definition for fwctl_ops->info() to return driver information. The
> function will return a data structure with a reserved u32. This is setup
> for future usages.
>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
> v2:
> - Set command_info to reserved. (Dan)
> ---
> drivers/cxl/fwctl.c | 18 ++++++++++++++++--
> include/cxl/mailbox.h | 1 +
> include/uapi/fwctl/cxl.h | 19 +++++++++++++++++++
> 3 files changed, 36 insertions(+), 2 deletions(-)
> create mode 100644 include/uapi/fwctl/cxl.h
>
> diff --git a/drivers/cxl/fwctl.c b/drivers/cxl/fwctl.c
> index 985315d5d503..85dee01d89d1 100644
> --- a/drivers/cxl/fwctl.c
> +++ b/drivers/cxl/fwctl.c
> @@ -6,6 +6,8 @@
> #include "cxlmem.h"
> #include "features.h"
>
> +#define to_cxl_features_state(fwctl) container_of(fwctl, struct cxl_features_state, fwctl)
> +
> static int cxlctl_open_uctx(struct fwctl_uctx *uctx)
> {
> return 0;
> @@ -17,8 +19,20 @@ static void cxlctl_close_uctx(struct fwctl_uctx *uctx)
>
> static void *cxlctl_info(struct fwctl_uctx *uctx, size_t *length)
> {
> - /* Place holder */
> - return ERR_PTR(-EOPNOTSUPP);
> + struct fwctl_device *fwctl = uctx->fwctl;
> + struct cxl_features_state *cxlfs = to_cxl_features_state(fwctl);
> + struct fwctl_info_cxl *info;
> +
> + if (!cxlfs->num_user_features)
> + return ERR_PTR(-EOPNOTSUPP);
You could save an error case by not registering the fwctl interface at
all when ->num_features == 0.
> +
> + info = kzalloc(sizeof(*info), GFP_KERNEL);
> + if (!info)
> + return ERR_PTR(-ENOMEM);
> +
> + *length = sizeof(*info);
> +
> + return info;
> }
>
> static void *cxlctl_fw_rpc(struct fwctl_uctx *uctx, enum fwctl_rpc_scope scope,
> diff --git a/include/cxl/mailbox.h b/include/cxl/mailbox.h
> index 99d3bbe1ba2a..bbbbff3af61f 100644
> --- a/include/cxl/mailbox.h
> +++ b/include/cxl/mailbox.h
> @@ -4,6 +4,7 @@
> #define __CXL_MBOX_H__
> #include <linux/rcuwait.h>
> #include <cxl/features.h>
> +#include <uapi/fwctl/cxl.h>
> #include <uapi/linux/cxl_mem.h>
>
> /**
> diff --git a/include/uapi/fwctl/cxl.h b/include/uapi/fwctl/cxl.h
> new file mode 100644
> index 000000000000..4e766ffb1388
> --- /dev/null
> +++ b/include/uapi/fwctl/cxl.h
> @@ -0,0 +1,19 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +/*
> + * Copyright (c) 2024, Intel Corporation
> + *
> + * These are definitions for the mailbox command interface of CXL subsystem.
> + */
> +#ifndef _UAPI_FWCTL_CXL_H_
> +#define _UAPI_FWCTL_CXL_H_
> +
> +#include <linux/types.h>
> +
> +/**
> + * struct fwctl_info_cxl - ioctl(FWCTL_INFO) out_device_data
> + * @reserved: Place older for future usages
ignoring the s/older/holder/, I would just document this as:
@reserved: zero
...and not tease a future.
next prev parent reply other threads:[~2025-02-05 1:27 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-04 22:03 [PATCH v3 00/16] cxl: Add CXL feature commands support via fwctl Dave Jiang
2025-02-04 22:03 ` [PATCH v3 01/16] cxl: Refactor user ioctl command path from mds to mailbox Dave Jiang
2025-02-05 17:41 ` Jonathan Cameron
2025-02-05 17:52 ` Dave Jiang
2025-02-07 5:47 ` Li Ming
2025-02-04 22:03 ` [PATCH v3 02/16] cxl: Enumerate feature commands Dave Jiang
2025-02-04 23:34 ` Dan Williams
2025-02-04 22:03 ` [PATCH v3 03/16] cxl: Add Get Supported Features command for kernel usage Dave Jiang
2025-02-04 23:50 ` Dan Williams
2025-02-07 5:42 ` Li Ming
2025-02-08 0:03 ` Dave Jiang
2025-02-04 22:03 ` [PATCH v3 04/16] cxl/test: Add Get Supported Features mailbox command support Dave Jiang
2025-02-07 5:51 ` Li Ming
2025-02-04 22:03 ` [PATCH v3 05/16] cxl/mbox: Add GET_FEATURE mailbox command Dave Jiang
2025-02-05 0:54 ` Dan Williams
2025-02-05 17:57 ` Jonathan Cameron
2025-02-05 23:12 ` Dan Williams
2025-02-06 11:03 ` Jonathan Cameron
2025-02-07 20:18 ` Dan Williams
2025-02-07 6:18 ` Li Ming
2025-02-04 22:03 ` [PATCH v3 06/16] cxl/mbox: Add SET_FEATURE " Dave Jiang
2025-02-04 22:03 ` [PATCH v3 07/16] cxl: Setup exclusive CXL features that are reserved for the kernel Dave Jiang
2025-02-04 22:03 ` [PATCH v3 08/16] cxl: Add FWCTL support to the CXL memdev driver Dave Jiang
2025-02-05 1:18 ` Dan Williams
2025-02-04 22:03 ` [PATCH v3 09/16] cxl: Add support for FWCTL get driver information callback Dave Jiang
2025-02-05 1:27 ` Dan Williams [this message]
2025-02-04 22:03 ` [PATCH v3 10/16] cxl: Move cxl feature command structs to user header Dave Jiang
2025-02-04 22:03 ` [PATCH v3 11/16] cxl: Add support for fwctl RPC command to enable CXL feature commands Dave Jiang
2025-02-05 1:41 ` Dan Williams
2025-02-04 22:03 ` [PATCH v3 12/16] cxl: Add support to handle user feature commands for get feature Dave Jiang
2025-02-04 22:03 ` [PATCH v3 13/16] cxl: Add support to handle user feature commands for set feature Dave Jiang
2025-02-04 22:03 ` [PATCH v3 14/16] cxl/test: Add Get Feature support to cxl_test Dave Jiang
2025-02-04 22:03 ` [PATCH v3 15/16] cxl/test: Add Set " Dave Jiang
2025-02-04 22:03 ` [PATCH v3 16/16] fwctl/cxl: Add documentation to FWCTL CXL Dave Jiang
2025-02-05 1:50 ` Dan Williams
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=67a2be69ebda1_2d2c294cc@dwillia2-xfh.jf.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=jgg@nvidia.com \
--cc=linux-cxl@vger.kernel.org \
--cc=shiju.jose@huawei.com \
--cc=vishal.l.verma@intel.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