Re: [PATCH v5 08/27] cxl/mem: Read dynamic capacity configuration from the device
From: Ira Weiny
Date: Wed Oct 30 2024 - 12:28:59 EST
Jonathan Cameron wrote:
> On Tue, 29 Oct 2024 15:34:43 -0500
> ira.weiny@xxxxxxxxx wrote:
>
> > From: Navneet Singh <navneet.singh@xxxxxxxxx>
> >
> > Devices which optionally support Dynamic Capacity (DC) are configured
> > via mailbox commands. CXL 3.1 requires the host to issue the Get DC
> > Configuration command in order to properly configure DCDs. Without the
> > Get DC Configuration command DCD can't be supported.
> >
> > Implement the DC mailbox commands as specified in CXL 3.1 section
> > 8.2.9.9.9 (opcodes 48XXh) to read and store the DCD configuration
> > information. Disable DCD if DCD is not supported. Leverage the Get DC
> > Configuration command supported bit to indicate if DCD is supported.
> >
> > Linux has no use for the trailing fields of the Get Dynamic Capacity
> > Configuration Output Payload (Total number of supported extents, number
> > of available extents, total number of supported tags, and number of
> > available tags). Avoid defining those fields to use the more useful
> > dynamic C array.
> >
> > Cc: Li, Ming <ming4.li@xxxxxxxxx>
> > Cc: Kees Cook <kees@xxxxxxxxxx>
> > Cc: Gustavo A. R. Silva <gustavoars@xxxxxxxxxx>
> > Cc: linux-hardening@xxxxxxxxxxxxxxx
> > Signed-off-by: Navneet Singh <navneet.singh@xxxxxxxxx>
> > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> > Co-developed-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> > Signed-off-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> I'll assume you'll fix the typo the bot found.
Already done... I did not realize my compiler was too old for this
feature.
FWIW:
/*
* Optional: only supported since gcc >= 15
...
FC40 is still at 14.2.1... :-/
Ira
>
> > +
> > +/* See CXL 3.1 Table 8-164 get dynamic capacity config Output Payload */
> > +struct cxl_mbox_get_dc_config_out {
> > + u8 avail_region_count;
> > + u8 regions_returned;
> > + u8 rsvd[6];
> > + /* See CXL 3.1 Table 8-165 */
> > + struct cxl_dc_region_config {
> > + __le64 region_base;
> > + __le64 region_decode_length;
> > + __le64 region_length;
> > + __le64 region_block_size;
> > + __le32 region_dsmad_handle;
> > + u8 flags;
> > + u8 rsvd[3];
> > + } __packed region[] __counted_by(regions_retunred);
> returned
>
> > + /* Trailing fields unused */
> > +} __packed;