Message ID | 20220104232114.789948-1-alison.schofield@intel.com |
---|---|
State | Superseded |
Headers | show |
Series | cxl/mbox: Use __le32 in get,set_lsa mailbox structures | expand |
On Tue, Jan 4, 2022 at 3:16 PM <alison.schofield@intel.com> wrote: > > From: Alison Schofield <alison.schofield@intel.com> > > CXL specification defines these as little endian. > > Fixes: 60b8f17215de ("cxl/pmem: Translate NVDIMM label commands to CXL label commands") > Reported-by: Dan Williams <dan.j.williams@intel.com> > Signed-off-by: Alison Schofield <alison.schofield@intel.com> > --- > drivers/cxl/cxlmem.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h > index 8d96d009ad90..eae2a687ea5d 100644 > --- a/drivers/cxl/cxlmem.h > +++ b/drivers/cxl/cxlmem.h > @@ -221,13 +221,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; You'll also need to fixup up the users like this: diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c index ceb2115981e5..90f6346c0fe1 100644 --- a/drivers/cxl/pmem.c +++ b/drivers/cxl/pmem.c @@ -108,8 +108,8 @@ static int cxl_pmem_get_config_data(struct cxl_mem *cxlm, 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_mem_mbox_send_cmd(cxlm, CXL_MBOX_OP_GET_LSA, &get_lsa, ...etc
diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h index 8d96d009ad90..eae2a687ea5d 100644 --- a/drivers/cxl/cxlmem.h +++ b/drivers/cxl/cxlmem.h @@ -221,13 +221,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;