(updated the recipient: s/[email protected]/[email protected])

On 26/02/2026 23:20, Alireza Sanaee wrote:
> The CXL address to device decoding logic is complex because of the need to
> correctly decode fine grained interleave. The current implementation
> prevents use with KVM where executed instructions may reside in that memory
> and gives very slow performance even in TCG.
> 
> In many real cases non interleaved memory configurations are useful and for
> those we can use a more conventional memory region alias allowing similar
> performance to other memory in the system.
> 
> Whether this fast path is applicable can be established once the full set
> of HDM decoders has been committed (in whatever order the guest decides to
> commit them). As such a check is performed on each commit/uncommit of HDM
> decoder to establish if the alias should be added or removed.
> 
> Co-developed-by: Jonathan Cameron<[email protected]>
> Signed-off-by: Jonathan Cameron<[email protected]>
> Signed-off-by: Alireza Sanaee<[email protected]>
> ---
> Thanks Gregory for the review and feedback on the previous versions.
> 
> Change log:
> v5-v6: Use object_unparent() in the third commit when deleting alias regions.
> 
>   hw/cxl/cxl-component-utils.c |   6 ++
>   hw/cxl/cxl-host.c            | 190 +++++++++++++++++++++++++++++++++++
>   hw/mem/cxl_type3.c           |   4 +
>   include/hw/cxl/cxl.h         |   1 +
>   include/hw/cxl/cxl_device.h  |   4 +
>   5 files changed, 205 insertions(+)
> 
> diff --git a/hw/cxl/cxl-component-utils.c b/hw/cxl/cxl-component-utils.c
> index 07aabe331c..a624357978 100644
> --- a/hw/cxl/cxl-component-utils.c
> +++ b/hw/cxl/cxl-component-utils.c
> @@ -143,6 +143,12 @@ static void dumb_hdm_handler(CXLComponentState 
> *cxl_cstate, hwaddr offset,
>           value = FIELD_DP32(value, CXL_HDM_DECODER0_CTRL, COMMITTED, 0);
>       }
>       stl_le_p((uint8_t *)cache_mem + offset, value);
> +
> +    if (should_commit) {
> +        cfmws_update_non_interleaved(true);
> +    } else if (should_uncommit) {
> +        cfmws_update_non_interleaved(false);
> +    }
>   }

[..snip...]


> +
> +bool cfmws_update_non_interleaved(bool commit)
> +{
> +    /*
> +     * Walk endpoints to find both committed and uncommitted decoders,
> +     * then check if they are not interleaved (but the path is fully set up).
> +     */
> +    object_child_foreach_recursive(object_get_root(),
> +                                   update_non_interleaved, &commit);
> +
> +    return false;


Since this function always returns false and its return value is never used, it 
can be defined as void.
With that minor change, the patch looks good to me.
  
Reviewed-by: Li Zhijian <[email protected]>



> +}
> +

Reply via email to