History

Merge branch 'for-6.3/cxl' into cxl/next

Pick up some final miscellaneous updates for v6.3 including support for communicating 'exclusive' and 'enabled' state of commands.

Dan Williams committed 3 years ago

Commit dfd423e2 parents dbe9f7d af733704 files · +33 −9Browse files

Unified · Split

4 files
  1. drivers/cxl/core/mbox.c +7 −2
  2. drivers/cxl/core/memdev.c +1 −1
  3. drivers/cxl/cxlmem.h +0 −1
  4. include/uapi/linux/cxl_mem.h +25 −5
drivers/cxl/core/mbox.c+7−2
@@ -453,9 +453,14 @@ int cxl_query_cmd(struct cxl_memdev *cxlmd, · 452 unmodified lines
453453 * structures.
454454 */
455455 cxl_for_each_cmd(cmd) {
456− const struct cxl_command_info *info = &cmd->info;
456+ struct cxl_command_info info = cmd->info;
457457
458− if (copy_to_user(&q->commands[j++], info, sizeof(*info)))
458+ if (test_bit(info.id, cxlmd->cxlds->enabled_cmds))
459+ info.flags |= CXL_MEM_COMMAND_FLAG_ENABLED;
460+ if (test_bit(info.id, cxlmd->cxlds->exclusive_cmds))
461+ info.flags |= CXL_MEM_COMMAND_FLAG_EXCLUSIVE;
462+
463+ if (copy_to_user(&q->commands[j++], &info, sizeof(info)))
459464 return -EFAULT;
460465
461466 if (j == n_commands)
drivers/cxl/core/memdev.c+1−1
@@ -242,7 +242,7 @@ static struct cxl_memdev *cxl_memdev_alloc(struct cxl_dev_state *cxlds, · 241 unmodified lines
242242 if (!cxlmd)
243243 return ERR_PTR(-ENOMEM);
244244
245− rc = ida_alloc_range(&cxl_memdev_ida, 0, CXL_MEM_MAX_DEVS, GFP_KERNEL);
245+ rc = ida_alloc_max(&cxl_memdev_ida, CXL_MEM_MAX_DEVS - 1, GFP_KERNEL);
246246 if (rc < 0)
247247 goto err;
248248 cxlmd->id = rc;
drivers/cxl/cxlmem.h+0−1
@@ -565,7 +565,6 @@ struct cxl_mem_command { · 564 unmodified lines
565565 struct cxl_command_info info;
566566 enum cxl_opcode opcode;
567567 u32 flags;
568−#define CXL_CMD_FLAG_NONE 0
569568 #define CXL_CMD_FLAG_FORCE_ENABLE BIT(0)
570569 };
571570
include/uapi/linux/cxl_mem.h+25−5
@@ -11,14 +11,19 @@ · 10 unmodified lines
1111 /**
1212 * DOC: UAPI
1313 *
14− * Not all of all commands that the driver supports are always available for use
15− * by userspace. Userspace must check the results from the QUERY command in
16− * order to determine the live set of commands.
14+ * Not all of the commands that the driver supports are available for use by
15+ * userspace at all times. Userspace can check the result of the QUERY command
16+ * to determine the live set of commands. Alternatively, it can issue the
17+ * command and check for failure.
1718 */
1819
1920 #define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
2021 #define CXL_MEM_SEND_COMMAND _IOWR(0xCE, 2, struct cxl_send_command)
2122
23+/*
24+ * NOTE: New defines must be added to the end of the list to preserve
25+ * compatibility because this enum is exported to user space.
26+ */
2227 #define CXL_CMDS \
2328 ___C(INVALID, "Invalid Command"), \
2429 ___C(IDENTIFY, "Identify Command"), \
@@ -68,6 +73,19 @@ static const struct { · 43 unmodified lines
6873 * struct cxl_command_info - Command information returned from a query.
6974 * @id: ID number for the command.
7075 * @flags: Flags that specify command behavior.
76+ *
77+ * CXL_MEM_COMMAND_FLAG_USER_ENABLED
78+ *
79+ * The given command id is supported by the driver and is supported by
80+ * a related opcode on the device.
81+ *
82+ * CXL_MEM_COMMAND_FLAG_EXCLUSIVE
83+ *
84+ * Requests with the given command id will terminate with EBUSY as the
85+ * kernel actively owns management of the given resource. For example,
86+ * the label-storage-area can not be written while the kernel is
87+ * actively managing that space.
88+ *
7189 * @size_in: Expected input size, or ~0 if variable length.
7290 * @size_out: Expected output size, or ~0 if variable length.
7391 *
@@ -77,7 +95,7 @@ static const struct { · 3 unmodified lines
7795 * bytes of output.
7896 *
7997 * - @id = 10
80− * - @flags = 0
98+ * - @flags = CXL_MEM_COMMAND_FLAG_ENABLED
8199 * - @size_in = ~0
82100 * - @size_out = 0
83101 *
@@ -87,7 +105,9 @@ struct cxl_command_info { · 3 unmodified lines
87105 __u32 id;
88106
89107 __u32 flags;
90−#define CXL_MEM_COMMAND_FLAG_MASK GENMASK(0, 0)
108+#define CXL_MEM_COMMAND_FLAG_MASK GENMASK(1, 0)
109+#define CXL_MEM_COMMAND_FLAG_ENABLED BIT(0)
110+#define CXL_MEM_COMMAND_FLAG_EXCLUSIVE BIT(1)
91111
92112 __u32 size_in;
93113 __u32 size_out;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t