From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: <linux-cxl@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH 4/5] cxl/port: Scan single-target ports for decoders
Date: Mon, 17 Apr 2023 17:48:02 +0100 [thread overview]
Message-ID: <20230417174802.00005427@Huawei.com> (raw)
In-Reply-To: <168149845130.792294.3210421233937427962.stgit@dwillia2-xfh.jf.intel.com>
On Fri, 14 Apr 2023 11:54:11 -0700
Dan Williams <dan.j.williams@intel.com> wrote:
> Do not assume that a single-target port falls back to a passthrough
> decoder configuration. Scan for decoders and only fallback after probing
> that the HDM decoder capability is not present.
>
> One user visible affect of this bug is the inability to enumerate
> present CXL regions as the decoder settings for the present decoders are
> skipped.
>
> Fixes: d17d0540a0db ("cxl/core/hdm: Add CXL standard decoder enumeration to the core")
> Reported-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Link: http://lore.kernel.org/r/20230227153128.8164-1-Jonathan.Cameron@huawei.com
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
*Happy face*
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
> drivers/cxl/core/hdm.c | 5 +++--
> drivers/cxl/port.c | 18 +++++++++++++-----
> 2 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> index 6fdf7981ddc7..abe3877cfa63 100644
> --- a/drivers/cxl/core/hdm.c
> +++ b/drivers/cxl/core/hdm.c
> @@ -92,8 +92,9 @@ static int map_hdm_decoder_regs(struct cxl_port *port, void __iomem *crb,
>
> cxl_probe_component_regs(&port->dev, crb, &map.component_map);
> if (!map.component_map.hdm_decoder.valid) {
> - dev_err(&port->dev, "HDM decoder registers invalid\n");
> - return -ENXIO;
> + dev_dbg(&port->dev, "HDM decoder registers not implemented\n");
> + /* unique error code to indicate no HDM decoder capability */
> + return -ENODEV;
> }
>
> return cxl_map_component_regs(&port->dev, regs, &map,
> diff --git a/drivers/cxl/port.c b/drivers/cxl/port.c
> index 22a7ab2bae7c..eb57324c4ad4 100644
> --- a/drivers/cxl/port.c
> +++ b/drivers/cxl/port.c
> @@ -66,14 +66,22 @@ static int cxl_switch_port_probe(struct cxl_port *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))
> + if (!IS_ERR(cxlhdm))
> + return devm_cxl_enumerate_decoders(cxlhdm, NULL);
> +
> + if (PTR_ERR(cxlhdm) != -ENODEV) {
> + dev_err(&port->dev, "Failed to map HDM decoder capability\n");
> return PTR_ERR(cxlhdm);
> + }
> +
> + if (rc == 1) {
> + dev_dbg(&port->dev, "Fallback to passthrough decoder\n");
> + return devm_cxl_add_passthrough_decoder(port);
> + }
>
> - return devm_cxl_enumerate_decoders(cxlhdm, NULL);
> + dev_err(&port->dev, "HDM decoder capability not found\n");
> + return -ENXIO;
> }
>
> static int cxl_endpoint_port_probe(struct cxl_port *port)
>
>
next prev parent reply other threads:[~2023-04-17 16:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 18:53 [PATCH 0/5] cxl/hdm: Decoder enumeration fixes Dan Williams
2023-04-14 18:53 ` [PATCH 1/5] cxl/hdm: Fail upon detecting 0-sized decoders Dan Williams
2023-04-14 20:11 ` Alison Schofield
2023-04-14 21:19 ` Dave Jiang
2023-05-15 10:38 ` Jonathan Cameron
2023-04-14 18:54 ` [PATCH 2/5] cxl/hdm: Use 4-byte reads to retrieve HDM decoder base+limit Dan Williams
2023-04-14 20:32 ` Alison Schofield
2023-04-14 20:44 ` Dan Williams
2023-04-14 21:22 ` Dave Jiang
2023-05-15 10:46 ` Jonathan Cameron
2023-04-14 18:54 ` [PATCH 3/5] cxl/core: Drop unused io-64-nonatomic-lo-hi.h Dan Williams
2023-04-14 20:33 ` Alison Schofield
2023-04-14 21:22 ` Dave Jiang
2023-05-15 10:48 ` Jonathan Cameron
2023-04-14 18:54 ` [PATCH 4/5] cxl/port: Scan single-target ports for decoders Dan Williams
2023-04-14 20:55 ` Alison Schofield
2023-04-14 21:24 ` Dave Jiang
2023-04-17 16:48 ` Jonathan Cameron [this message]
2023-04-14 18:54 ` [PATCH 5/5] cxl/hdm: Add more HDM decoder debug messages at startup Dan Williams
2023-04-14 21:06 ` Alison Schofield
2023-04-14 21:25 ` Dave Jiang
2023-05-15 10:52 ` Jonathan Cameron
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=20230417174802.00005427@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=dan.j.williams@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=stable@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