Subject: Re: [PATCH v10 16/26] cxl: define a driver interface for DPA allocation

From: Simon Horman <[email-masked]>
Date: Fri, 7 Feb 2025 13:46:05 +0000

On Wed, Feb 05, 2025 at 03:19:40PM +0000, [email-masked] wrote:
> From: Alejandro Lucero <[email-masked]>
> 
> Region creation involves finding available DPA (device-physical-address)
> capacity to map into HPA (host-physical-address) space. Define an API,
> cxl_request_dpa(), that tries to allocate the DPA memory the driver
> requires to operate. The memory requested should not be bigger than the
> max available HPA obtained previously with cxl_get_hpa_freespace.
> 
> Based on https://lore.kernel.org/linux-cxl/[email-masked]/
> 
> Signed-off-by: Alejandro Lucero <[email-masked]>
> ---
>  drivers/cxl/core/hdm.c | 83 ++++++++++++++++++++++++++++++++++++++++++
>  include/cxl/cxl.h      |  4 ++
>  2 files changed, 87 insertions(+)
> 
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> index af025da81fa2..cec2c7dcaf3a 100644
> --- a/drivers/cxl/core/hdm.c
> +++ b/drivers/cxl/core/hdm.c
> @@ -3,6 +3,7 @@
>  #include <linux/seq_file.h>
>  #include <linux/device.h>
>  #include <linux/delay.h>
> +#include <cxl/cxl.h>

Hi Alejandro,

I think that linux/range.h should be included in cxl.h, or if not here.
This is because on allmodconfigs for both arm and arm64 I see:

In file included from drivers/cxl/core/hdm.c:6:
./include/cxl/cxl.h:67:16: error: field has incomplete type 'struct range'
   67 |                 struct range range;
      |                              ^
./include/linux/memory_hotplug.h:247:8: note: forward declaration of 'struct range'
  247 | struct range arch_get_mappable_range(void);
      |        ^
1 error generated.

...