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
453 * structures.453 * structures.
454 */454 */
455 cxl_for_each_cmd(cmd) {455 cxl_for_each_cmd(cmd) {
456 const struct cxl_command_info *info = &cmd->info;456 struct cxl_command_info info = cmd->info;
457 457
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)))
459 return -EFAULT;464 return -EFAULT;
460 465
461 if (j == n_commands)466 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
242 if (!cxlmd)242 if (!cxlmd)
243 return ERR_PTR(-ENOMEM);243 return ERR_PTR(-ENOMEM);
244 244
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);
246 if (rc < 0)246 if (rc < 0)
247 goto err;247 goto err;
248 cxlmd->id = rc;248 cxlmd->id = rc;
drivers/cxl/cxlmem.h+0−1
@@ -565,7 +565,6 @@ struct cxl_mem_command { · 564 unmodified lines
565 struct cxl_command_info info;565 struct cxl_command_info info;
566 enum cxl_opcode opcode;566 enum cxl_opcode opcode;
567 u32 flags;567 u32 flags;
568#define CXL_CMD_FLAG_NONE 0
569#define CXL_CMD_FLAG_FORCE_ENABLE BIT(0)568#define CXL_CMD_FLAG_FORCE_ENABLE BIT(0)
570};569};
571 570
include/uapi/linux/cxl_mem.h+25−5
@@ -11,14 +11,19 @@ · 10 unmodified lines
11/**11/**
12 * DOC: UAPI12 * DOC: UAPI
13 *13 *
14 * Not all of all commands that the driver supports are always available for use14 * Not all of the commands that the driver supports are available for use by
15 * by userspace. Userspace must check the results from the QUERY command in15 * userspace at all times. Userspace can check the result of the QUERY command
16 * order to determine the live set of commands.16 * to determine the live set of commands. Alternatively, it can issue the
17 * command and check for failure.
17 */18 */
18 19
19#define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)20#define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
20#define CXL_MEM_SEND_COMMAND _IOWR(0xCE, 2, struct cxl_send_command)21#define CXL_MEM_SEND_COMMAND _IOWR(0xCE, 2, struct cxl_send_command)
21 22
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 */
22#define CXL_CMDS \27#define CXL_CMDS \
23 ___C(INVALID, "Invalid Command"), \28 ___C(INVALID, "Invalid Command"), \
24 ___C(IDENTIFY, "Identify Command"), \29 ___C(IDENTIFY, "Identify Command"), \
@@ -68,6 +73,19 @@ static const struct { · 43 unmodified lines
68 * struct cxl_command_info - Command information returned from a query.73 * struct cxl_command_info - Command information returned from a query.
69 * @id: ID number for the command.74 * @id: ID number for the command.
70 * @flags: Flags that specify command behavior.75 * @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 *
71 * @size_in: Expected input size, or ~0 if variable length.89 * @size_in: Expected input size, or ~0 if variable length.
72 * @size_out: Expected output size, or ~0 if variable length.90 * @size_out: Expected output size, or ~0 if variable length.
73 *91 *
@@ -77,7 +95,7 @@ static const struct { · 3 unmodified lines
77 * bytes of output.95 * bytes of output.
78 *96 *
79 * - @id = 1097 * - @id = 10
80 * - @flags = 098 * - @flags = CXL_MEM_COMMAND_FLAG_ENABLED
81 * - @size_in = ~099 * - @size_in = ~0
82 * - @size_out = 0100 * - @size_out = 0
83 *101 *
@@ -87,7 +105,9 @@ struct cxl_command_info { · 3 unmodified lines
87 __u32 id;105 __u32 id;
88 106
89 __u32 flags;107 __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)
91 111
92 __u32 size_in;112 __u32 size_in;
93 __u32 size_out;113 __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