All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dan Williams (nvidia)" <djbw@kernel.org>
To: Richard Cheng <icheng@nvidia.com>,
	 dave@stgolabs.net,  jic23@kernel.org,  dave.jiang@intel.com,
	 alison.schofield@intel.com,  vishal.l.verma@intel.com,
	 djbw@kernel.org,  iweiny@kernel.org,  danwilliams@nvidia.com
Cc: ming.li@zohomail.com,  terry.bowman@amd.com,  alucerop@amd.com,
	 linux-cxl@vger.kernel.org,  linux-kernel@vger.kernel.org,
	 newtonl@nvidia.com,  kristinc@nvidia.com,  kaihengf@nvidia.com,
	 kobak@nvidia.com,  mochs@nvidia.com,
	 Richard Cheng <icheng@nvidia.com>,
	 Vishal Aslot <vaslot@nvidia.com>
Subject: Re: [PATCH v5 1/2] cxl/hdm: Allow zero sized HDM decoders
Date: Tue, 23 Jun 2026 13:13:40 -0700	[thread overview]
Message-ID: <6a3ae8f486d0e_3c9f100bd@djbw-dev.notmuch> (raw)
In-Reply-To: <20260623091019.33417-2-icheng@nvidia.com>

Richard Cheng wrote:
> CXL r4.0 §8.2.4.20.12 ("Committing Decoder Programming") and §14.13.10
> ("CXL HDM Decoder Zero Size Commit") permit committing an HDM decoder
> with size 0. BIOS may commit and lock such decoders so the OS cannot
> program regions through them, this is a design choice rather than a spec
> requirement.
> The kernel rejected these with -ENXIO during port enumeration and aborted
> the whole port, so affected systems showed nothing under 'cxl list'.
> 
> Treat empty decoders as first class instead of special casing them, back
> them with a kmalloc'd resource, since the resource tree can't represent
> an empty range, and keep the skip and hdm_end accounting intact. Guard
> the paths an empty decoder can't serve, e.g. region attach, DPA free, and
> poison queries.
> 
> Suggested-by: Dan Williams <djbw@kernel.org>
> Signed-off-by: Vishal Aslot <vaslot@nvidia.com>
> Signed-off-by: Richard Cheng <icheng@nvidia.com>

Looks good, you added the cxled_empty() helper and dropped the dev_dbg()
announcing the arrival of committed empty decoders like we chatted
about.

The comment on cxled_empty() could use come adjustment, but maybe Dave
can fix that up on applying.

Reviewed-by: Dan Williams <djbw@kernel.org>

[..]
> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> index 1297594beaec..5231345ff78e 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -324,6 +324,15 @@ struct cxl_endpoint_decoder {
>  	int pos;
>  };
>  
> +/*
> + * Some BIOS use locked empty decoders to preclude HDM decode aliasing
> + * for TSP operation. Use cxled_empty() to handle that common case.
> + */

Hmm, that is not the "common case".

/*
 * The common case is decoders with no reservation, but also handle
 * decoders with a zero-sized reservation that firmware may install for
 * security lockdown purposes.
 */

> +static inline bool cxled_empty(struct cxl_endpoint_decoder *cxled)
> +{
> +	return !cxled->dpa_res || !resource_size(cxled->dpa_res);
> +}
> +
>  /**
>   * struct cxl_switch_decoder - Switch specific CXL HDM Decoder
>   * @cxld: base cxl_decoder object

  parent reply	other threads:[~2026-06-23 20:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23  9:10 [PATCH v5 0/2] Support zero-sized HDM decoders Richard Cheng
2026-06-23  9:10 ` [PATCH v5 1/2] cxl/hdm: Allow zero sized " Richard Cheng
2026-06-23  9:37   ` sashiko-bot
2026-06-23 19:55     ` Dan Williams (nvidia)
2026-06-23 20:13   ` Dan Williams (nvidia) [this message]
2026-06-23  9:10 ` [PATCH v5 2/2] tools/testing/cxl: Enable zero sized decoders under hb0 Richard Cheng

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=6a3ae8f486d0e_3c9f100bd@djbw-dev.notmuch \
    --to=djbw@kernel.org \
    --cc=alison.schofield@intel.com \
    --cc=alucerop@amd.com \
    --cc=danwilliams@nvidia.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=icheng@nvidia.com \
    --cc=iweiny@kernel.org \
    --cc=jic23@kernel.org \
    --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=mochs@nvidia.com \
    --cc=newtonl@nvidia.com \
    --cc=terry.bowman@amd.com \
    --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 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.