From: Dave Jiang <dave.jiang@intel.com>
To: Richard Cheng <icheng@nvidia.com>,
dave@stgolabs.net, jic23@kernel.org, alison.schofield@intel.com,
vishal.l.verma@intel.com, djbw@kernel.org,
danwilliams@nvidia.com
Cc: iweiny@kernel.org, ming.li@zohomail.com, gourry@gourry.net,
rrichter@amd.com, linux-cxl@vger.kernel.org,
linux-kernel@vger.kernel.org, sreddym@nvidia.com,
smadhavan@nvidia.com, kaihengf@nvidia.com, kobak@nvidia.com,
newtonl@nvidia.com, kristinc@nvidia.com, mochs@nvidia.com
Subject: Re: [PATCH] cxl/region: Restore passthrough decoder enable on region re-assembly
Date: Mon, 27 Jul 2026 13:25:48 -0700 [thread overview]
Message-ID: <d96567c3-df6f-4008-9678-c4fed3787309@intel.com> (raw)
In-Reply-To: <20260727103743.63343-1-icheng@nvidia.com>
On 7/27/26 3:37 AM, Richard Cheng wrote:
> After a CXL endpoint is PCI hot-removed and the bus rescanned, an
> auto-discovered region fails to rebiuld and is lost, evne though the
rebuild
even
> device's HDM decoder is still committed and decoding.
If we truly do a PCI hot-remove and re-insert, the endpoint device would be reset and disabled. Not sure how it would still be decoding. Also, a complete different device with possibly different size can be inserted. And the device showed up would be unconfigured. Given there's no BIOS to program the device since the OS has taken over, should it be still considered part of the auto-region?
Any thoughts Jonathan?
>
> A single-dport host bridge/root port has no HDM decoder capability, so
> its switch decoder is a SW-only passthrough. Its CXL_DECODER_F_ENABLE
> flag is cleared on region teardown and never restored on rescan, so
> cxl_port_setup_targets() fails with -ENXIO.
>
> Re-enable the passthrough decoder when its interleave and HPA config
> still match the region, it holds no HW state.
>
> Signed-off-by: Richard Cheng <icheng@nvidia.com>
> ---
> drivers/cxl/core/region.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 1e211542b6b6..011ceb5bae79 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -1574,6 +1574,19 @@ static int cxl_port_setup_targets(struct cxl_port *port,
> }
>
> if (test_bit(CXL_REGION_F_AUTO, &cxlr->flags)) {
> + /*
> + * A passthrough switch decoder holds no HW decode state.
> + * It's CXL_DECODER_F_ENABLE flag is pure software bookkeeping
> + * that is cleared when the region is torn down. On auto-discovery
> + * re-assembly after a subsequent rescan the decode config still
> + * matches the region, so restore the flag rather than fail to
> + * rebuild a region that HW is in fact still decoding.
> + */
> + if (!cxld->commit && cxld->interleave_ways == iw &&
> + (iw <= 1 || cxld->interleave_granularity == ig) &&
> + spa_maps_hpa(p, &cxld->hpa_range))
> + cxld->flags |= CXL_DECODER_F_ENABLE;
> +
> if (cxld->interleave_ways != iw ||
> (iw > 1 && cxld->interleave_granularity != ig) ||
> !spa_maps_hpa(p, &cxld->hpa_range) ||
>
> base-commit: 4539944e515183668109bdf4d0c3d7d228383d88
next prev parent reply other threads:[~2026-07-27 20:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 10:37 Richard Cheng
2026-07-27 20:25 ` Dave Jiang [this message]
2026-07-28 3:03 ` Richard Cheng
2026-07-28 4:14 ` Gregory Price
2026-07-31 9:13 ` Richard Cheng
2026-07-28 14:25 ` Dave Jiang
2026-08-05 6:21 ` Richard Cheng
2026-08-05 6:55 ` Gregory Price
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=d96567c3-df6f-4008-9678-c4fed3787309@intel.com \
--to=dave.jiang@intel.com \
--cc=alison.schofield@intel.com \
--cc=danwilliams@nvidia.com \
--cc=dave@stgolabs.net \
--cc=djbw@kernel.org \
--cc=gourry@gourry.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=rrichter@amd.com \
--cc=smadhavan@nvidia.com \
--cc=sreddym@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
all inboxes | Powered by JetHome®