From: alison.schofield@intel.com
To: Davidlohr Bueso <dave@stgolabs.net>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Dave Jiang <dave.jiang@intel.com>,
Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
Dan Williams <dan.j.williams@intel.com>
Cc: linux-cxl@vger.kernel.org
Subject: [PATCH] cxl/mbox: Check enabled_cmds before sending SET_SHUTDOWN_STATE
Date: Fri, 7 Feb 2025 11:34:25 -0800 [thread overview]
Message-ID: <20250207193427.1711233-1-alison.schofield@intel.com> (raw)
From: Alison Schofield <alison.schofield@intel.com>
The CXL specification defines CXL_MBOX_OP_SET_SHUTDOWN_STATE as
optional. Check the enabled_cmds bitmap before sending to device.
This appeared with cxl-test where mock support for this command
is not present and -EIO is returned, leading to a WARN_ONCE()
stack trace and dev_warn()'s on every cxl_nvdimm_probe.
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
Not sure what we actually want to do when not supported.
Most cmds just return 0, like I did here, but maybe for
this functionality something more is warranted.
wrt cxl-test support, also not sure if this feature wants some
round-trip testing support via cxl-test mocking. I do like the
-EIO from cxl-test as a loud reminder when running cxl-test
that something new has come in that cxl-test doesn't know about.
drivers/cxl/core/mbox.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index c5eedcae3b02..f06a1ed81a6c 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -1289,6 +1289,10 @@ int cxl_dirty_shutdown_state(struct cxl_memdev_state *mds)
.state = 1
};
+ if (!test_bit(CXL_MEM_COMMAND_ID_SET_SHUTDOWN_STATE,
+ cxl_mbox->enabled_cmds))
+ return 0;
+
mbox_cmd = (struct cxl_mbox_cmd) {
.opcode = CXL_MBOX_OP_SET_SHUTDOWN_STATE,
.size_in = sizeof(in),
base-commit: 5585e342e8d38cc598279bdb87f235f8b954dd5a
--
2.37.3
next reply other threads:[~2025-02-07 19:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 19:34 alison.schofield [this message]
2025-02-07 20:06 ` [PATCH] cxl/mbox: Check enabled_cmds before sending SET_SHUTDOWN_STATE Dan Williams
2025-02-07 21:19 ` Alison Schofield
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=20250207193427.1711233-1-alison.schofield@intel.com \
--to=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.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