Skip to contentSkip to conversation

cxl/mbox: Return success for CXL_MBOX_CMD_RC_BACKGROUND

PATCH Superseded Li Ming 2 participants 3 messages Oct 20 CXL

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Li Ming

author reviewer
#0 lore raw

PATCH 1/1 cxl/mbox: Return success for CXL_MBOX_CMD_RC_BACKGROUND

In CXL subsystem, each mbox command hw return code is mapped to a corresponding errno value. Currently, CXL_MBOX_CMD_RC_BACKGROUND is mapped to -ENXIO.

However, a BACKGROUND hw return code indicates that the command has been accepted by the device and continues execution asynchronously. It does not indicate a command failure.

Return 0 instead of -ENXIO for CXL_MBOX_CMD_RC_BACKGROUND so that callers do not treat a successfully started background operation as an error.

Fixes 92fcc1abab09 ("cxl/mbox: Improve handling of mbox_cmd hw return codes")
---
 drivers/cxl/cxlmem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/cxlmem.h +1 -1
index c401e3a1af06..cc71d7a84cdc 100644
@@ -160,7 +160,7 @@ static inline struct cxl_ep *cxl_ep_load(struct cxl_port *port,
  */
 #define CMD_CMD_RC_TABLE							\
 	C(SUCCESS, 0, NULL),							\
-	C(BACKGROUND, -ENXIO, "background cmd started successfully"),           \
+	C(BACKGROUND, 0, "background cmd started successfully"),		\
 	C(INPUT, -ENXIO, "cmd input was invalid"),				\
 	C(UNSUPPORTED, -ENXIO, "cmd is not supported"),				\
 	C(INTERNAL, -ENXIO, "internal device error"),				\
Signature · 1 line
2.43.0
#1 lore raw
Quoted 8 lines · Li Ming

In CXL subsystem, each mbox command hw return code is mapped to a corresponding errno value. Currently, CXL_MBOX_CMD_RC_BACKGROUND is mapped to -ENXIO.

However, a BACKGROUND hw return code indicates that the command has been accepted by the device and continues execution asynchronously. It does not indicate a command failure.

Hi Li,

Can we have the spec section written here ?
Btw I wonder how you trigger the error ?

Best regards,
Richard Cheng.

Quoted 26 lines

Return 0 instead of -ENXIO for CXL_MBOX_CMD_RC_BACKGROUND so that callers do not treat a successfully started background operation as an error.

Fixes 92fcc1abab09 ("cxl/mbox: Improve handling of mbox_cmd hw return codes")
---
 drivers/cxl/cxlmem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/cxlmem.h +1 -1
index c401e3a1af06..cc71d7a84cdc 100644
@@ -160,7 +160,7 @@ static inline struct cxl_ep *cxl_ep_load(struct cxl_port *port,
  */
 #define CMD_CMD_RC_TABLE							\
 	C(SUCCESS, 0, NULL),							\
-	C(BACKGROUND, -ENXIO, "background cmd started successfully"),           \
+	C(BACKGROUND, 0, "background cmd started successfully"),		\
 	C(INPUT, -ENXIO, "cmd input was invalid"),				\
 	C(UNSUPPORTED, -ENXIO, "cmd is not supported"),				\
 	C(INTERNAL, -ENXIO, "internal device error"),				\
Signature · 1 line
2.43.0
author reviewer
#2 lore raw
Quoted 10 lines · Richard Cheng
Quoted 8 lines · Li Ming

In CXL subsystem, each mbox command hw return code is mapped to a corresponding errno value. Currently, CXL_MBOX_CMD_RC_BACKGROUND is mapped to -ENXIO.

However, a BACKGROUND hw return code indicates that the command has been accepted by the device and continues execution asynchronously. It does not indicate a command failure.

Hi Li,

Hi Richard,

Quoted 2 lines

Can we have the spec section written here ?

Sure.

Quoted 1 line

Btw I wonder how you trigger the error ?

We cannot trigger this error, currently, driver does not check/use BACKGROUND's error. it is found by review, please see [1].

[1]: https://lore.kernel.org/linux-cxl/[email protected]/T/#mc7764b9f3f470adf62292000299e8288d2241c3d

Ming

Quoted 30 lines

Best regards,
Richard Cheng.

Quoted 26 lines

Return 0 instead of -ENXIO for CXL_MBOX_CMD_RC_BACKGROUND so that callers do not treat a successfully started background operation as an error.

Fixes 92fcc1abab09 ("cxl/mbox: Improve handling of mbox_cmd hw return codes")
---
 drivers/cxl/cxlmem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/cxlmem.h +1 -1
index c401e3a1af06..cc71d7a84cdc 100644
@@ -160,7 +160,7 @@ static inline struct cxl_ep *cxl_ep_load(struct cxl_port *port,
  */
 #define CMD_CMD_RC_TABLE							\
 	C(SUCCESS, 0, NULL),							\
-	C(BACKGROUND, -ENXIO, "background cmd started successfully"),           \
+	C(BACKGROUND, 0, "background cmd started successfully"),		\
 	C(INPUT, -ENXIO, "cmd input was invalid"),				\
 	C(UNSUPPORTED, -ENXIO, "cmd is not supported"),				\
 	C(INTERNAL, -ENXIO, "internal device error"),				\
Signature · 1 line
2.43.0