The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* Re: [PATCH v1 1/2] cxl_test: enable zero sized decoders under hb0
       [not found] <aYynWqJ7u-v-6WsZ@gourry-fedora-PF4VCD3F>
@ 2026-05-08  4:00 ` Richard Cheng
  0 siblings, 0 replies; only message in thread
From: Richard Cheng @ 2026-05-08  4:00 UTC (permalink / raw)
  To: gourry, Vishal Aslot
  Cc: alison.schofield, dan.j.williams, dave.jiang, dave, ira.weiny,
	jonathan.cameron, linux-cxl, linux-kernel, ming.li, peterz,
	vishal.l.verma, newtonl, kristinc, kaihengf, kobak,
	Jonathan Cameron, Richard Cheng

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-08  4:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <aYynWqJ7u-v-6WsZ@gourry-fedora-PF4VCD3F>
2026-05-08  4:00 ` [PATCH v1 1/2] cxl_test: enable zero sized decoders under hb0 Richard Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox