All of lore.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: Richard Cheng <icheng@nvidia.com>
Cc: dave.jiang@intel.com, jic23@kernel.org,
	alison.schofield@intel.com, benjamin.cheatham@amd.com,
	alucerop@amd.com, dongjoo.seo1@samsung.com,
	linux-cxl@vger.kernel.org
Subject: Re: [PATCH v7 8/8] cxl: Allow auto-committed BI hdm decoders
Date: Thu, 3 Sep 2026 11:58:10 -0700	[thread overview]
Message-ID: <20260903185810.qph364d4rlpcjazy@offworld> (raw)
In-Reply-To: <anXH5vC_w-iu6_iB@MWDK4CY14F>

On Fri, 07 Aug 2026, Richard Cheng wrote:

>On Tue, Jul 28, 2026 at 07:41:36AM +0800, Davidlohr Bueso wrote:
>>  /* Enable or dealloc BI-ID changes in the given level of the topology. */
>>  static int __cxl_bi_ctrl_dport(struct cxl_dport *dport, bool enable)
>>  {
>> @@ -1127,6 +1139,16 @@ static int __cxl_bi_ctrl_dport(struct cxl_dport *dport, bool enable)
>>  		return 0;
>>  	case PCI_EXP_TYPE_DOWNSTREAM:
>>  		if (enable) {
>> +			/*
>> +			 * Adopt a dport that was already programmed and
>> +			 * committed by firmware: nothing new is enabled
>> +			 * below it, so no commit is due.
>> +			 */
>> +			if (FIELD_GET(CXL_BI_DECODER_CTRL_BI_ENABLE, ctrl) &&
>> +			    !FIELD_GET(CXL_BI_DECODER_CTRL_BI_FW, ctrl) &&
>> +			    cxl_bi_decoder_committed(bi))
>> +				return 0;
>> +
>
>Small question, when DSP's BI related registers are committed by FW, does it guaranteed
>that all the intermediate switch on the path are also committed with BI enabled ?

No, there are no guarantees at all for any of this. Please see below for details on the
most flexible way I could come up with.

...

>> @@ -3806,6 +3831,14 @@ static struct cxl_region *construct_region(struct cxl_root_decoder *cxlrd,
>>  	if (part < 0)
>>  		return ERR_PTR(-EBUSY);
>>
>> +	/* avoid UB */
>> +	if (cxled_committed_bi(cxled) && !cxl_root_decoder_is_bi(cxlrd)) {
>> +		dev_err(cxlmd->dev.parent,
>> +			"%s:%s BI decoder in a non-BI window\n",
>> +			dev_name(&cxlmd->dev), dev_name(&cxled->cxld.dev));
>> +		return ERR_PTR(-ENXIO);
>> +	}
>> +
>
>Should we also check the inverse mismatch case here ?
>
>if (!cxled_committed_bi() && cxl_root_decoder_is_bi()) {}
>
>thoughts ?

Yep, and the whole thing can be turned into:

if (cxled_committed_bi(cxled) != cxl_root_decoder_is_bi(cxlrd)) { }

...

>
>Hmmm just curious are intermediate switch are guaranteed to be valid in AUTO discovery
>scenario , seems that the implementation only checks DSP.

So overall I had been ignoring nested switches because all this
is quite unsupported in Linux.

But for v8 I went ahead and added support for this. Basically
for patch 2 I redid the dport ctrl to handle nr_bi with nested
switches (as opposed to just for root port).

Now, for this auto discovery, when an endpoint device detects
the BI Enable already there it will "adopt" already configured
switch(es) and rp as it goes up the hierarchy. If at any level
things are not already configured, this adoption is broken and
it will do the respective BI decoder programming/committing as
it always does. For all level(s) above, every DSP that requires
explicit commits gets one, even with the decoder already configured
and previously committed because the new device's BI-ID may or
may not be accounted for.

Thanks,
Davidlohr

      reply	other threads:[~2026-09-03 18:58 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28 14:41 [PATCH v7 0/8] cxl: Support Back-Invalidate Davidlohr Bueso
2026-07-28 14:41 ` [PATCH v7 1/8] cxl: Add BI register probing and port initialization Davidlohr Bueso
2026-08-04 21:13   ` Dave Jiang
2026-08-05  0:42   ` Alison Schofield
2026-08-05 10:41   ` Li Ming
2026-08-07  5:38   ` Richard Cheng
2026-08-09 20:06     ` Davidlohr Bueso
2026-07-28 14:41 ` [PATCH v7 2/8] cxl/pci: Add BI topology enable/disable Davidlohr Bueso
2026-07-28 15:16   ` sashiko-bot
2026-08-03 18:55     ` Davidlohr Bueso
2026-08-05 12:49   ` Li Ming
2026-08-05 13:33   ` Li Ming
2026-09-03  1:16     ` Davidlohr Bueso
2026-08-07  6:54   ` Richard Cheng
2026-09-03  0:12     ` Davidlohr Bueso
2026-07-28 14:41 ` [PATCH v7 3/8] cxl/hdm: Add BI coherency support for endpoint decoders Davidlohr Bueso
2026-07-28 15:26   ` sashiko-bot
2026-07-28 18:44     ` Davidlohr Bueso
2026-07-28 14:41 ` [PATCH v7 4/8] cxl: Add HDM-DB region creation Davidlohr Bueso
2026-08-04 22:28   ` Dave Jiang
2026-08-05  0:11   ` Alison Schofield
2026-08-05 19:10     ` Davidlohr Bueso
2026-08-07 11:50   ` Richard Cheng
2026-07-28 14:41 ` [PATCH v7 5/8] cxl/hdm: Rename decoder coherency flags Davidlohr Bueso
2026-08-05  1:13   ` Alison Schofield
2026-07-28 14:41 ` [PATCH v7 6/8] cxl/region: Log the coherency model at region creation Davidlohr Bueso
2026-08-04 22:51   ` Dave Jiang
2026-07-28 14:41 ` [PATCH v7 7/8] cxl/pci: Split BI capability probe from setup Davidlohr Bueso
2026-08-04 23:07   ` Dave Jiang
2026-07-28 14:41 ` [PATCH v7 8/8] cxl: Allow auto-committed BI hdm decoders Davidlohr Bueso
2026-07-28 15:46   ` sashiko-bot
2026-08-03 19:04     ` Davidlohr Bueso
2026-08-04 23:22   ` Dave Jiang
2026-08-05  0:51   ` Alison Schofield
2026-08-05 20:53     ` Davidlohr Bueso
2026-08-07 12:03   ` Richard Cheng
2026-09-03 18:58     ` Davidlohr Bueso [this message]

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=20260903185810.qph364d4rlpcjazy@offworld \
    --to=dave@stgolabs.net \
    --cc=alison.schofield@intel.com \
    --cc=alucerop@amd.com \
    --cc=benjamin.cheatham@amd.com \
    --cc=dave.jiang@intel.com \
    --cc=dongjoo.seo1@samsung.com \
    --cc=icheng@nvidia.com \
    --cc=jic23@kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    /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.