Skip to content

Commit 483e4a1

Browse files
committed
Merge tag 'cxl-fixes-for-5.19-rc6' of git://git.kernel.org/pub/scm/linux/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
2 parents f5645ed + e35f571 commit 483e4a1

File tree

10 files changed

+25
-14
lines changed

10 files changed

+25
-14
lines changed

.mailmap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ Bart Van Assche <bvanassche@acm.org> <bart.vanassche@sandisk.com>
6464
Bart Van Assche <bvanassche@acm.org> <bart.vanassche@wdc.com>
6565
Ben Gardner <bgardner@wabtec.com>
6666
Ben M Cahill <ben.m.cahill@intel.com>
67+
Ben Widawsky <bwidawsk@kernel.org> <ben@bwidawsk.net>
68+
Ben Widawsky <bwidawsk@kernel.org> <ben.widawsky@intel.com>
69+
Ben Widawsky <bwidawsk@kernel.org> <benjamin.widawsky@intel.com>
6770
Björn Steinbrink <B.Steinbrink@gmx.de>
6871
Björn Töpel <bjorn@kernel.org> <bjorn.topel@gmail.com>
6972
Björn Töpel <bjorn@kernel.org> <bjorn.topel@intel.com>

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5101,7 +5101,7 @@ COMPUTE EXPRESS LINK (CXL)
51015101
M: Alison Schofield <alison.schofield@intel.com>
51025102
M: Vishal Verma <vishal.l.verma@intel.com>
51035103
M: Ira Weiny <ira.weiny@intel.com>
5104-
M: Ben Widawsky <ben.widawsky@intel.com>
5104+
M: Ben Widawsky <bwidawsk@kernel.org>
51055105
M: Dan Williams <dan.j.williams@intel.com>
51065106
L: linux-cxl@vger.kernel.org
51075107
S: Maintained

drivers/cxl/core/hdm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
197197
else
198198
cxld->target_type = CXL_DECODER_ACCELERATOR;
199199

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

203203
target_list.value =

drivers/cxl/core/mbox.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,13 @@ static int cxl_to_mem_cmd(struct cxl_mem_command *mem_cmd,
355355
return -EBUSY;
356356

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

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

365367
*mem_cmd = (struct cxl_mem_command) {

drivers/cxl/core/port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ static const struct device_type cxl_decoder_root_type = {
272272
.groups = cxl_decoder_root_attribute_groups,
273273
};
274274

275-
static bool is_endpoint_decoder(struct device *dev)
275+
bool is_endpoint_decoder(struct device *dev)
276276
{
277277
return dev->type == &cxl_decoder_endpoint_type;
278278
}

drivers/cxl/cxl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ struct cxl_dport *cxl_find_dport_by_dev(struct cxl_port *port,
340340

341341
struct cxl_decoder *to_cxl_decoder(struct device *dev);
342342
bool is_root_decoder(struct device *dev);
343+
bool is_endpoint_decoder(struct device *dev);
343344
bool is_cxl_decoder(struct device *dev);
344345
struct cxl_decoder *cxl_root_decoder_alloc(struct cxl_port *port,
345346
unsigned int nr_targets);

drivers/cxl/cxlmem.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,13 @@ struct cxl_mbox_identify {
300300
} __packed;
301301

302302
struct cxl_mbox_get_lsa {
303-
u32 offset;
304-
u32 length;
303+
__le32 offset;
304+
__le32 length;
305305
} __packed;
306306

307307
struct cxl_mbox_set_lsa {
308-
u32 offset;
309-
u32 reserved;
308+
__le32 offset;
309+
__le32 reserved;
310310
u8 data[];
311311
} __packed;
312312

drivers/cxl/mem.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ static int create_endpoint(struct cxl_memdev *cxlmd,
2929
{
3030
struct cxl_dev_state *cxlds = cxlmd->cxlds;
3131
struct cxl_port *endpoint;
32+
int rc;
3233

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

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

41+
rc = cxl_endpoint_autoremove(cxlmd, endpoint);
42+
if (rc)
43+
return rc;
44+
4045
if (!endpoint->dev.driver) {
4146
dev_err(&cxlmd->dev, "%s failed probe\n",
4247
dev_name(&endpoint->dev));
4348
return -ENXIO;
4449
}
4550

46-
return cxl_endpoint_autoremove(cxlmd, endpoint);
51+
return 0;
4752
}
4853

4954
static void enable_suspend(void *data)

drivers/cxl/pmem.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ static int cxl_pmem_get_config_data(struct cxl_dev_state *cxlds,
108108
return -EINVAL;
109109

110110
get_lsa = (struct cxl_mbox_get_lsa) {
111-
.offset = cmd->in_offset,
112-
.length = cmd->in_length,
111+
.offset = cpu_to_le32(cmd->in_offset),
112+
.length = cpu_to_le32(cmd->in_length),
113113
};
114114

115115
rc = cxl_mbox_send_cmd(cxlds, CXL_MBOX_OP_GET_LSA, &get_lsa,
@@ -139,7 +139,7 @@ static int cxl_pmem_set_config_data(struct cxl_dev_state *cxlds,
139139
return -ENOMEM;
140140

141141
*set_lsa = (struct cxl_mbox_set_lsa) {
142-
.offset = cmd->in_offset,
142+
.offset = cpu_to_le32(cmd->in_offset),
143143
};
144144
memcpy(set_lsa->data, cmd->in_buf, cmd->in_length);
145145

include/linux/memregion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static inline int memregion_alloc(gfp_t gfp)
1616
{
1717
return -ENOMEM;
1818
}
19-
void memregion_free(int id)
19+
static inline void memregion_free(int id)
2020
{
2121
}
2222
#endif

0 commit comments

Comments
 (0)