From: Dan Williams <dan.j.williams@intel.com>
To: <alison.schofield@intel.com>,
Dan Williams <dan.j.williams@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Dave Jiang <dave.jiang@intel.com>,
Ben Widawsky <bwidawsk@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>
Cc: Alison Schofield <alison.schofield@intel.com>,
<linux-cxl@vger.kernel.org>
Subject: RE: [PATCH v13 3/9] cxl/mbox: Initialize the poison state
Date: Fri, 21 Apr 2023 20:22:07 -0700 [thread overview]
Message-ID: <644352df7db17_1b66294d9@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <9078d180769be28a5087288b38cdfc827cae58bf.1681838291.git.alison.schofield@intel.com>
alison.schofield@ wrote:
> From: Alison Schofield <alison.schofield@intel.com>
>
> Driver reads of the poison list are synchronized to ensure that a
> reader does not get an incomplete list because their request
> overlapped (was interrupted or preceded by) another read request
> of the same DPA range. (CXL Spec 3.0 Section 8.2.9.8.4.1). The
> driver maintains state information to achieve this goal.
>
> To initialize the state, first recognize the poison commands in
> the CEL (Command Effects Log). If the device supports Get Poison
> List, allocate a single buffer for the poison list and protect it
> with a lock.
>
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> ---
> drivers/cxl/core/mbox.c | 81 ++++++++++++++++++++++++++++++++++++++++-
> drivers/cxl/cxlmem.h | 34 +++++++++++++++++
> drivers/cxl/pci.c | 4 ++
> 3 files changed, 117 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index fd1026970d3a..17737386283a 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -5,6 +5,7 @@
> #include <linux/debugfs.h>
> #include <linux/ktime.h>
> #include <linux/mutex.h>
> +#include <cxlpci.h>
> #include <cxlmem.h>
> #include <cxl.h>
>
> @@ -120,6 +121,43 @@ static bool cxl_is_security_command(u16 opcode)
> return false;
> }
>
> +static bool cxl_is_poison_command(u16 opcode)
> +{
> +#define CXL_MBOX_OP_POISON_CMDS 0x43
> +
> + if ((opcode >> 8) == CXL_MBOX_OP_POISON_CMDS)
> + return true;
> +
> + return false;
> +}
> +
> +static void cxl_set_poison_cmd_enabled(struct cxl_poison_state *poison,
> + u16 opcode)
> +{
> + switch (opcode) {
> + case CXL_MBOX_OP_GET_POISON:
> + set_bit(CXL_POISON_ENABLED_LIST, poison->enabled_cmds);
> + break;
> + case CXL_MBOX_OP_INJECT_POISON:
> + set_bit(CXL_POISON_ENABLED_INJECT, poison->enabled_cmds);
> + break;
> + case CXL_MBOX_OP_CLEAR_POISON:
> + set_bit(CXL_POISON_ENABLED_CLEAR, poison->enabled_cmds);
> + break;
> + case CXL_MBOX_OP_GET_SCAN_MEDIA_CAPS:
> + set_bit(CXL_POISON_ENABLED_SCAN_CAPS, poison->enabled_cmds);
> + break;
> + case CXL_MBOX_OP_SCAN_MEDIA:
> + set_bit(CXL_POISON_ENABLED_SCAN_MEDIA, poison->enabled_cmds);
> + break;
> + case CXL_MBOX_OP_GET_SCAN_MEDIA:
> + set_bit(CXL_POISON_ENABLED_SCAN_RESULTS, poison->enabled_cmds);
> + break;
> + default:
> + break;
> + }
> +}
> +
> static struct cxl_mem_command *cxl_mem_find_command(u16 opcode)
> {
> struct cxl_mem_command *c;
> @@ -635,13 +673,18 @@ static void cxl_walk_cel(struct cxl_dev_state *cxlds, size_t size, u8 *cel)
> u16 opcode = le16_to_cpu(cel_entry[i].opcode);
> struct cxl_mem_command *cmd = cxl_mem_find_command(opcode);
>
> - if (!cmd) {
> + if (!cmd && !cxl_is_poison_command(opcode)) {
> dev_dbg(cxlds->dev,
> "Opcode 0x%04x unsupported by driver\n", opcode);
> continue;
> }
>
> - set_bit(cmd->info.id, cxlds->enabled_cmds);
> + if (cmd)
> + set_bit(cmd->info.id, cxlds->enabled_cmds);
> +
> + if (cxl_is_poison_command(opcode))
> + cxl_set_poison_cmd_enabled(&cxlds->poison, opcode);
> +
> dev_dbg(cxlds->dev, "Opcode 0x%04x enabled\n", opcode);
Ah, nice I like how you suppressed the unsupported by driver message
which could have lead to confusion. I think we should duplicate this
approach for the DCD command set.
Looks good.
next prev parent reply other threads:[~2023-04-22 3:22 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 17:39 [PATCH v13 0/9] CXL Poison List Retrieval & Tracing alison.schofield
2023-04-18 17:39 ` [PATCH v13 1/9] cxl/mbox: Deprecate poison commands alison.schofield
2023-04-18 17:39 ` [PATCH v13 2/9] cxl/mbox: Restrict poison cmds to debugfs cxl_raw_allow_all alison.schofield
2023-04-23 15:23 ` Jonathan Cameron
2023-04-18 17:39 ` [PATCH v13 3/9] cxl/mbox: Initialize the poison state alison.schofield
2023-04-22 3:22 ` Dan Williams [this message]
2023-04-23 15:28 ` Jonathan Cameron
2023-04-18 17:39 ` [PATCH v13 4/9] cxl/mbox: Add GET_POISON_LIST mailbox command alison.schofield
2023-04-18 17:39 ` [PATCH v13 5/9] cxl/trace: Add TRACE support for CXL media-error records alison.schofield
2023-04-18 17:39 ` [PATCH v13 6/9] cxl/memdev: Add trigger_poison_list sysfs attribute alison.schofield
2023-04-26 2:38 ` Davidlohr Bueso
2023-04-27 4:11 ` Alison Schofield
2023-04-27 15:39 ` Davidlohr Bueso
2023-04-27 16:35 ` Dan Williams
2023-04-27 19:18 ` Alison Schofield
2023-04-27 19:54 ` Dan Williams
2023-04-27 21:35 ` Alison Schofield
2023-04-18 17:39 ` [PATCH v13 7/9] cxl/region: Provide region info to the cxl_poison trace event alison.schofield
2023-04-22 21:36 ` Dan Williams
2023-04-18 17:39 ` [PATCH v13 8/9] cxl/trace: Add an HPA to cxl_poison trace events alison.schofield
2023-04-18 17:39 ` [PATCH v13 9/9] tools/testing/cxl: Mock support for Get Poison List alison.schofield
2023-04-23 15:30 ` [PATCH v13 0/9] CXL Poison List Retrieval & Tracing Jonathan Cameron
2023-04-23 15:41 ` Jonathan Cameron
2023-04-23 18:47 ` Dan Williams
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=644352df7db17_1b66294d9@dwillia2-xfh.jf.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=alison.schofield@intel.com \
--cc=bwidawsk@kernel.org \
--cc=dave.jiang@intel.com \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=rostedt@goodmis.org \
--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