Linux CXL
 help / color / mirror / Atom feed
From: Richard Cheng <icheng@nvidia.com>
To: gourry@gourry.net, Vishal Aslot <vaslot@nvidia.com>
Cc: alison.schofield@intel.com, dan.j.williams@intel.com,
	dave.jiang@intel.com, dave@stgolabs.net, ira.weiny@intel.com,
	jonathan.cameron@huawei.com, linux-cxl@vger.kernel.org,
	linux-kernel@vger.kernel.org, ming.li@zohomail.com,
	peterz@infradead.org, vishal.l.verma@intel.com,
	newtonl@nvidia.com, kristinc@nvidia.com, kaihengf@nvidia.com,
	kobak@nvidia.com, Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Richard Cheng <icheng@nvidia.com>
Subject: Re: [PATCH v1 1/2] cxl_test: enable zero sized decoders under hb0
Date: Fri,  8 May 2026 12:00:36 +0800	[thread overview]
Message-ID: <20260508040036.16332-1-icheng@nvidia.com> (raw)
In-Reply-To: <aYynWqJ7u-v-6WsZ@gourry-fedora-PF4VCD3F>

On Tue, Oct 14, 2025 at 07:40:05PM -0700, Vishal Aslot wrote:
> The cxl core in linux updated to supported committed
> decoders of zero size, because this is allowed by
> the CXL spec.
>
> This patch updates cxl_test to enable decoders 1 and 2
> in the host-bridge 0 port, in a switch uport under hb0,
> and the endpoints ports with size zero simulating
> committed zero sized decoders.

Hi Vishal,

Thanks for the patch series, it resolve the issue I hit
from my end.


> +	cxled->state = CXL_DECODER_STATE_AUTO;

IMHO, CXL_DECODER_STATE_AUTO suggests the kernel auto-discovered and is
willing to auto-tear-down. For a locked BIOS-committed slot that is
explicitly not under kernel control, STATE_MANUAL seems closer to
the intent, or, if locked decoders need their own tracking.
Maybe worth at least a comment justifying AUTO here.

> +static void size_zero_mock_decoder_ep(struct cxl_decoder *cxld, u64 base)
> +{
> +	struct cxl_endpoint_decoder *cxled;
> +
> +	cxled = to_cxl_endpoint_decoder(&cxld->dev);
> +	cxld->hpa_range = (struct range){
> +		.start = base,
> +		.end = base - 1,  /* Size 0 */
> +	};
> +

Maybe something like the following to utilize DEFINE_RANGE() macro ?

"""
cxld->hpa_range = DEFINE_RANGE(base, base - 1);
"""

What do you think ?

> +	cxld->interleave_ways = 2;
> +	cxld->interleave_granularity = 4096;
> +	cxld->target_type = CXL_DECODER_HOSTONLYMEM;
> +	cxld->flags = CXL_DECODER_F_ENABLE;
> +	cxled->state = CXL_DECODER_STATE_AUTO;
> +	cxld->commit = mock_decoder_commit;
> +	cxld->reset = mock_decoder_reset;
> +}
> +
> +static void size_zero_mock_decoder_sw(struct device *dev, u64 base, int i)
> +{
> +	struct cxl_switch_decoder *cxlsd;
> +	struct cxl_decoder *cxld;
> +
> +	cxlsd = to_cxl_switch_decoder(dev);
> +	cxld = &cxlsd->cxld;
> +	cxld->flags = CXL_DECODER_F_ENABLE;
> +	cxld->target_type = CXL_DECODER_HOSTONLYMEM;
> +	if (i == 0)
> +		cxld->interleave_ways = 2;
> +	else
> +		cxld->interleave_ways = 1;
> +	cxld->interleave_granularity = 4096;
> +	cxld->hpa_range = (struct range) {
> +		.start = base,
> +		.end = base - 1, /* Size 0 */
> +	};

Ditto for DEFINE_RANGE() macro.

> +}
> +


Best regards,
Richard Cheng.


  reply	other threads:[~2026-05-08  4:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15  2:40 [PATCH v1 0/2] Support zero-sized decoders Vishal Aslot
2025-10-15  2:40 ` [PATCH v1 1/2] cxl_test: enable zero sized decoders under hb0 Vishal Aslot
2025-10-15 15:38   ` Dave Jiang
2025-10-20  7:09   ` Alison Schofield
2025-10-20 14:19     ` Gregory Price
2025-10-20 19:30       ` Alison Schofield
2025-10-20 21:22         ` Dave Jiang
2025-10-21 14:03         ` Gregory Price
2026-02-11 15:04           ` Gregory Price
2026-02-11 15:59             ` Gregory Price
2026-05-08  4:00               ` Richard Cheng [this message]
2025-10-15  2:40 ` [PATCH v1 2/2] cxl: Allow zero sized HDM decoders Vishal Aslot
2025-10-15 16:38   ` Dave Jiang
2025-10-20  6:46   ` 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=20260508040036.16332-1-icheng@nvidia.com \
    --to=icheng@nvidia.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=gourry@gourry.net \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=kaihengf@nvidia.com \
    --cc=kobak@nvidia.com \
    --cc=kristinc@nvidia.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.li@zohomail.com \
    --cc=newtonl@nvidia.com \
    --cc=peterz@infradead.org \
    --cc=vaslot@nvidia.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