mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cxl/memdev: Fix firmware upload exact-fit handling
@ 2026-07-13 11:27 guzebing
  2026-07-13 17:32 ` Dave Jiang
  2026-07-14 16:50 ` Dave Jiang
  0 siblings, 2 replies; 3+ messages in thread
From: guzebing @ 2026-07-13 11:27 UTC (permalink / raw)
  To: dave, jic23, dave.jiang, alison.schofield, vishal.l.verma, djbw,
	iweiny, ming.li
  Cc: linux-cxl, linux-kernel, Guzebing

From: Guzebing <Guzebing1612@gmail.com>

cxl_fw_prepare() classifies a firmware image as a one-shot transfer
only when its Transfer FW input payload is smaller than the mailbox
payload size. An image that exactly fills the payload is therefore
treated as a multi-part transfer.

The firmware loader invokes cxl_fw_write() only once for that image.
Since both offset == 0 and remaining == 0, the multi-part action
selection sends INITIATE, never sends END, and then attempts to activate
the target slot.

Include equality in the one-shot classification so exact-fit images use
the FULL action.

Fixes: 9521875bbe00 ("cxl: add a firmware update mechanism using the sysfs firmware loader")
Signed-off-by: Guzebing <Guzebing1612@gmail.com>
---
 drivers/cxl/core/memdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
index 33a3d2e7b13af..45e7d2be17e09 100644
--- a/drivers/cxl/core/memdev.c
+++ b/drivers/cxl/core/memdev.c
@@ -921,7 +921,7 @@ static enum fw_upload_err cxl_fw_prepare(struct fw_upload *fwl, const u8 *data,
 	if (!size)
 		return FW_UPLOAD_ERR_INVALID_SIZE;
 
-	mds->fw.oneshot = struct_size(transfer, data, size) <
+	mds->fw.oneshot = struct_size(transfer, data, size) <=
 			    cxl_mbox->payload_size;
 
 	if (cxl_mem_get_fw_info(mds))
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cxl/memdev: Fix firmware upload exact-fit handling
  2026-07-13 11:27 [PATCH] cxl/memdev: Fix firmware upload exact-fit handling guzebing
@ 2026-07-13 17:32 ` Dave Jiang
  2026-07-14 16:50 ` Dave Jiang
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Jiang @ 2026-07-13 17:32 UTC (permalink / raw)
  To: guzebing, dave, jic23, alison.schofield, vishal.l.verma, djbw,
	iweiny, ming.li
  Cc: linux-cxl, linux-kernel



On 7/13/26 4:27 AM, guzebing wrote:
> From: Guzebing <Guzebing1612@gmail.com>
> 
> cxl_fw_prepare() classifies a firmware image as a one-shot transfer
> only when its Transfer FW input payload is smaller than the mailbox
> payload size. An image that exactly fills the payload is therefore
> treated as a multi-part transfer.
> 
> The firmware loader invokes cxl_fw_write() only once for that image.
> Since both offset == 0 and remaining == 0, the multi-part action
> selection sends INITIATE, never sends END, and then attempts to activate
> the target slot.
> 
> Include equality in the one-shot classification so exact-fit images use
> the FULL action.
> 
> Fixes: 9521875bbe00 ("cxl: add a firmware update mechanism using the sysfs firmware loader")
> Signed-off-by: Guzebing <Guzebing1612@gmail.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/cxl/core/memdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
> index 33a3d2e7b13af..45e7d2be17e09 100644
> --- a/drivers/cxl/core/memdev.c
> +++ b/drivers/cxl/core/memdev.c
> @@ -921,7 +921,7 @@ static enum fw_upload_err cxl_fw_prepare(struct fw_upload *fwl, const u8 *data,
>  	if (!size)
>  		return FW_UPLOAD_ERR_INVALID_SIZE;
>  
> -	mds->fw.oneshot = struct_size(transfer, data, size) <
> +	mds->fw.oneshot = struct_size(transfer, data, size) <=
>  			    cxl_mbox->payload_size;
>  
>  	if (cxl_mem_get_fw_info(mds))


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cxl/memdev: Fix firmware upload exact-fit handling
  2026-07-13 11:27 [PATCH] cxl/memdev: Fix firmware upload exact-fit handling guzebing
  2026-07-13 17:32 ` Dave Jiang
@ 2026-07-14 16:50 ` Dave Jiang
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Jiang @ 2026-07-14 16:50 UTC (permalink / raw)
  To: guzebing, dave, jic23, alison.schofield, vishal.l.verma, djbw,
	iweiny, ming.li
  Cc: linux-cxl, linux-kernel



On 7/13/26 4:27 AM, guzebing wrote:
> From: Guzebing <Guzebing1612@gmail.com>
> 
> cxl_fw_prepare() classifies a firmware image as a one-shot transfer
> only when its Transfer FW input payload is smaller than the mailbox
> payload size. An image that exactly fills the payload is therefore
> treated as a multi-part transfer.
> 
> The firmware loader invokes cxl_fw_write() only once for that image.
> Since both offset == 0 and remaining == 0, the multi-part action
> selection sends INITIATE, never sends END, and then attempts to activate
> the target slot.
> 
> Include equality in the one-shot classification so exact-fit images use
> the FULL action.
> 
> Fixes: 9521875bbe00 ("cxl: add a firmware update mechanism using the sysfs firmware loader")
> Signed-off-by: Guzebing <Guzebing1612@gmail.com>

Applied to cxl/next
af5035e1b3e4

> ---
>  drivers/cxl/core/memdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
> index 33a3d2e7b13af..45e7d2be17e09 100644
> --- a/drivers/cxl/core/memdev.c
> +++ b/drivers/cxl/core/memdev.c
> @@ -921,7 +921,7 @@ static enum fw_upload_err cxl_fw_prepare(struct fw_upload *fwl, const u8 *data,
>  	if (!size)
>  		return FW_UPLOAD_ERR_INVALID_SIZE;
>  
> -	mds->fw.oneshot = struct_size(transfer, data, size) <
> +	mds->fw.oneshot = struct_size(transfer, data, size) <=
>  			    cxl_mbox->payload_size;
>  
>  	if (cxl_mem_get_fw_info(mds))


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-14 16:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-13 11:27 [PATCH] cxl/memdev: Fix firmware upload exact-fit handling guzebing
2026-07-13 17:32 ` Dave Jiang
2026-07-14 16:50 ` Dave Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome