On Tue, Feb 10, 2026 at 06:44:55AM +0000, Smita Koralahalli wrote:
> __cxl_decoder_detach() currently resets decoder programming whenever a
> region is detached if cxl_config_state is beyond CXL_CONFIG_ACTIVE. For

Not sure 'detached' is the right word. Unregistered maybe?

> autodiscovered regions, this can incorrectly tear down decoder state
> that may be relied upon by other consumers or by subsequent ownership
> decisions.
> 
> Skip cxl_region_decode_reset() during detach when CXL_REGION_F_AUTO is
> set.

I get how this is needed in the failover to DAX case, yet I'm not clear
how it fits in with folks that just want to destroy that auto region
and resuse the pieces.

Your other recent patch cxl/hdm: Avoid DVSEC fallback after region teardown[1],
showed me that the memdevs, when left with the endpoint decoders not reset,
will keep trying to create another region when reprobed.

[1] https://lore.kernel.org/linux-cxl/[email protected]/

I think the patch does what it says it does. Perhaps expand on why that 
is always the right thing to do.

--Alison


> 
> Signed-off-by: Smita Koralahalli <[email protected]>
> Reviewed-by: Jonathan Cameron <[email protected]>
> Reviewed-by: Dave Jiang <[email protected]>
> Reviewed-by: Alejandro Lucero <[email protected]>
> ---
>  drivers/cxl/core/region.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index ae899f68551f..45ee598daf95 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -2178,7 +2178,9 @@ __cxl_decoder_detach(struct cxl_region *cxlr,
>               cxled->part = -1;
>  
>       if (p->state > CXL_CONFIG_ACTIVE) {
> -             cxl_region_decode_reset(cxlr, p->interleave_ways);
> +             if (!test_bit(CXL_REGION_F_AUTO, &cxlr->flags))
> +                     cxl_region_decode_reset(cxlr, p->interleave_ways);
> +
>               p->state = CXL_CONFIG_ACTIVE;
>       }
>  
> -- 
> 2.17.1
> 

Reply via email to