Linux CXL
 help / color / mirror / Atom feed
From: Gregory Price <gregory.price@memverge.com>
To: linux-cxl@vger.kernel.org
Cc: Dan Williams <dan.j.williams@intel.com>,
	Dave Jiang <dave.jiang@intel.com>
Subject: Re: [BUG] Root port fails to match with port driver on non-RCH topology
Date: Thu, 15 Jun 2023 14:46:13 -0400	[thread overview]
Message-ID: <ZItcdaq3j8kW+/Sy@memverge.com> (raw)
In-Reply-To: <ZIs5Ra+9SGGbUZoZ@memverge.com>

On Thu, Jun 15, 2023 at 12:16:05PM -0400, Gregory Price wrote:
> Unfortunately, I added this as a hack, but it did not resolve the issue.
> 
> I'm a bit lost in the device-driver core trying to track down the exact
> path that is being taken, it's possible another subsequent error is
> occuring that subsequently fails as well.
> 
> 
> ~Gregory
> 
> 
> diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
> index 4d1f9c5b5029..7f99e4f790d8 100644
> --- a/drivers/cxl/core/port.c
> +++ b/drivers/cxl/core/port.c
> @@ -1853,7 +1853,9 @@ static int cxl_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
> 
>  static int cxl_bus_match(struct device *dev, struct device_driver *drv)
>  {
> -       return cxl_device_id(dev) == to_cxl_drv(drv)->id;
> +       int devid = cxl_device_id(dev);
> +       int drvid = to_cxl_drv(drv)->id
> +       return (devid == drvid) || (devid == CXL_DEVICE_ROOT && drvid == CXL_DEVICE_PORT);
>  }

follow up with more context, there is a subsequent error on
cxl_port_probe which causes dev->driver to remain NULL.


[   15.561313] cxl_mem mem0: CXL port topology root0 not enabled
[   15.561315] cxl_mem mem0: call_driver_probe failed


drivers/cxl/port.c
static int cxl_port_probe(struct device *dev)
{
    struct cxl_port *port = to_cxl_port(dev);

    if (is_cxl_endpoint(port))
        return cxl_endpoint_port_probe(port);
    return cxl_switch_port_probe(port);
}


since root is not an endpoint, we probe root as a switch port.

static int cxl_switch_port_probe(struct cxl_port *port)
{
    struct cxl_hdm *cxlhdm;
    int rc;

    rc = devm_cxl_port_enumerate_dports(port);
    if (rc < 0)
        return rc;

    if (rc == 1)
        return devm_cxl_add_passthrough_decoder(port);

    cxlhdm = devm_cxl_setup_hdm(port, NULL);
    if (IS_ERR(cxlhdm))
        return PTR_ERR(cxlhdm);

    return devm_cxl_enumerate_decoders(cxlhdm, NULL);
}


It is likely that dev_cxl_port_enumate_dports is failing, though more
investigation is needed at this point.

What I don't know is whether cxl_port_probe is intended to probe the
root port, or if we should simply be attaching the driver to the root
port device explicitly rather than going through probe.

Any guidance would be appreciated.

~Gregory

  reply	other threads:[~2023-06-15 18:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15 16:16 [BUG] Root port fails to match with port driver on non-RCH topology Gregory Price
2023-06-15 18:46 ` Gregory Price [this message]
2023-06-15 18:51   ` Gregory Price
2023-06-15 22:43     ` Gregory Price
2023-06-22  9:48       ` Jonathan Cameron
2023-06-22 14:47         ` 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=ZItcdaq3j8kW+/Sy@memverge.com \
    --to=gregory.price@memverge.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox