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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250214163346.00007ade@huawei.com>
Date: Fri, 14 Feb 2025 16:33:46 +0000
From: Jonathan Cameron <Jonathan.Cameron@...wei.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>, Dave Jiang <dave.jiang@...el.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>
Subject: Re: [PATCH v3 14/18] cxl/region: Unfold cxl_find_root_decoder()
 into cxl_endpoint_decoder_initialize()

On Tue, 11 Feb 2025 10:53:44 +0100
Robert Richter <rrichter@....com> wrote:

> To determine other endpoint parameters such as interleaving parameters
> during endpoint initialization, the iterator function in
> cxl_find_root_decoder() can be used. Unfold this function into
> cxl_endpoint_decoder_initialize() and make the iterator available
> there.
I'm not following this description at all. Perhaps this needs
to wait until you have code that is reusing this to find those
interleave parameters and similar.

For now it just looks like a sensible bit of cleanup where there
was just a single caller of cxl_find_root_decoder()

> 
> Signed-off-by: Robert Richter <rrichter@....com>
> Reviewed-by: Gregory Price <gourry@...rry.net>
> Tested-by: Gregory Price <gourry@...rry.net>
> ---
>  drivers/cxl/core/region.c | 24 +++++-------------------
>  1 file changed, 5 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 72e991e7d9ab..ebcfbfe9eafc 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -3220,8 +3220,7 @@ cxl_port_find_switch_decoder(struct cxl_port *port, struct range *hpa)
>  	return cxld_dev ? to_cxl_decoder(cxld_dev) : NULL;
>  }
>  
> -static struct cxl_root_decoder *
> -cxl_find_root_decoder(struct cxl_endpoint_decoder *cxled)
> +static int cxl_endpoint_decoder_initialize(struct cxl_endpoint_decoder *cxled)
>  {
>  	struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
>  	struct cxl_port *iter = cxled_to_port(cxled);
> @@ -3232,7 +3231,7 @@ cxl_find_root_decoder(struct cxl_endpoint_decoder *cxled)
>  		iter = to_cxl_port(iter->dev.parent);
>  
>  	if (!iter)
> -		return NULL;
> +		return -ENXIO;
>  
>  	root = cxl_port_find_switch_decoder(iter, hpa);
>  	if (!root) {
> @@ -3240,12 +3239,12 @@ cxl_find_root_decoder(struct cxl_endpoint_decoder *cxled)
>  			"%s:%s no CXL window for range %#llx:%#llx\n",
>  			dev_name(&cxlmd->dev), dev_name(&cxld->dev),
>  			cxld->hpa_range.start, cxld->hpa_range.end);
> -		return NULL;
> +		return -ENXIO;
>  	}
>  
> +	cxled->cxlrd = to_cxl_root_decoder(&root->dev);
>  
> -
> -	return to_cxl_root_decoder(&root->dev);
> +	return 0;
>  }
>  
>  static int match_region_by_range(struct device *dev, const void *data)
> @@ -3370,19 +3369,6 @@ static struct cxl_region *construct_region(struct cxl_root_decoder *cxlrd,
>  	return ERR_PTR(rc);
>  }
>  
> -static int cxl_endpoint_decoder_initialize(struct cxl_endpoint_decoder *cxled)
> -{
> -	struct cxl_root_decoder *cxlrd;
> -
> -	cxlrd = cxl_find_root_decoder(cxled);
> -	if (!cxlrd)
> -		return -ENXIO;
> -
> -	cxled->cxlrd = cxlrd;
> -
> -	return 0;
> -}
> -
>  static int cxl_endpoint_decoder_add(struct cxl_endpoint_decoder *cxled)
>  {
>  	struct range *hpa = &cxled->cxld.hpa_range;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ