All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Cheng <icheng@nvidia.com>
To: sashiko-reviews@lists.linux.dev
Cc: Davidlohr Bueso <dave@stgolabs.net>, linux-cxl@vger.kernel.org
Subject: Re: [PATCH 1/5] cxl: Add BI register probing and port initialization
Date: Fri, 5 Jun 2026 10:03:11 +0800	[thread overview]
Message-ID: <aiItL9wmNPDafyFG@MWDK4CY14F> (raw)
In-Reply-To: <20260605013307.DA9421F00898@smtp.kernel.org>

On Fri, Jun 05, 2026 at 01:33:07AM +0800, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Silent failure to map and configure CXL BI Route Table due to probe sequence mismatch
> --
> 
> commit 34d3cc24691a25107f1dbbcc8e03fc18ffcae164
> Author: Davidlohr Bueso <dave@stgolabs.net>
> 
> cxl: Add BI register probing and port initialization
> 
> This commit adds register probing for BI Route Table and BI Decoder capability
> structures. It introduces helpers to map these structures at dport-creation
> time and port probe time.
> 
> > diff --git a/drivers/cxl/port.c b/drivers/cxl/port.c
> > index ada51948d52fa..2dd712c5d312a 100644
> > --- a/drivers/cxl/port.c
> > +++ b/drivers/cxl/port.c
> [ ... ]
> > @@ -58,6 +58,62 @@ static int discover_region(struct device *dev, void *unused)
> [ ... ]
> > +static void cxl_port_map_bi(struct cxl_port *port)
> > +{
> > +	struct cxl_register_map *map = &port->reg_map;
> [ ... ]
> > +	/* map this port's own BI capability */
> > +	if (is_cxl_endpoint(port)) {
> > +		if (!map->component_map.bi_decoder.valid) {
> > +			dev_dbg(&port->dev, "BI Decoder registers not found\n");
> > +			return;
> > +		}
> > +		cap_id = CXL_CM_CAP_CAP_ID_BI_DECODER;
> > +	} else {
> > +		if (!map->component_map.bi_rt.valid) {
> > +			dev_dbg(&port->dev, "BI RT registers not found\n");
> > +			return;
> > +		}
> 
> [Severity: High]
> Does this silently fail to map the BI Route Table registers for switch
> ports?
> 
> When called from cxl_switch_port_probe(), the component registers have not
> been discovered yet. The registers are actually probed and marked valid when
> the first downstream port is added, which triggers cxl_port_add_dport() to call
> cxl_port_setup_regs().
> 
> Because the valid flag is always false here during switch port probe, the map
> function returns early and permanently leaves port->regs.bi_rt unmapped. Will
> this bypass the required hardware commit protocol for the switch upstream port
> and break Back-Invalidate coherency for downstream endpoints?
> 
> > +		cap_id = CXL_CM_CAP_CAP_ID_BI_RT;
> > +	}
> > +
> > +	map->host = &port->dev;
> > +	if (cxl_map_component_regs(map, &port->regs, BIT(cap_id)))
> > +		dev_dbg(&port->dev, "Failed to map BI capability 0x%x\n",
> > +			cap_id);
> > +}
> > +
> >  static int cxl_switch_port_probe(struct cxl_port *port)
> >  {
> >  	/* Reset nr_dports for rebind of driver */
> [ ... ]
> > @@ -66,6 +122,8 @@ static int cxl_switch_port_probe(struct cxl_port *port)
> >  	/* Cache the data early to ensure is_visible() works */
> >  	read_cdat_data(port);
> >  
> > +	cxl_port_map_bi(port);
> > +
> >  	return 0;
> >  }
>

Hi Davidlohr,

cxl_port_map_bi() is called here before any dport exists.
Component register discovery happends later in cxl_port_add_dport() and then
cxl_port_setup_regs() on the first dport.

So for switch USP, bi_rt.valid is false at probe time, mapping is skipped
and never retried. I saw from your cover letter's dmesg

"""
cxl_port port2: BI RT registers not found   ← probe-time map_bi
...
cxl_port port2: found BI RT capability      ← later, on first dport
"""

Endpoints and RP/DSP paths are fine, but switch BI RT mapping might
be the gap.

Let me know what you think, please correct me if I'm wrong, thanks


Best regards,
Richard Cheng.
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260605003329.2584012-1-dave@stgolabs.net?part=1
> 

  reply	other threads:[~2026-06-05  2:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-05  0:33 [PATCH v4 0/5] cxl: Support Back-Invalidate Davidlohr Bueso
2026-06-05  0:33 ` [PATCH 1/5] cxl: Add BI register probing and port initialization Davidlohr Bueso
2026-06-05  1:33   ` sashiko-bot
2026-06-05  2:03     ` Richard Cheng [this message]
2026-06-05  0:33 ` [PATCH 2/5] cxl/pci: Add BI topology enable/disable Davidlohr Bueso
2026-06-05  1:29   ` sashiko-bot
2026-06-05  2:11     ` Richard Cheng
2026-06-05  2:20     ` Richard Cheng
2026-06-05  2:23   ` Richard Cheng
2026-06-05  0:33 ` [PATCH 3/5] cxl/hdm: Add BI coherency support for endpoint decoders Davidlohr Bueso
2026-06-05  0:33 ` [PATCH 4/5] cxl: Add HDM-DB region creation Davidlohr Bueso
2026-06-05  1:34   ` sashiko-bot
2026-06-05  2:37   ` Richard Cheng
2026-06-05 19:23     ` Davidlohr Bueso
2026-06-05  0:33 ` [PATCH 5/5] cxl/hdm: Rename decoder coherency flags Davidlohr Bueso
2026-06-05  2:38 ` [PATCH v4 0/5] cxl: Support Back-Invalidate 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=aiItL9wmNPDafyFG@MWDK4CY14F \
    --to=icheng@nvidia.com \
    --cc=dave@stgolabs.net \
    --cc=linux-cxl@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.