[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <abf398ec-ef1f-43aa-a209-c008085bc206@amd.com>
Date: Thu, 8 May 2025 15:32:50 +0100
From: Alejandro Lucero Palau <alucerop@....com>
To: Alison Schofield <alison.schofield@...el.com>,
alejandro.lucero-palau@....com
Cc: 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, Zhi Wang <zhiw@...dia.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH v14 21/22] cxl: add function for obtaining region range
On 5/8/25 02:24, Alison Schofield wrote:
> On Thu, Apr 17, 2025 at 10:29:24PM +0100, 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.
> Worth adding that it is being exported for use by a Type 2 driver.
Sure. I'll do so.
Thanks
>
>> Signed-off-by: Alejandro Lucero <alucerop@....com>
>> Reviewed-by: Zhi Wang <zhiw@...dia.com>
>> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
>> Reviewed-by: Dave Jiang <dave.jiang@...el.com>
>> ---
>> drivers/cxl/core/region.c | 15 +++++++++++++++
>> include/cxl/cxl.h | 2 ++
>> 2 files changed, 17 insertions(+)
>>
>> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
>> index cec168a26efb..253ec4e384a6 100644
>> --- a/drivers/cxl/core/region.c
>> +++ b/drivers/cxl/core/region.c
>> @@ -2717,6 +2717,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/include/cxl/cxl.h b/include/cxl/cxl.h
>> index 5d30d775966b..2adc21e8ad44 100644
>> --- a/include/cxl/cxl.h
>> +++ b/include/cxl/cxl.h
>> @@ -271,4 +271,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 /* __CXL_CXL_H__ */
>> --
>> 2.34.1
>>
>>
Powered by blists - more mailing lists