On Sun, 13 Apr 2025 17:52:12 -0500
Ira Weiny <ira.we...@intel.com> wrote:

> Device partitions have an implied order which is made more complex by
> the addition of a dynamic partition.
> 
> Remove the ram special case information calls in favor of generic calls
> with a check ahead of time to ensure the preservation of the implied
> partition order.
> 
> Signed-off-by: Ira Weiny <ira.we...@intel.com>
One trivial thing inline.

To me this patch stands on it's own irrespective of the rest of the
series. Maybe one to queue up early as a cleanup?

Reviewed-by: Jonathan Cameron <jonathan.came...@huawei.com>

Jonathan

> ---
>  drivers/cxl/core/hdm.c    | 11 ++++++++++-
>  drivers/cxl/core/memdev.c | 32 +++++++++-----------------------
>  drivers/cxl/cxl.h         |  1 +
>  drivers/cxl/cxlmem.h      |  9 +++------
>  drivers/cxl/mem.c         |  2 +-
>  5 files changed, 24 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> index c5f8a17d00f1..92e1a24e2109 100644
> --- a/drivers/cxl/core/hdm.c
> +++ b/drivers/cxl/core/hdm.c
> @@ -470,6 +470,7 @@ static const char *cxl_mode_name(enum cxl_partition_mode 
> mode)
>  int cxl_dpa_setup(struct cxl_dev_state *cxlds, const struct cxl_dpa_info 
> *info)
>  {
>       struct device *dev = cxlds->dev;
> +     int i;
>  
>       guard(rwsem_write)(&cxl_dpa_rwsem);
>  
> @@ -482,9 +483,17 @@ int cxl_dpa_setup(struct cxl_dev_state *cxlds, const 
> struct cxl_dpa_info *info)
>               return 0;
>       }
>  
> +     /* Verify partitions are in expected order. */
> +     for (i = 1; i < info->nr_partitions; i++) {
> +             if (cxlds->part[i].mode < cxlds->part[i-1].mode) {

spaces around -

> +                     dev_err(dev, "Partition order mismatch\n");
> +                     return 0;
> +             }
> +     }
> +
>       cxlds->dpa_res = DEFINE_RES_MEM(0, info->size);
>  
> -     for (int i = 0; i < info->nr_partitions; i++) {
> +     for (i = 0; i < info->nr_partitions; i++) {
>               const struct cxl_dpa_part_info *part = &info->part[i];
>               int rc;


Reply via email to