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: [RFC PATCH 09/13] fwctl/cxl: Add support for get driver information
Date: Thu, 18 Jul 2024 14:32:27 -0700 [thread overview]
Message-ID: <20240718213446.1750135-10-dave.jiang@intel.com> (raw)
In-Reply-To: <20240718213446.1750135-1-dave.jiang@intel.com>
Add definition for fwctl_ops->info() to return driver information. The
function will return the commands supported by the fwctl char device as
a bitmap of enable commands.
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
drivers/fwctl/cxl/cxl.c | 20 ++++++++++++++++++--
include/uapi/fwctl/cxl.h | 25 +++++++++++++++++++++++++
2 files changed, 43 insertions(+), 2 deletions(-)
create mode 100644 include/uapi/fwctl/cxl.h
diff --git a/drivers/fwctl/cxl/cxl.c b/drivers/fwctl/cxl/cxl.c
index 518ba2afada8..22f62034c021 100644
--- a/drivers/fwctl/cxl/cxl.c
+++ b/drivers/fwctl/cxl/cxl.c
@@ -6,6 +6,7 @@
#include <linux/auxiliary_bus.h>
#include <linux/cxl/mailbox.h>
#include <linux/auxiliary_bus.h>
+#include <uapi/fwctl/cxl.h>
struct cxlctl_uctx {
struct fwctl_uctx uctx;
@@ -22,6 +23,12 @@ DEFINE_FREE(cxlctl, struct cxlctl_dev *, if (_T) fwctl_put(&_T->fwctl))
static int cxlctl_open_uctx(struct fwctl_uctx *uctx)
{
+ struct cxlctl_uctx *cxlctl_uctx =
+ container_of(uctx, struct cxlctl_uctx, uctx);
+
+ cxlctl_uctx->uctx_caps = BIT(FWCTL_CXL_QUERY_COMMANDS) |
+ BIT(FWCTL_CXL_SEND_COMMAND);
+
return 0;
}
@@ -31,8 +38,17 @@ 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 cxlctl_uctx *cxlctl_uctx =
+ container_of(uctx, struct cxlctl_uctx, uctx);
+ struct fwctl_info_cxl *info;
+
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
+ if (!info)
+ return ERR_PTR(-ENOMEM);
+
+ info->uctx_caps = cxlctl_uctx->uctx_caps;
+
+ return info;
}
static void *cxlctl_fw_rpc(struct fwctl_uctx *uctx, enum fwctl_rpc_scope scope,
diff --git a/include/uapi/fwctl/cxl.h b/include/uapi/fwctl/cxl.h
new file mode 100644
index 000000000000..d3a735f1fe4e
--- /dev/null
+++ b/include/uapi/fwctl/cxl.h
@@ -0,0 +1,25 @@
+/* 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_
+
+enum fwctl_cxl_commands {
+ FWCTL_CXL_QUERY_COMMANDS = 0,
+ FWCTL_CXL_SEND_COMMAND,
+};
+
+/**
+ * struct fwctl_info_cxl - ioctl(FWCTL_INFO) out_device_data
+ * @uctx_caps: The command capabilities driver accepts.
+ *
+ * Return basic information about the FW interface available.
+ */
+struct fwctl_info_cxl {
+ __u32 uctx_caps;
+};
+
+#endif
--
2.45.2
next prev parent reply other threads:[~2024-07-18 21:35 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 21:32 [RFC PATCH 0/13] fwctl/cxl: Add CXL feature commands support via fwctl Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 01/13] cxl: Move mailbox related bits to the same context Dave Jiang
2024-07-19 6:31 ` Alejandro Lucero Palau
2024-07-19 15:47 ` Dave Jiang
2024-07-19 16:07 ` Alejandro Lucero Palau
2024-07-26 17:28 ` Jonathan Cameron
2024-07-18 21:32 ` [RFC PATCH 02/13] cxl: Fix comment regarding cxl_query_cmd() return data Dave Jiang
2024-07-26 17:29 ` Jonathan Cameron
2024-09-24 23:41 ` Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 03/13] cxl: Refactor user ioctl command path from mds to mailbox Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 04/13] cxl: Add Get Supported Features command for kernel usage Dave Jiang
2024-07-26 17:50 ` Jonathan Cameron
2024-09-27 16:22 ` Dave Jiang
2024-08-21 16:05 ` Shiju Jose
2024-08-21 18:10 ` Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 05/13] cxl/test: Add Get Supported Features mailbox command support Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 06/13] cxl: Add Get Feature " Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 07/13] cxl: Add Set " Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 08/13] fwctl/cxl: Add driver for CXL mailbox for handling CXL features commands Dave Jiang
2024-07-22 15:31 ` Jason Gunthorpe
2024-07-22 21:42 ` Dave Jiang
2024-07-26 18:02 ` Jonathan Cameron
2024-09-24 23:44 ` Dave Jiang
2024-09-26 17:37 ` Jason Gunthorpe
2024-09-26 20:26 ` Dave Jiang
2024-07-18 21:32 ` Dave Jiang [this message]
2024-07-18 21:32 ` [RFC PATCH 10/13] fwctl/cxl: Add support for fwctl RPC command to enable CXL feature commands Dave Jiang
2024-07-22 15:29 ` Jason Gunthorpe
2024-07-22 22:52 ` Dave Jiang
2024-07-29 11:29 ` Jonathan Cameron
2024-11-13 15:41 ` Dave Jiang
2024-11-19 11:41 ` Jonathan Cameron
2024-07-18 21:32 ` [RFC PATCH 11/13] fwctl/cxl: Add query commands software command for ->fw_rpc() Dave Jiang
2024-07-22 15:24 ` Jason Gunthorpe
2024-07-22 23:23 ` Dave Jiang
2024-08-08 12:56 ` Jason Gunthorpe
2024-07-29 11:48 ` Jonathan Cameron
2024-07-18 21:32 ` [RFC PATCH 12/13] cxl/test: Add Get Feature support to cxl_test Dave Jiang
2024-07-18 21:32 ` [RFC PATCH 13/13] cxl/test: Add Set " Dave Jiang
2024-07-19 6:23 ` [RFC PATCH 0/13] fwctl/cxl: Add CXL feature commands support via fwctl Alejandro Lucero Palau
2024-07-19 15:48 ` Dave Jiang
2024-07-22 15:32 ` Jason Gunthorpe
2024-07-29 12:05 ` Jonathan Cameron
2024-08-06 16:44 ` Dave Jiang
2024-11-13 0:17 ` Dave Jiang
2024-11-19 11:43 ` Jonathan Cameron
2024-11-19 15:58 ` Dave Jiang
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=20240718213446.1750135-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox