All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alison Schofield <alison.schofield@intel.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
	Dave Jiang <dave.jiang@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ira Weiny <iweiny@kernel.org>, "Li Ming" <ming.li@zohomail.com>,
	Richard Cheng <icheng@nvidia.com>, <linux-cxl@vger.kernel.org>
Subject: Re: [PATCH 2/4] cxl: Add KUnit tests for HDM decoder encoding helpers
Date: Mon, 19 Oct 2026 14:09:14 -0700	[thread overview]
Message-ID: <ataG-ibFPWeYI0ZS@aschofie-mobl2.lan> (raw)
In-Reply-To: <20261016210137.64db4a14@jic23-hlaptop>

On Fri, Oct 16, 2026 at 09:01:37PM +0100, Jonathan Cameron wrote:
> On Tue, 13 Oct 2026 21:17:53 -0700
> Alison Schofield <alison.schofield@intel.com> wrote:
> 
> > The CXL subsystem has no KUnit infrastructure for testing self-contained
> > logic.
> > 
> > Introduce CONFIG_CXL_KUNIT_TEST and drivers/cxl/.kunitconfig, along with
> > an initial suite for the HDM decoder interleave encoding helpers. The
> > suite checks valid and invalid encodings and round-trip conversions.
> > 
> > Use a single Kconfig option for all CXL KUnit suites, with each suite
> > built as a separate module. This allows new suites to be added without
> > requiring additional configuration options.
> > 
> > The HDM decoder helpers provide a starting point for establishing the
> > location, naming, and configuration conventions for future CXL KUnit tests.
> > 
> > Suggested-by: Dave Jiang <dave.jiang@intel.com>
> > Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> 
> Just one thing inline for the only case where the test is exhaustive.
> Either way on that
> Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
> 
> > diff --git a/drivers/cxl/tests/hdm_encoding_kunit.c b/drivers/cxl/tests/hdm_encoding_kunit.c
> > new file mode 100644
> > index 000000000000..54a7cb078a06
> > --- /dev/null
> > +++ b/drivers/cxl/tests/hdm_encoding_kunit.c
> 
> > +
> > +/* Decoder Count field of the CXL HDM Decoder Capability Register */
> > +static void hdm_decoder_count(struct kunit *test)
> > +{
> > +	static const int expect[16] = {
> > +		1, 2, 4, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32,
> > +		-ENXIO, -ENXIO, -ENXIO,
> 
> Can we make the mapping of bit to value more explicit?
> 		[0x0] = 1,
> 		[0x1] = 2, [0x2] = 4, [0x3] = 6, [0x4] = 8,
> 		[0x5] = 10, [0x6] = 12, [0x7] = 14, [0x8] = 16,
> 		[0x9] = 20, [0xA] = 24, [0xB] = 28, [0xC] = 32,
> 		-ENXIO, -ENXIO, -ENXIO,
> //hex is to match spec that just lists these one by one by hex value.

Thanks Jonathan!

Added to my v2 prep but w a different handling of those trailing ENXIO's 

static const int expect[16] = {
	[0x0] = 1,
	[0x1] = 2, [0x2] = 4, [0x3] = 6, [0x4] = 8,
	[0x5] = 10, [0x6] = 12, [0x7] = 14, [0x8] = 16,
	[0x9] = 20, [0xA] = 24, [0xB] = 28, [0xC] = 32,
	[0xD ... 0xF] = -ENXIO,
};

-- Alison


  reply	other threads:[~2026-10-19 21:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  4:17 [PATCH 0/4] cxl: Add KUnit tests and documentation Alison Schofield
2026-10-14  4:17 ` [PATCH 1/4] Documentation/driver-api/cxl: Add a testing page Alison Schofield
2026-10-14 21:34   ` Alison Schofield
2026-10-16 19:02     ` Jonathan Cameron
2026-10-16 19:01   ` Jonathan Cameron
2026-10-19 20:44     ` Alison Schofield
2026-10-16 22:52   ` Anisa Su
2026-10-19 20:39     ` Alison Schofield
2026-10-14  4:17 ` [PATCH 2/4] cxl: Add KUnit tests for HDM decoder encoding helpers Alison Schofield
2026-10-15  9:16   ` Li Ming
2026-10-16 20:01   ` Jonathan Cameron
2026-10-19 21:09     ` Alison Schofield [this message]
2026-10-14  4:17 ` [PATCH 3/4] cxl/mbox: Treat unknown device return codes as errors Alison Schofield
2026-10-14 15:06   ` 黄高彬
2026-10-15  9:22   ` Li Ming
2026-10-19 21:01     ` Alison Schofield
2026-10-20  2:35       ` Li Ming
2026-10-16 20:03   ` Jonathan Cameron
2026-10-14  4:17 ` [PATCH 4/4] cxl/mbox: Add KUnit tests for cxl_internal_send_cmd() Alison Schofield
2026-10-15  9:37   ` Li Ming
2026-10-19 21:22     ` Alison Schofield
2026-10-20  2:34       ` Li Ming
2026-10-14 20:52 ` [PATCH 0/4] cxl: Add KUnit tests and documentation Dave Jiang

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=ataG-ibFPWeYI0ZS@aschofie-mobl2.lan \
    --to=alison.schofield@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=icheng@nvidia.com \
    --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 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.