* [PATCH v3 1/2] cxl/mbox: Return success for CXL_MBOX_CMD_RC_BACKGROUND
@ 2026-11-16 7:09 Li Ming
2026-11-16 7:09 ` [PATCH v3 2/2] cxl/mbox: Use mapped errno to determine command status Li Ming
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Li Ming @ 2026-11-16 7:09 UTC (permalink / raw)
To: dave, jic23, dave.jiang, alison.schofield, vishal.l.verma, djbw,
iweiny, icheng
Cc: linux-cxl, linux-kernel
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, per Table-8-208 in CXL r4.0 section 8.2.9.4.5.1, 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.
Signed-off-by: Li Ming <ming.li@zohomail.com>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
---
v3:
- Drop fixes tag.
- Collect review tag.
v2:
- Add a reference to the relevant spec section in the commit log.
---
drivers/cxl/cxlmem.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h
index c401e3a1af06..cc71d7a84cdc 100644
--- a/drivers/cxl/cxlmem.h
+++ b/drivers/cxl/cxlmem.h
@@ -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"), \
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 2/2] cxl/mbox: Use mapped errno to determine command status
2026-11-16 7:09 [PATCH v3 1/2] cxl/mbox: Return success for CXL_MBOX_CMD_RC_BACKGROUND Li Ming
@ 2026-11-16 7:09 ` Li Ming
2026-11-17 1:18 ` Jonathan Cameron
2026-11-17 16:31 ` Dave Jiang
2026-11-17 1:16 ` [PATCH v3 1/2] cxl/mbox: Return success for CXL_MBOX_CMD_RC_BACKGROUND Jonathan Cameron
2026-11-17 16:31 ` Dave Jiang
2 siblings, 2 replies; 6+ messages in thread
From: Li Ming @ 2026-11-16 7:09 UTC (permalink / raw)
To: dave, jic23, dave.jiang, alison.schofield, vishal.l.verma, djbw,
iweiny, icheng
Cc: linux-cxl, linux-kernel
cxl_mbox_cmd_rctable already maps all mailbox command return codes to
errno values. Use the returned errno directly instead of checking
mailbox return codes separately to determine whether a command succeeded
or failed.
Signed-off-by: Li Ming <ming.li@zohomail.com>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
---
v3:
- No change.
v2:
- New patch.
---
drivers/cxl/core/mbox.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index 55828a836c01..bd91b03c4d21 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -270,9 +270,9 @@ int cxl_internal_send_cmd(struct cxl_mailbox *cxl_mbox,
if (rc)
return rc;
- if (mbox_cmd->return_code != CXL_MBOX_CMD_RC_SUCCESS &&
- mbox_cmd->return_code != CXL_MBOX_CMD_RC_BACKGROUND)
- return cxl_mbox_cmd_rc2errno(mbox_cmd);
+ rc = cxl_mbox_cmd_rc2errno(mbox_cmd);
+ if (rc)
+ return rc;
if (!out_size)
return 0;
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/2] cxl/mbox: Return success for CXL_MBOX_CMD_RC_BACKGROUND
2026-11-16 7:09 [PATCH v3 1/2] cxl/mbox: Return success for CXL_MBOX_CMD_RC_BACKGROUND Li Ming
2026-11-16 7:09 ` [PATCH v3 2/2] cxl/mbox: Use mapped errno to determine command status Li Ming
@ 2026-11-17 1:16 ` Jonathan Cameron
2026-11-17 16:31 ` Dave Jiang
2 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2026-11-17 1:16 UTC (permalink / raw)
To: Li Ming
Cc: dave, dave.jiang, alison.schofield, vishal.l.verma, djbw, iweiny,
icheng, linux-cxl, linux-kernel
On Mon, 16 Nov 2026 15:09:37 +0800
Li Ming <ming.li@zohomail.com> wrote:
> 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, per Table-8-208 in CXL r4.0 section 8.2.9.4.5.1, 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.
>
> Signed-off-by: Li Ming <ming.li@zohomail.com>
> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/2] cxl/mbox: Use mapped errno to determine command status
2026-11-16 7:09 ` [PATCH v3 2/2] cxl/mbox: Use mapped errno to determine command status Li Ming
@ 2026-11-17 1:18 ` Jonathan Cameron
2026-11-17 16:31 ` Dave Jiang
1 sibling, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2026-11-17 1:18 UTC (permalink / raw)
To: Li Ming
Cc: dave, dave.jiang, alison.schofield, vishal.l.verma, djbw, iweiny,
icheng, linux-cxl, linux-kernel
On Mon, 16 Nov 2026 15:09:38 +0800
Li Ming <ming.li@zohomail.com> wrote:
> cxl_mbox_cmd_rctable already maps all mailbox command return codes to
> errno values. Use the returned errno directly instead of checking
> mailbox return codes separately to determine whether a command succeeded
> or failed.
>
> Signed-off-by: Li Ming <ming.li@zohomail.com>
> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/2] cxl/mbox: Return success for CXL_MBOX_CMD_RC_BACKGROUND
2026-11-16 7:09 [PATCH v3 1/2] cxl/mbox: Return success for CXL_MBOX_CMD_RC_BACKGROUND Li Ming
2026-11-16 7:09 ` [PATCH v3 2/2] cxl/mbox: Use mapped errno to determine command status Li Ming
2026-11-17 1:16 ` [PATCH v3 1/2] cxl/mbox: Return success for CXL_MBOX_CMD_RC_BACKGROUND Jonathan Cameron
@ 2026-11-17 16:31 ` Dave Jiang
2 siblings, 0 replies; 6+ messages in thread
From: Dave Jiang @ 2026-11-17 16:31 UTC (permalink / raw)
To: Li Ming, dave, jic23, alison.schofield, vishal.l.verma, djbw,
iweiny, icheng
Cc: linux-cxl, linux-kernel
On 11/16/26 12:09 AM, Li Ming wrote:
> 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, per Table-8-208 in CXL r4.0 section 8.2.9.4.5.1, 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.
>
> Signed-off-by: Li Ming <ming.li@zohomail.com>
> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Applied to cxl/next:
d9b7b42f7bb8
> ---
> v3:
> - Drop fixes tag.
> - Collect review tag.
> v2:
> - Add a reference to the relevant spec section in the commit log.
> ---
> drivers/cxl/cxlmem.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h
> index c401e3a1af06..cc71d7a84cdc 100644
> --- a/drivers/cxl/cxlmem.h
> +++ b/drivers/cxl/cxlmem.h
> @@ -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"), \
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/2] cxl/mbox: Use mapped errno to determine command status
2026-11-16 7:09 ` [PATCH v3 2/2] cxl/mbox: Use mapped errno to determine command status Li Ming
2026-11-17 1:18 ` Jonathan Cameron
@ 2026-11-17 16:31 ` Dave Jiang
1 sibling, 0 replies; 6+ messages in thread
From: Dave Jiang @ 2026-11-17 16:31 UTC (permalink / raw)
To: Li Ming, dave, jic23, alison.schofield, vishal.l.verma, djbw,
iweiny, icheng
Cc: linux-cxl, linux-kernel
On 11/16/26 12:09 AM, Li Ming wrote:
> cxl_mbox_cmd_rctable already maps all mailbox command return codes to
> errno values. Use the returned errno directly instead of checking
> mailbox return codes separately to determine whether a command succeeded
> or failed.
>
> Signed-off-by: Li Ming <ming.li@zohomail.com>
> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Applied to cxl/next:
ecd99b9602b2
> ---
> v3:
> - No change.
> v2:
> - New patch.
> ---
> drivers/cxl/core/mbox.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index 55828a836c01..bd91b03c4d21 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -270,9 +270,9 @@ int cxl_internal_send_cmd(struct cxl_mailbox *cxl_mbox,
> if (rc)
> return rc;
>
> - if (mbox_cmd->return_code != CXL_MBOX_CMD_RC_SUCCESS &&
> - mbox_cmd->return_code != CXL_MBOX_CMD_RC_BACKGROUND)
> - return cxl_mbox_cmd_rc2errno(mbox_cmd);
> + rc = cxl_mbox_cmd_rc2errno(mbox_cmd);
> + if (rc)
> + return rc;
>
> if (!out_size)
> return 0;
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-17 16:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16 7:09 [PATCH v3 1/2] cxl/mbox: Return success for CXL_MBOX_CMD_RC_BACKGROUND Li Ming
2026-11-16 7:09 ` [PATCH v3 2/2] cxl/mbox: Use mapped errno to determine command status Li Ming
2026-11-17 1:18 ` Jonathan Cameron
2026-11-17 16:31 ` Dave Jiang
2026-11-17 1:16 ` [PATCH v3 1/2] cxl/mbox: Return success for CXL_MBOX_CMD_RC_BACKGROUND Jonathan Cameron
2026-11-17 16:31 ` Dave Jiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®