On Mon, Apr 14, 2025 at 03:19:50PM +0100, Jonathan Cameron wrote:
> On Sun, 13 Apr 2025 17:52:09 -0500
> Ira Weiny <[email protected]> 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 <[email protected]>
> 
> 
> > +
> > +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!

The code only checks if any DCD command (48xx) is supported, if any is
set, it will set "dcd_supported".
As you mentioned, it seems we should check all the related commands are
supported, otherwise it is not valid implementation.

Fan
> 
> 
> > +{
> > +   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);
> > +}
> > +
> 
> 

-- 
Fan Ni

Reply via email to