Re: [PATCH v9 01/19] cxl/mbox: Flag support for Dynamic Capacity Devices (DCD)

From: Jonathan Cameron
Date: Mon Apr 14 2025 - 10:49:34 EST


On Sun, 13 Apr 2025 17:52:09 -0500
Ira Weiny <ira.weiny@xxxxxxxxx> wrote:

> Per the CXL 3.1 specification software must check the Command Effects
> Log (CEL) for dynamic capacity command support.
>
> Detect support for the DCD commands while reading the CEL, including:
>
> Get DC Config
> Get DC Extent List
> Add DC Response
> Release DC
>
> Based on an original patch by Navneet Singh.
>
> Signed-off-by: Ira Weiny <ira.weiny@xxxxxxxxx>


> +
> +static bool cxl_verify_dcd_cmds(struct cxl_memdev_state *mds, unsigned long *cmds_seen)

It's not immediately obvious to me what the right behavior
from something called cxl_verify_dcd_cmds() is. A comment might help with that.

I think all it does right now is check if any bits are set. In my head
it was going to check that all bits needed for a useful implementation were
set. I did have to go check what a 'logical and' of a bitmap was defined as
because that bit of the bitmap_and() return value wasn't obvious to me either!


> +{
> + DECLARE_BITMAP(all_cmds, CXL_DCD_ENABLED_MAX);
> + DECLARE_BITMAP(dst, CXL_DCD_ENABLED_MAX);
> +
> + bitmap_fill(all_cmds, CXL_DCD_ENABLED_MAX);
> + return bitmap_and(dst, cmds_seen, all_cmds, CXL_DCD_ENABLED_MAX);
> +}
> +