All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: 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: [PATCH v2 09/16] cxl: Add support for FWCTL get driver information callback
Date: Fri, 31 Jan 2025 17:42:02 -0700	[thread overview]
Message-ID: <20250201004459.466499-10-dave.jiang@intel.com> (raw)
In-Reply-To: <20250201004459.466499-1-dave.jiang@intel.com>

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 d8fd68ac8982..b7984c98645c 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);
+
+	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
+ */
+struct fwctl_info_cxl {
+	__u32 reserved;
+};
+#endif
-- 
2.48.1


  parent reply	other threads:[~2025-02-01  0:45 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-01  0:41 [PATCH v2 0/16] cxl: Add CXL feature commands support via fwctl Dave Jiang
2025-02-01  0:41 ` [PATCH v2 01/16] cxl: Refactor user ioctl command path from mds to mailbox Dave Jiang
2025-02-01  0:41 ` [PATCH v2 02/16] cxl: Enumerate feature commands Dave Jiang
2025-02-03 12:06   ` Jonathan Cameron
2025-02-03 23:23     ` Dave Jiang
2025-02-01  0:41 ` [PATCH v2 03/16] cxl: Add Get Supported Features command for kernel usage Dave Jiang
2025-02-03 12:19   ` Jonathan Cameron
2025-02-01  0:41 ` [PATCH v2 04/16] cxl/test: Add Get Supported Features mailbox command support Dave Jiang
2025-02-03 12:22   ` Jonathan Cameron
2025-02-01  0:41 ` [PATCH v2 05/16] cxl/mbox: Add GET_FEATURE mailbox command Dave Jiang
2025-02-01  0:41 ` [PATCH v2 06/16] cxl/mbox: Add SET_FEATURE " Dave Jiang
2025-02-03 12:27   ` Jonathan Cameron
2025-02-01  0:42 ` [PATCH v2 07/16] cxl: Setup exclusive CXL features that are reserved for the kernel Dave Jiang
2025-02-01  0:42 ` [PATCH v2 08/16] cxl: Add FWCTL support to the CXL memdev driver Dave Jiang
2025-02-01  1:04   ` Dave Jiang
2025-02-03 12:42   ` Jonathan Cameron
2025-02-03 14:25     ` Jason Gunthorpe
2025-02-03 16:22       ` Dave Jiang
2025-02-03 16:30         ` Jason Gunthorpe
2025-02-01  0:42 ` Dave Jiang [this message]
2025-02-03 12:43   ` [PATCH v2 09/16] cxl: Add support for FWCTL get driver information callback Jonathan Cameron
2025-02-01  0:42 ` [PATCH v2 10/16] cxl: Move cxl feature command structs to user header Dave Jiang
2025-02-01  0:42 ` [PATCH v2 11/16] cxl: Add support for fwctl RPC command to enable CXL feature commands Dave Jiang
2025-02-03 13:03   ` Jonathan Cameron
2025-02-01  0:42 ` [PATCH v2 12/16] cxl: Add support to handle user feature commands for get feature Dave Jiang
2025-02-01  0:42 ` [PATCH v2 13/16] cxl: Add support to handle user feature commands for set feature Dave Jiang
2025-02-01  0:42 ` [PATCH v2 14/16] cxl/test: Add Get Feature support to cxl_test Dave Jiang
2025-02-01  0:42 ` [PATCH v2 15/16] cxl/test: Add Set " Dave Jiang
2025-02-01  0:42 ` [PATCH v2 16/16] fwctl/cxl: Add documentation to FWCTL CXL Dave Jiang
2025-02-03 13:08   ` Jonathan Cameron

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=20250201004459.466499-10-dave.jiang@intel.com \
    --to=dave.jiang@intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@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 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.