cxl/mbox: Check enabled_cmds before sending SET_SHUTDOWN_STATE
[email protected]
maintainerPATCH 1/1 cxl/mbox: Check enabled_cmds before sending SET_SHUTDOWN_STATE
From: Alison Schofield <[email protected]>
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.
---
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(+)
drivers/cxl/core/mbox.c +4 -0
@@ -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
Signature · 1 line
2.37.3
Quoted 4 lines · alison.schofield@ wrote:
From: Alison Schofield <[email protected]>
The CXL specification defines
CXL_MBOX_OP_SET_SHUTDOWN_STATEas optional. Check theenabled_cmdsbitmap before sending to device.
Table 8-126 defines it as mandatory for devices that support PMEM, see the "PM" in the "Mailbox" column.
Quoted 3 lines
This appeared with cxl-test where mock support for this command is not present and
-EIOis returned, leading to aWARN_ONCE()stack trace and dev_warn()'s on everycxl_nvdimm_probe.
Davidlohr and I talked about this here:
http://lore.kernel.org/[email protected]
The plan was to follow up with mock device support... oh, that came in on Tuesday, I need to go take a look at that:
http://lore.kernel.org/[email protected]
Quoted 11 lines
Signed-off-by Alison Schofield <[email protected]>---
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
-EIOfrom cxl-test as a loud reminder when running cxl-test that something new has come in that cxl-test doesn't know about.
Have a look at that follow-up series and see if it addresses the concerns.
Alison Schofield
maintainerQuoted 13 lines · Dan Williams
Quoted 4 lines · alison.schofield@ wrote:
From: Alison Schofield <[email protected]>
The CXL specification defines
CXL_MBOX_OP_SET_SHUTDOWN_STATEas optional. Check theenabled_cmdsbitmap before sending to device.Table 8-126 defines it as mandatory for devices that support PMEM, see the "PM" in the "Mailbox" column.
Quoted 3 lines
This appeared with cxl-test where mock support for this command is not present and
-EIOis returned, leading to aWARN_ONCE()stack trace and dev_warn()'s on everycxl_nvdimm_probe.
Quoted 8 lines
Davidlohr and I talked about this here:
http://lore.kernel.org/[email protected]
The plan was to follow up with mock device support... oh, that came in on Tuesday, I need to go take a look at that:
Ah, I see it now. I saw the GPF patch in cxl/next and didn't want to dilly-dally! Should've dillied a bit.
I'll try out your cxl-test patch David.
--Alison
Quoted 16 lines
Quoted 4 lines
Signed-off-by Alison Schofield <[email protected]>---
Quoted 8 lines
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
-EIOfrom cxl-test as a loud reminder when running cxl-test that something new has come in that cxl-test doesn't know about.Have a look at that follow-up series and see if it addresses the concerns.