Re: [PATCH v2] cxl/events: Use a common struct for DRAM and General Media events

From: Fabio M. De Francesco
Date: Fri May 17 2024 - 06:09:00 EST


Jonathan,

Thanks for your comments.

On Thursday, May 16, 2024 6:33:19 PM GMT+2 Jonathan Cameron wrote:
> On Thu, 16 May 2024 12:19:53 +0200
>
> "Fabio M. De Francesco" <fabio.m.de.francesco@xxxxxxxxxxxxxxx> wrote:
> > cxl_event_common was a poor naming choice and caused confusion with the
> > existing Common Event Record.
> >
> > Use cxl_event_media as a common structure to record information about DRAM
> > and General Media events because it simplifies handling the two events.
> >
> > Suggested-by: Dan Williams <dan.j.williams@xxxxxxxxx>
> > Fixes: 6aec00139d3a ("cxl/core: Add region info to cxl_general_media and
> > cxl_dram events") Signed-off-by: Fabio M. De Francesco
> > <fabio.m.de.francesco@xxxxxxxxxxxxxxx> ---
>
> Packing question inline.
>
> > [...]
> >
> > -struct cxl_event_dram {
> > +struct cxl_event_media {
> >
> > struct cxl_event_record_hdr hdr;
> >
> > - __le64 phys_addr;
> > - u8 descriptor;
> > - u8 type;
> > - u8 transaction_type;
> > - u8 validity_flags[2];
> > - u8 channel;
> > - u8 rank;
> > - u8 nibble_mask[3];
> > - u8 bank_group;
> > - u8 bank;
> > - u8 row[3];
> > - u8 column[2];
> > - u8 correction_mask[CXL_EVENT_DER_CORRECTION_MASK_SIZE];
> > - u8 reserved[0x17];
> > + struct_group_tagged(cxl_event_media_hdr, media_hdr,
> > + __le64 phys_addr;
> > + u8 descriptor;
> > + u8 type;
> > + u8 transaction_type;
> > + u8 validity_flags[2];
> > + u8 channel;
> > + u8 rank;
> > + );
>
> Does the struct that is created end up __packed?

No, I should have noticed it.

> Also, why is tagged useful here?

It is not useful. I'll rework it not tagged.

Again thanks,

Fabio

> > + union {
> > + struct_group(general,
> > + u8 device[3];
> > + u8
component_id[CXL_EVENT_GEN_MED_COMP_ID_SIZE];
> > + u8 gen_reserved[46];
> > + );
> > + struct_group(dram,
> > + u8 nibble_mask[3];
> > + u8 bank_group;
> > + u8 bank;
> > + u8 row[3];
> > + u8 column[2];
> > + u8
correction_mask[CXL_EVENT_DER_CORRECTION_MASK_SIZE];
> > + u8 dram_reserved[0x17];
> > + );
> > + };
> >
> > } __packed;
> >