lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <45b9e636-d611-4e81-9f3d-ce23df2fac0d@intel.com>
Date: Mon, 15 Sep 2025 09:26:52 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: Robert Richter <rrichter@....com>
Cc: Alison Schofield <alison.schofield@...el.com>,
 Vishal Verma <vishal.l.verma@...el.com>, Ira Weiny <ira.weiny@...el.com>,
 Dan Williams <dan.j.williams@...el.com>,
 Jonathan Cameron <Jonathan.Cameron@...wei.com>,
 Davidlohr Bueso <dave@...olabs.net>, linux-cxl@...r.kernel.org,
 linux-kernel@...r.kernel.org, Gregory Price <gourry@...rry.net>,
 "Fabio M. De Francesco" <fabio.m.de.francesco@...ux.intel.com>,
 Terry Bowman <terry.bowman@....com>, Joshua Hahn <joshua.hahnjy@...il.com>
Subject: Re: [PATCH v3 06/11] cxl/region: Separate region parameter setup and
 region construction



On 9/15/25 12:31 AM, Robert Richter wrote:
> On 12.09.25 14:10:06, Dave Jiang wrote:
>>
>>
>> On 9/12/25 7:45 AM, Robert Richter wrote:
>>> To construct a region, the region parameters such as address range and
>>> interleaving config need to be determined. This is done while
>>> constructing the region by inspecting the endpoint decoder
>>> configuration. The endpoint decoder is passed as a function argument.
>>>
>>> With address translation the endpoint decoder data is no longer
>>> sufficient to extract the region parameters as some of the information
>>> is obtained using other methods such as using firmware calls.
>>>
>>> In a first step, separate code to determine and setup the region
>>> parameters from the region construction. Temporarily store all the
>>> data to create the region in the new struct cxl_region_context. Add a
>>> new function setup_region_parameters() to fill that struct and later
>>> use it to construct the region. This simplifies the extension of the
>>> function to support other methods needed, esp. to support address
>>> translation.
>>>
>>> Patch is a prerequisite to implement address translation.
>>>
>>> Signed-off-by: Robert Richter <rrichter@....com>
>>> ---
>>>  drivers/cxl/core/region.c | 50 +++++++++++++++++++++++++++++----------
>>>  1 file changed, 38 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
>>> index 106692f1e310..57697504410b 100644
>>> --- a/drivers/cxl/core/region.c
>>> +++ b/drivers/cxl/core/region.c
>>> @@ -3414,6 +3414,26 @@ static int match_region_by_range(struct device *dev, const void *data)
>>>  	return 0;
>>>  }
>>>  
>>> +struct cxl_region_context {
>>> +	struct cxl_endpoint_decoder *cxled;
>>> +	struct cxl_memdev *cxlmd;
>>> +	struct range hpa_range;
>>> +	int interleave_ways;
>>> +	int interleave_granularity;
>>> +};
>>> +
>>> +static int setup_region_params(struct cxl_endpoint_decoder *cxled,
>>> +			       struct cxl_region_context *ctx)
>>> +{
>>> +	ctx->cxled = cxled;
>>> +	ctx->cxlmd = cxled_to_memdev(cxled);
>>> +	ctx->hpa_range = cxled->cxld.hpa_range;
>>> +	ctx->interleave_ways = cxled->cxld.interleave_ways;
>>> +	ctx->interleave_granularity = cxled->cxld.interleave_granularity;
>>
>> You can init like this:
>>
>> 	*ctx = (struct cxl_region_context) {
>> 		.cxled = cxled,
>> 		.cxlmd = cxled_to_memdev(cxled),
>> 		.hpa_range = cxled->cxld.hpa_range,
>> 		.interleave_ways = cxled->cxld.interleave_ways,
>> 		.interleave_granularity = cxled->cxld.interleave_granularity,
>> 	};
> 
> Will change that for readability and to zero-init possibly missing
> members.
> 
>>
>>
>>> +
>>> +	return 0;
>>
>> Can probably make this function void if no expected errors and only assignments.
> 
> A later extension to the code may return an error code, so I prepared
> the function interface already for this.

I realized that when I saw it in the later patch. So please ignore the comment.

> 
> -Robert
> 
>>
>> DJ


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ