Re: [PATCH v13 08/15] cxl: Refresh cached PCI HDM decoder settings

From: Jonathan Cameron

Date: Wed Sep 23 2026 - 23:08:41 EST


On Tue, 22 Sep 2026 08:39:17 +0000
Srirangan Madhavan <smadhavan@xxxxxxxxxx> wrote:

> Early PCI discovery creates the HDM cache, while later CXL enumeration and
> decoder operations provide updated programming state.
>
> Refresh the PCI snapshot when decoders are enumerated, committed, or reset
> so reset recovery need not walk the CXL topology. Ignore updates when no
> cache exists and reject decoder-count mismatches.
>
> Signed-off-by: Srirangan Madhavan <smadhavan@xxxxxxxxxx>

> diff --git a/include/cxl/cxl.h b/include/cxl/cxl.h
> index 1acdf537e4e9..005259e38f4b 100644
> --- a/include/cxl/cxl.h
> +++ b/include/cxl/cxl.h
> @@ -77,6 +77,28 @@ struct cxl_decoder_settings {
> u64 target_or_skip_reg_val;
> };
>
> +/**
> + * struct cxl_hdm_info - cached CXL HDM state for a PCI device
> + * @decoder_count: number of entries in @settings
> + * @hdm_bar: PCI BAR containing the HDM decoder capability
> + * @hdm_offset: offset of the HDM decoder capability in @hdm_bar
> + * @hdm_size: size of the HDM decoder register block
> + * @global_ctrl: HDM decoder global control register
> + * @dvsec_ctrl: CXL DVSEC control register
> + * @dvsec_ctrl_valid: whether @dvsec_ctrl contains valid state
> + * @settings: per-decoder programming state
> + */
> +struct cxl_hdm_info {
> + int decoder_count;
> + int hdm_bar;
> + resource_size_t hdm_offset;
> + resource_size_t hdm_size;
> + u32 global_ctrl;
> + u16 dvsec_ctrl;
> + bool dvsec_ctrl_valid;
> + struct cxl_decoder_settings settings[];

Can we use __counted_by(decoder_count) for this?

> +};