diff mbox series

[RFC,v2,12/20] cxl: Save Command Effects Log (CEL) effects for enabled commands

Message ID 20241115212745.869552-13-dave.jiang@intel.com
State New
Headers show
Series fwctl/cxl: Add CXL feature commands support via fwctl | expand

Commit Message

Dave Jiang Nov. 15, 2024, 9:25 p.m. UTC
Store the command effects via what device provided via the CEL in the
'struct cxl_command_info' structure. Steal the upper 16 bits to store
the effects value in order to keep user API compatibility.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/cxl/core/mbox.c      | 2 ++
 include/uapi/fwctl/fwctl.h   | 4 ++--
 include/uapi/linux/cxl_mem.h | 5 +++--
 3 files changed, 7 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index f464eb42f08a..fba6bdd30a82 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -795,6 +795,8 @@  static void cxl_walk_cel(struct cxl_memdev_state *mds, size_t size, u8 *cel)
 			enabled++;
 		}
 
+		cmd->info.effects = le16_to_cpu(cel_entry[i].effect);
+
 		dev_dbg(dev, "Opcode 0x%04x %s\n", opcode,
 			enabled ? "enabled" : "unsupported by driver");
 	}
diff --git a/include/uapi/fwctl/fwctl.h b/include/uapi/fwctl/fwctl.h
index 7334907e27c1..04da549cd4ae 100644
--- a/include/uapi/fwctl/fwctl.h
+++ b/include/uapi/fwctl/fwctl.h
@@ -74,8 +74,8 @@  struct fwctl_info {
  * struct fwctl_command_info - Hardware command information returned from a query.
  * @id: Driver ID number for the command
  * @opcode: Hardware command opcode
- * @set_effects: Effects to the OS and hardware when command is executed.
- *               Provided by the device.
+ * @effects: Effects to the OS and hardware when command is executed.
+ *           Provided by the device.
  * @size_in: Expected input size, or ~0U if variable length.
  * @size_out: Expected output size, or ~0U if variable length.
  *
diff --git a/include/uapi/linux/cxl_mem.h b/include/uapi/linux/cxl_mem.h
index 469dd481795f..9dd37849c450 100644
--- a/include/uapi/linux/cxl_mem.h
+++ b/include/uapi/linux/cxl_mem.h
@@ -118,6 +118,7 @@  static const __u8 cxl_deprecated_commands[]
  *         the label-storage-area can not be written while the kernel is
  *         actively managing that space.
  *
+ * @effects: Command effects reported by the device.
  * @size_in: Expected input size, or ~0 if variable length.
  * @size_out: Expected output size, or ~0 if variable length.
  *
@@ -136,11 +137,11 @@  static const __u8 cxl_deprecated_commands[]
 struct cxl_command_info {
 	__u32 id;
 
-	__u32 flags;
+	__u16 flags;
 #define CXL_MEM_COMMAND_FLAG_MASK		GENMASK(1, 0)
 #define CXL_MEM_COMMAND_FLAG_ENABLED		BIT(0)
 #define CXL_MEM_COMMAND_FLAG_EXCLUSIVE		BIT(1)
-
+	__u16 effects;
 	__u32 size_in;
 	__u32 size_out;
 };