[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <76347d1e-5e49-860b-3cbf-bad2a52c3853@amd.com>
Date: Mon, 19 Aug 2024 17:14:32 +0100
From: Alejandro Lucero Palau <alucerop@....com>
To: Zhi Wang <zhiw@...dia.com>, alejandro.lucero-palau@....com
Cc: linux-cxl@...r.kernel.org, netdev@...r.kernel.org,
dan.j.williams@...el.com, martin.habets@...inx.com, edward.cree@....com,
davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
edumazet@...gle.com, richard.hughes@....com, targupta@...dia.com
Subject: Re: [PATCH v2 14/15] cxl: add function for obtaining params from a
region
On 8/9/24 16:24, Zhi Wang wrote:
> On Mon, 15 Jul 2024 18:28:34 +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 given a opaque cxl region struct returns the params
>> to be used for mapping such memory range.
>>
>> Signed-off-by: Alejandro Lucero <alucerop@....com>
>> ---
>> drivers/cxl/core/region.c | 16 ++++++++++++++++
>> drivers/cxl/cxl.h | 3 +++
>> include/linux/cxl_accel_mem.h | 2 ++
>> 3 files changed, 21 insertions(+)
>>
>> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
>> index c8fc14ac437e..9ff10923e9fc 100644
>> --- a/drivers/cxl/core/region.c
>> +++ b/drivers/cxl/core/region.c
>> @@ -3345,6 +3345,22 @@ static int devm_cxl_add_dax_region(struct
>> cxl_region *cxlr) return rc;
>> }
>>
>> +int cxl_accel_get_region_params(struct cxl_region *region,
>> + resource_size_t *start,
>> resource_size_t *end) +{
>> + if (!region)
>> + return -ENODEV;
>> +
>> + if (!region->params.res) {
>> + return -ENODEV;
>> + }
> Remove the extra {}
>
Sure.
Thanks!
>> + *start = region->params.res->start;
>> + *end = region->params.res->end;
>> +
>> + return 0;
>> +}
>> +EXPORT_SYMBOL_NS_GPL(cxl_accel_get_region_params, CXL);
>> +
>> static int match_root_decoder_by_range(struct device *dev, void
>> *data) {
>> struct range *r1, *r2 = data;
>> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
>> index 1bf3b74ff959..b4c4c4455ef1 100644
>> --- a/drivers/cxl/cxl.h
>> +++ b/drivers/cxl/cxl.h
>> @@ -906,6 +906,9 @@ void cxl_coordinates_combine(struct
>> access_coordinate *out, bool
>> cxl_endpoint_decoder_reset_detected(struct cxl_port *port);
>> int cxl_region_detach(struct cxl_endpoint_decoder *cxled);
>> +
>> +int cxl_accel_get_region_params(struct cxl_region *region,
>> + resource_size_t *start,
>> resource_size_t *end); /*
>> * Unit test builds overrides this to __weak, find the 'strong'
>> version
>> * of these symbols in tools/testing/cxl/.
>> diff --git a/include/linux/cxl_accel_mem.h
>> b/include/linux/cxl_accel_mem.h index a5f9ffc24509..5d715eea6e91
>> 100644 --- a/include/linux/cxl_accel_mem.h
>> +++ b/include/linux/cxl_accel_mem.h
>> @@ -53,4 +53,6 @@ struct cxl_region *cxl_create_region(struct
>> cxl_root_decoder *cxlrd, int ways);
>>
>> int cxl_region_detach(struct cxl_endpoint_decoder *cxled);
>> +int cxl_accel_get_region_params(struct cxl_region *region,
>> + resource_size_t *start,
>> resource_size_t *end); #endif
Powered by blists - more mailing lists