[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6a2dc88f-fb7a-475f-aa95-6d1ba2433384@amd.com>
Date: Tue, 11 Mar 2025 15:06:55 -0500
From: Ben Cheatham <benjamin.cheatham@....com>
To: <alejandro.lucero-palau@....com>
CC: Zhi Wang <zhiw@...dia.com>, Jonathan Cameron
<Jonathan.Cameron@...wei.com>, <linux-cxl@...r.kernel.org>,
<netdev@...r.kernel.org>, <dan.j.williams@...el.com>, <edward.cree@....com>,
<davem@...emloft.net>, <kuba@...nel.org>, <pabeni@...hat.com>,
<edumazet@...gle.com>, <dave.jiang@...el.com>, <benjamin.cheatham@....com>
Subject: Re: [PATCH v11 21/23] cxl: add function for obtaining region range
On 3/10/25 4:03 PM, alejandro.lucero-palau@....com wrote:
> From: Alejandro Lucero <alucerop@....com>
>
> A CXL region struct contains the physical address to work with.
>
> Add a function for getting the cxl region range to be used for mapping
> such memory range.
>
> Signed-off-by: Alejandro Lucero <alucerop@....com>
> Reviewed-by: Zhi Wang <zhiw@...dia.com>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> ---
> drivers/cxl/core/region.c | 15 +++++++++++++++
> drivers/cxl/cxl.h | 1 +
> include/cxl/cxl.h | 2 ++
> 3 files changed, 18 insertions(+)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 7f832cb1db51..0c85245c2407 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -2716,6 +2716,21 @@ static struct cxl_region *devm_cxl_add_region(struct cxl_root_decoder *cxlrd,
> return ERR_PTR(rc);
> }
>
> +int cxl_get_region_range(struct cxl_region *region, struct range *range)
> +{
> + if (WARN_ON_ONCE(!region))
> + return -ENODEV;
> +
> + if (!region->params.res)
> + return -ENOSPC;
> +
> + range->start = region->params.res->start;
> + range->end = region->params.res->end;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_NS_GPL(cxl_get_region_range, "CXL");
> +
> static ssize_t __create_region_show(struct cxl_root_decoder *cxlrd, char *buf)
> {
> return sysfs_emit(buf, "region%u\n", atomic_read(&cxlrd->region_id));
> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> index 2eb927c9229c..953af2b31b1c 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -811,6 +811,7 @@ void cxl_coordinates_combine(struct access_coordinate *out,
>
> bool cxl_endpoint_decoder_reset_detected(struct cxl_port *port);
>
> +int cxl_get_region_range(struct cxl_region *region, struct range *range);
I don't think this needs to be declared in drivers/cxl/cxl.h since it'll
get defined when including include/cxl/cxl.h.
> /*
> * Unit test builds overrides this to __weak, find the 'strong' version
> * of these symbols in tools/testing/cxl/.
> diff --git a/include/cxl/cxl.h b/include/cxl/cxl.h
> index f54d8c72bc79..8eb918241c48 100644
> --- a/include/cxl/cxl.h
> +++ b/include/cxl/cxl.h
> @@ -264,4 +264,6 @@ struct cxl_region *cxl_create_region(struct cxl_root_decoder *cxlrd,
> bool no_dax);
>
> int cxl_accel_region_detach(struct cxl_endpoint_decoder *cxled);
> +struct range;
> +int cxl_get_region_range(struct cxl_region *region, struct range *range);
> #endif
Powered by blists - more mailing lists