All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alison Schofield" <alison.schofield@intel.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH 2/6] cxl/region: Derive port granularity from selector bits
Date: Sat, 30 May 2026 00:26:13 +0000	[thread overview]
Message-ID: <20260530002613.682E71F00893@smtp.kernel.org> (raw)
In-Reply-To: <4feca2a522e1e380495f22742551dec230ff0618.1780095671.git.alison.schofield@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Passthrough decoders (`iw == 1`) in deep topologies fail to configure because calculated `ig` exceeds software limits, breaking valid configurations.
--

commit 0b56c23b98964cba7ba9487773eeb9e989d957d3
Author: Alison Schofield <alison.schofield@intel.com>

cxl/region: Derive port granularity from selector bits

Selector-bit validation uses a single same-granularity formula for
user-created regions. This commit changes the layout rules to derive
the programmed port granularity from selector bits, which lets an
interleaving switch beneath a mixed-granularity root claim inner
selector bits instead of colliding.

> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 87fb1a9f2683f..9d310287d48dc 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -1548,7 +1548,23 @@ static int cxl_port_setup_targets(struct cxl_port *port,
>  		goto add_target;
>  	}
>  
> -	ig = p->interleave_granularity * parent_distance;
> +	/*
> +	 * Auto regions keep the firmware value, passthrough decoders consume
> +	 * no selector bits, interleaving decoders claim the lowest available
> +	 * selector bit.
> +	 */
> +	if (test_bit(CXL_REGION_F_AUTO, &cxlr->flags)) {
> +		ig = cxld->interleave_granularity;
> +	} else if (iw == 1) {
> +		ig = p->interleave_granularity * parent_distance;

[Severity: High]
This is a pre-existing issue, but does this calculation break passthrough
decoders in deep topologies?

If we have a large root interleave width (e.g., an 8-way root),
parent_distance evaluates to 8. For a standard 4K base region granularity,
ig is calculated as 4096 * 8 = 32768.

Later in cxl_port_setup_targets(), we unconditionally call:

	rc = ways_to_eiw(iw, &eiw);
	if (!rc)
		rc = granularity_to_eig(ig, &eig);
	if (rc) {
		...
		return rc;
	}

And granularity_to_eig() explicitly checks for `granularity > SZ_16K`
returning -EINVAL. Since hardware ignores interleave granularity for
passthrough decoders (iw == 1), this seems to artificially reject valid
hardware topologies by failing the configuration.

> +	} else if (selector) {
> +		ig = 1ULL << __ffs64(selector);
> +	} else {
> +		dev_dbg(&cxlr->dev,
> +			"%s:%s: no selector bits available for iw %d\n",
> +			dev_name(port->uport_dev), dev_name(&port->dev), iw);
> +		return -ENXIO;
> +	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1780095671.git.alison.schofield@intel.com?part=2

  reply	other threads:[~2026-05-30  0:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-30  0:00 [PATCH 0/6] cxl: Support mixed-granularity region interleaves Alison Schofield
2026-05-30  0:00 ` [PATCH 1/6] cxl/region: Validate interleave selector bits Alison Schofield
2026-05-30  0:19   ` sashiko-bot
2026-05-30  0:00 ` [PATCH 2/6] cxl/region: Derive port granularity from " Alison Schofield
2026-05-30  0:26   ` sashiko-bot [this message]
2026-06-03 23:51   ` Dave Jiang
2026-05-30  0:00 ` [PATCH 3/6] cxl/region: Account for mixed-granularity in position calculations Alison Schofield
2026-05-30  0:00 ` [PATCH 4/6] cxl/region: Validate mixed-granularity at sysfs and attach gates Alison Schofield
2026-06-03 23:55   ` Dave Jiang
2026-05-30  0:00 ` [PATCH 5/6] cxl/test: Add a topology to test mixed-granularity regions Alison Schofield
2026-05-30  5:17   ` sashiko-bot
2026-06-04  0:04   ` Dave Jiang
2026-05-30  0:00 ` [PATCH 6/6] Documentation/cxl: Add region granularity and multi-level interleave guide Alison Schofield
2026-06-03 23:57   ` Dave Jiang
2026-06-04  3:47   ` kernel test robot

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=20260530002613.682E71F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alison.schofield@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.