@@ -15,9 +15,9 @@ extern struct device_attribute dev_attr_delete_region;
struct cxl_send_command;
struct cxl_mem_query_commands;
-int cxl_query_cmd(struct cxl_memdev *cxlmd,
- struct cxl_mem_query_commands __user *q);
-int cxl_send_cmd(struct cxl_memdev *cxlmd, struct cxl_send_command __user *s);
+int cxl_ioctl_query(struct cxl_memdev *cxlmd,
+ struct cxl_mem_query_commands __user *q);
+int cxl_ioctl_send(struct cxl_memdev *cxlmd, struct cxl_send_command __user *s);
void __iomem *devm_cxl_iomap_block(struct device *dev, resource_size_t addr,
resource_size_t length);
@@ -139,7 +139,7 @@ static const char *cxl_mem_opcode_to_name(u16 opcode)
}
/**
- * cxl_mbox_send_cmd() - Send a mailbox command to a device.
+ * cxl_internal_cmd_send() - Send a mailbox command to a device.
* @cxlds: The device data for the operation
* @opcode: Opcode for the mailbox command.
* @in: The input payload for the mailbox command.
@@ -160,8 +160,8 @@ static const char *cxl_mem_opcode_to_name(u16 opcode)
* error. While this distinction can be useful for commands from userspace, the
* kernel will only be able to use results when both are successful.
*/
-int cxl_mbox_send_cmd(struct cxl_dev_state *cxlds, u16 opcode, void *in,
- size_t in_size, void *out, size_t out_size)
+int cxl_internal_cmd_send(struct cxl_dev_state *cxlds, u16 opcode, void *in,
+ size_t in_size, void *out, size_t out_size)
{
const struct cxl_mem_command *cmd = cxl_mem_find_command(opcode);
struct cxl_mbox_cmd mbox_cmd = {
@@ -193,7 +193,7 @@ int cxl_mbox_send_cmd(struct cxl_dev_state *cxlds, u16 opcode, void *in,
return 0;
}
-EXPORT_SYMBOL_NS_GPL(cxl_mbox_send_cmd, CXL);
+EXPORT_SYMBOL_NS_GPL(cxl_internal_cmd_send, CXL);
static bool cxl_mem_raw_command_allowed(u16 opcode)
{
@@ -375,7 +375,7 @@ static int cxl_to_mem_cmd(struct cxl_mem_command *mem_cmd,
}
/**
- * cxl_validate_cmd_from_user() - Check fields for CXL_MEM_SEND_COMMAND.
+ * cxl_ioctl_send_checks() - Check userspace send request
* @mbox_cmd: Sanitized and populated &struct cxl_mbox_cmd.
* @cxlds: The device data for the operation
* @send_cmd: &struct cxl_send_command copied in from userspace.
@@ -391,9 +391,9 @@ static int cxl_to_mem_cmd(struct cxl_mem_command *mem_cmd,
* The result of this command is a fully validated command in @mbox_cmd that is
* safe to send to the hardware.
*/
-static int cxl_validate_cmd_from_user(struct cxl_mbox_cmd *mbox_cmd,
- struct cxl_dev_state *cxlds,
- const struct cxl_send_command *send_cmd)
+static int cxl_ioctl_send_checks(struct cxl_mbox_cmd *mbox_cmd,
+ struct cxl_dev_state *cxlds,
+ const struct cxl_send_command *send_cmd)
{
struct cxl_mem_command mem_cmd;
int rc;
@@ -424,8 +424,8 @@ static int cxl_validate_cmd_from_user(struct cxl_mbox_cmd *mbox_cmd,
send_cmd->in.payload);
}
-int cxl_query_cmd(struct cxl_memdev *cxlmd,
- struct cxl_mem_query_commands __user *q)
+int cxl_ioctl_query(struct cxl_memdev *cxlmd,
+ struct cxl_mem_query_commands __user *q)
{
struct device *dev = &cxlmd->dev;
struct cxl_mem_command *cmd;
@@ -459,7 +459,7 @@ int cxl_query_cmd(struct cxl_memdev *cxlmd,
}
/**
- * handle_mailbox_cmd_from_user() - Dispatch a mailbox command for userspace.
+ * cxl_ioctl_send_to_kbuf() - Dispatch a mailbox command for userspace.
* @cxlds: The device data for the operation
* @mbox_cmd: The validated mailbox command.
* @out_payload: Pointer to userspace's output payload.
@@ -479,12 +479,11 @@ int cxl_query_cmd(struct cxl_memdev *cxlmd,
* Dispatches a mailbox command on behalf of a userspace request.
* The output payload is copied to userspace.
*
- * See cxl_send_cmd().
+ * See cxl_ioctl_send().
*/
-static int handle_mailbox_cmd_from_user(struct cxl_dev_state *cxlds,
- struct cxl_mbox_cmd *mbox_cmd,
- u64 out_payload, s32 *size_out,
- u32 *retval)
+static int cxl_ioctl_send_to_kbuf(struct cxl_dev_state *cxlds,
+ struct cxl_mbox_cmd *mbox_cmd,
+ u64 out_payload, s32 *size_out, u32 *retval)
{
struct device *dev = cxlds->dev;
int rc;
@@ -523,7 +522,7 @@ static int handle_mailbox_cmd_from_user(struct cxl_dev_state *cxlds,
return rc;
}
-int cxl_send_cmd(struct cxl_memdev *cxlmd, struct cxl_send_command __user *s)
+int cxl_ioctl_send(struct cxl_memdev *cxlmd, struct cxl_send_command __user *s)
{
struct cxl_dev_state *cxlds = cxlmd->cxlds;
struct device *dev = &cxlmd->dev;
@@ -536,12 +535,12 @@ int cxl_send_cmd(struct cxl_memdev *cxlmd, struct cxl_send_command __user *s)
if (copy_from_user(&send, s, sizeof(send)))
return -EFAULT;
- rc = cxl_validate_cmd_from_user(&mbox_cmd, cxlmd->cxlds, &send);
+ rc = cxl_ioctl_send_checks(&mbox_cmd, cxlmd->cxlds, &send);
if (rc)
return rc;
- rc = handle_mailbox_cmd_from_user(cxlds, &mbox_cmd, send.out.payload,
- &send.out.size, &send.retval);
+ rc = cxl_ioctl_send_to_kbuf(cxlds, &mbox_cmd, send.out.payload,
+ &send.out.size, &send.retval);
if (rc)
return rc;
@@ -565,8 +564,8 @@ static int cxl_xfer_log(struct cxl_dev_state *cxlds, uuid_t *uuid, u32 size, u8
};
int rc;
- rc = cxl_mbox_send_cmd(cxlds, CXL_MBOX_OP_GET_LOG, &log, sizeof(log),
- out, xfer_size);
+ rc = cxl_internal_cmd_send(cxlds, CXL_MBOX_OP_GET_LOG, &log,
+ sizeof(log), out, xfer_size);
if (rc < 0)
return rc;
@@ -618,8 +617,8 @@ static struct cxl_mbox_get_supported_logs *cxl_get_gsl(struct cxl_dev_state *cxl
if (!ret)
return ERR_PTR(-ENOMEM);
- rc = cxl_mbox_send_cmd(cxlds, CXL_MBOX_OP_GET_SUPPORTED_LOGS, NULL, 0, ret,
- cxlds->payload_size);
+ rc = cxl_internal_cmd_send(cxlds, CXL_MBOX_OP_GET_SUPPORTED_LOGS, NULL,
+ 0, ret, cxlds->payload_size);
if (rc < 0) {
kvfree(ret);
return ERR_PTR(rc);
@@ -723,8 +722,8 @@ static int cxl_mem_get_partition_info(struct cxl_dev_state *cxlds)
} __packed pi;
int rc;
- rc = cxl_mbox_send_cmd(cxlds, CXL_MBOX_OP_GET_PARTITION_INFO, NULL, 0,
- &pi, sizeof(pi));
+ rc = cxl_internal_cmd_send(cxlds, CXL_MBOX_OP_GET_PARTITION_INFO, NULL,
+ 0, &pi, sizeof(pi));
if (rc)
return rc;
@@ -756,8 +755,8 @@ int cxl_dev_state_identify(struct cxl_dev_state *cxlds)
struct cxl_mbox_identify id;
int rc;
- rc = cxl_mbox_send_cmd(cxlds, CXL_MBOX_OP_IDENTIFY, NULL, 0, &id,
- sizeof(id));
+ rc = cxl_internal_cmd_send(cxlds, CXL_MBOX_OP_IDENTIFY, NULL, 0, &id,
+ sizeof(id));
if (rc < 0)
return rc;
@@ -268,9 +268,9 @@ static long __cxl_memdev_ioctl(struct cxl_memdev *cxlmd, unsigned int cmd,
{
switch (cmd) {
case CXL_MEM_QUERY_COMMANDS:
- return cxl_query_cmd(cxlmd, (void __user *)arg);
+ return cxl_ioctl_query(cxlmd, (void __user *)arg);
case CXL_MEM_SEND_COMMAND:
- return cxl_send_cmd(cxlmd, (void __user *)arg);
+ return cxl_ioctl_send(cxlmd, (void __user *)arg);
default:
return -ENOTTY;
}
@@ -296,8 +296,8 @@ struct cxl_mem_command {
#define CXL_CMD_FLAG_FORCE_ENABLE BIT(0)
};
-int cxl_mbox_send_cmd(struct cxl_dev_state *cxlds, u16 opcode, void *in,
- size_t in_size, void *out, size_t out_size);
+int cxl_internal_cmd_send(struct cxl_dev_state *cxlds, u16 opcode, void *in,
+ size_t in_size, void *out, size_t out_size);
int cxl_dev_state_identify(struct cxl_dev_state *cxlds);
int cxl_enumerate_cmds(struct cxl_dev_state *cxlds);
int cxl_mem_create_range_info(struct cxl_dev_state *cxlds);
@@ -112,8 +112,9 @@ static int cxl_pmem_get_config_data(struct cxl_dev_state *cxlds,
.length = cmd->in_length,
};
- rc = cxl_mbox_send_cmd(cxlds, CXL_MBOX_OP_GET_LSA, &get_lsa,
- sizeof(get_lsa), cmd->out_buf, cmd->in_length);
+ rc = cxl_internal_cmd_send(cxlds, CXL_MBOX_OP_GET_LSA, &get_lsa,
+ sizeof(get_lsa), cmd->out_buf,
+ cmd->in_length);
cmd->status = 0;
return rc;
@@ -143,9 +144,9 @@ static int cxl_pmem_set_config_data(struct cxl_dev_state *cxlds,
};
memcpy(set_lsa->data, cmd->in_buf, cmd->in_length);
- rc = cxl_mbox_send_cmd(cxlds, CXL_MBOX_OP_SET_LSA, set_lsa,
- struct_size(set_lsa, data, cmd->in_length),
- NULL, 0);
+ rc = cxl_internal_cmd_send(cxlds, CXL_MBOX_OP_SET_LSA, set_lsa,
+ struct_size(set_lsa, data, cmd->in_length),
+ NULL, 0);
/*
* Set "firmware" status (4-packed bytes at the end of the input