Skip to content

Commit

Permalink
Merge tag 'cxl-fixes-for-5.19-rc6' of git://git.kernel.org/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/kernel/git/cxl/cxl

Pull cxl fixes from Vishal Verma:

 - Update MAINTAINERS for Ben's email

 - Fix cleanup of port devices on failure to probe driver

 - Fix endianness in get/set LSA mailbox command structures

 - Fix memregion_free() fallback definition

 - Fix missing variable payload checks in CXL cmd size validation

* tag 'cxl-fixes-for-5.19-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl:
  cxl/mbox: Fix missing variable payload checks in cmd size validation
  memregion: Fix memregion_free() fallback definition
  cxl/mbox: Use __le32 in get,set_lsa mailbox structures
  cxl/core: Use is_endpoint_decoder
  cxl: Fix cleanup of port devices on failure to probe driver.
  MAINTAINERS: Update Ben's email address
  • Loading branch information
torvalds committed Jul 8, 2022
2 parents f5645ed + e35f571 commit 483e4a1
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ Bart Van Assche <[email protected]> <[email protected]>
Bart Van Assche <[email protected]> <[email protected]>
Ben Gardner <[email protected]>
Ben M Cahill <[email protected]>
Ben Widawsky <[email protected]> <[email protected]>
Ben Widawsky <[email protected]> <[email protected]>
Ben Widawsky <[email protected]> <[email protected]>
Björn Steinbrink <[email protected]>
Björn Töpel <[email protected]> <[email protected]>
Björn Töpel <[email protected]> <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -5101,7 +5101,7 @@ COMPUTE EXPRESS LINK (CXL)
M: Alison Schofield <[email protected]>
M: Vishal Verma <[email protected]>
M: Ira Weiny <[email protected]>
M: Ben Widawsky <[email protected]>
M: Ben Widawsky <[email protected]>
M: Dan Williams <[email protected]>
L: [email protected]
S: Maintained
Expand Down
2 changes: 1 addition & 1 deletion drivers/cxl/core/hdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
else
cxld->target_type = CXL_DECODER_ACCELERATOR;

if (is_cxl_endpoint(to_cxl_port(cxld->dev.parent)))
if (is_endpoint_decoder(&cxld->dev))
return 0;

target_list.value =
Expand Down
6 changes: 4 additions & 2 deletions drivers/cxl/core/mbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,13 @@ static int cxl_to_mem_cmd(struct cxl_mem_command *mem_cmd,
return -EBUSY;

/* Check the input buffer is the expected size */
if (info->size_in != send_cmd->in.size)
if ((info->size_in != CXL_VARIABLE_PAYLOAD) &&
(info->size_in != send_cmd->in.size))
return -ENOMEM;

/* Check the output buffer is at least large enough */
if (send_cmd->out.size < info->size_out)
if ((info->size_out != CXL_VARIABLE_PAYLOAD) &&
(send_cmd->out.size < info->size_out))
return -ENOMEM;

*mem_cmd = (struct cxl_mem_command) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/cxl/core/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static const struct device_type cxl_decoder_root_type = {
.groups = cxl_decoder_root_attribute_groups,
};

static bool is_endpoint_decoder(struct device *dev)
bool is_endpoint_decoder(struct device *dev)
{
return dev->type == &cxl_decoder_endpoint_type;
}
Expand Down
1 change: 1 addition & 0 deletions drivers/cxl/cxl.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ struct cxl_dport *cxl_find_dport_by_dev(struct cxl_port *port,

struct cxl_decoder *to_cxl_decoder(struct device *dev);
bool is_root_decoder(struct device *dev);
bool is_endpoint_decoder(struct device *dev);
bool is_cxl_decoder(struct device *dev);
struct cxl_decoder *cxl_root_decoder_alloc(struct cxl_port *port,
unsigned int nr_targets);
Expand Down
8 changes: 4 additions & 4 deletions drivers/cxl/cxlmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,13 @@ struct cxl_mbox_identify {
} __packed;

struct cxl_mbox_get_lsa {
u32 offset;
u32 length;
__le32 offset;
__le32 length;
} __packed;

struct cxl_mbox_set_lsa {
u32 offset;
u32 reserved;
__le32 offset;
__le32 reserved;
u8 data[];
} __packed;

Expand Down
7 changes: 6 additions & 1 deletion drivers/cxl/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ static int create_endpoint(struct cxl_memdev *cxlmd,
{
struct cxl_dev_state *cxlds = cxlmd->cxlds;
struct cxl_port *endpoint;
int rc;

endpoint = devm_cxl_add_port(&parent_port->dev, &cxlmd->dev,
cxlds->component_reg_phys, parent_port);
Expand All @@ -37,13 +38,17 @@ static int create_endpoint(struct cxl_memdev *cxlmd,

dev_dbg(&cxlmd->dev, "add: %s\n", dev_name(&endpoint->dev));

rc = cxl_endpoint_autoremove(cxlmd, endpoint);
if (rc)
return rc;

if (!endpoint->dev.driver) {
dev_err(&cxlmd->dev, "%s failed probe\n",
dev_name(&endpoint->dev));
return -ENXIO;
}

return cxl_endpoint_autoremove(cxlmd, endpoint);
return 0;
}

static void enable_suspend(void *data)
Expand Down
6 changes: 3 additions & 3 deletions drivers/cxl/pmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ static int cxl_pmem_get_config_data(struct cxl_dev_state *cxlds,
return -EINVAL;

get_lsa = (struct cxl_mbox_get_lsa) {
.offset = cmd->in_offset,
.length = cmd->in_length,
.offset = cpu_to_le32(cmd->in_offset),
.length = cpu_to_le32(cmd->in_length),
};

rc = cxl_mbox_send_cmd(cxlds, CXL_MBOX_OP_GET_LSA, &get_lsa,
Expand Down Expand Up @@ -139,7 +139,7 @@ static int cxl_pmem_set_config_data(struct cxl_dev_state *cxlds,
return -ENOMEM;

*set_lsa = (struct cxl_mbox_set_lsa) {
.offset = cmd->in_offset,
.offset = cpu_to_le32(cmd->in_offset),
};
memcpy(set_lsa->data, cmd->in_buf, cmd->in_length);

Expand Down
2 changes: 1 addition & 1 deletion include/linux/memregion.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static inline int memregion_alloc(gfp_t gfp)
{
return -ENOMEM;
}
void memregion_free(int id)
static inline void memregion_free(int id)
{
}
#endif
Expand Down

0 comments on commit 483e4a1

Please sign in to comment.