Linux CXL
 help / color / mirror / Atom feed
From: Richard Cheng <icheng@nvidia.com>
To: Alison Schofield <alison.schofield@intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
	 Jonathan Cameron <jic23@kernel.org>,
	Dave Jiang <dave.jiang@intel.com>,
	 Vishal Verma <vishal.l.verma@intel.com>,
	Ira Weiny <iweiny@kernel.org>, Li Ming <ming.li@zohomail.com>,
	 linux-cxl@vger.kernel.org
Subject: Re: [PATCH 2/3] tools/testing/cxl: Skip the auto region when no volatile window is active
Date: Wed, 30 Sep 2026 15:33:20 +0800	[thread overview]
Message-ID: <ary6WmhJk6PWhn0U@MWDK4CY14F> (raw)
In-Reply-To: <ccc11aec8658ff29e604aded94ac4ce0da7b5fb8.1790641236.git.alison.schofield@intel.com>

On Mon, Sep 28, 2026 at 05:56:17PM +0800, Alison Schofield wrote:
> The mock auto region always uses CFMWS0. With XOR interleave arithmetic
> that window is inactive, so its HPA base is never assigned and the
> endpoint decoders are programmed at HPA 0.
> 
> No root decoder matches that range, leaving DPA allocated to endpoint
> decoders that are not part of a region.
> 
> Set up the auto region only when a volatile window is active.
> 
> Assisted-by: LLM
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> ---
>  tools/testing/cxl/test/cxl.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
> index aa140307e0c3..9d844932f0c6 100644
> --- a/tools/testing/cxl/test/cxl.c
> +++ b/tools/testing/cxl/test/cxl.c
> @@ -423,6 +423,18 @@ struct acpi_cedt_cxims *mock_cxims[1] = {
>  	[0] = &mock_cedt.cxims0.cxims,
>  };
>  
> +static struct acpi_cedt_cfmws *mock_auto_region_cfmws(void)
> +{
> +	for (int i = cfmws_start; i <= cfmws_end; i++) {
> +		struct acpi_cedt_cfmws *window = mock_cfmws[i];
> +
> +		if (window->restrictions & ACPI_CEDT_CFMWS_RESTRICT_VOLATILE)
> +			return window;
> +	}
> +
> +	return NULL;
> +}
> +
>  struct cxl_mock_res {
>  	struct list_head list;
>  	struct range range;
> @@ -1114,6 +1126,10 @@ static enum cxld_init_type get_decoder_init_type(struct cxl_decoder *cxld,
>  	    pdev->id > 4 || cxld->id > 0)
>  		return MOCK_DECODER_INIT_DEFAULT;
>  
> +	/* XOR windows are all pmem, no window to host the RAM region */
> +	if (!mock_auto_region_cfmws())
> +		return MOCK_DECODER_INIT_DEFAULT;
> +
>  	return type2_test ? MOCK_DECODER_INIT_TYPE2_AUTO :
>  			    MOCK_DECODER_INIT_TYPE3_AUTO;
>  }
> @@ -1137,7 +1153,7 @@ static bool mock_decoder_handle_saved(struct cxl_decoder *cxld, struct cxl_test_
>  static void mock_init_hdm_type2_cxled(struct cxl_endpoint_decoder *cxled,
>  				      struct cxl_port *port)
>  {
> -	struct acpi_cedt_cfmws *window = mock_cfmws[0];
> +	struct acpi_cedt_cfmws *window = mock_auto_region_cfmws();
>  	struct cxl_decoder *cxld = &cxled->cxld;
>  	struct cxl_switch_decoder *cxlsd;
>  	struct cxl_dport *dport;
> @@ -1211,7 +1227,7 @@ static void mock_init_hdm_type3_cxled(struct cxl_endpoint_decoder *cxled,
>  				      struct platform_device *pdev,
>  				      bool hb0)
>  {
> -	struct acpi_cedt_cfmws *window = mock_cfmws[0];
> +	struct acpi_cedt_cfmws *window = mock_auto_region_cfmws();
>  	struct cxl_decoder *cxld = &cxled->cxld;
>  	struct cxl_switch_decoder *cxlsd;
>  	struct cxl_dport *dport;
> -- 
> 2.37.3
>

Hi Alison,

The caller of get_decoder_init_type() and mock_init_hdm_type2/3_cxled()
is mock_init_hdm_decoder(), would it be possible to just call
mock_auto_region_cfmws() once and pass the window into each function ?

That way we can save some redundant traversal of entries.
Do you think this idea makes sense ?

Best regards,
Richard Cheng.

  reply	other threads:[~2026-09-30  7:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29  0:56 [PATCH 0/3] cxl/test: mock fixups and new topology support Alison Schofield
2026-09-29  0:56 ` [PATCH 1/3] tools/testing/cxl: Preserve DPA skip across mock decoder reset Alison Schofield
2026-09-29 10:11   ` Richard Cheng
2026-09-29  0:56 ` [PATCH 2/3] tools/testing/cxl: Skip the auto region when no volatile window is active Alison Schofield
2026-09-30  7:33   ` Richard Cheng [this message]
2026-10-09 21:45     ` Alison Schofield
2026-09-29  0:56 ` [PATCH 3/3] tools/testing/cxl: Add CFMWS windows for region selection tests Alison Schofield

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ary6WmhJk6PWhn0U@MWDK4CY14F \
    --to=icheng@nvidia.com \
    --cc=alison.schofield@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=iweiny@kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=ming.li@zohomail.com \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox