Re: [PATCH v7 07/22] coco/tdx-host: Implement firmware upload sysfs ABI for TDX module updates
From: Edgecombe, Rick P
Date: Fri Apr 10 2026 - 20:28:06 EST
On Tue, 2026-03-31 at 05:41 -0700, Chao Gao wrote:
> +static enum fw_upload_err tdx_fw_write(struct fw_upload *fwl, const u8 *data,
> + u32 offset, u32 size, u32 *written)
> +{
> + int ret;
> +
> + /*
> + * tdx_fw_write() always processes all data on the first call with
> + * offset == 0. Since it never returns partial success (it either
> + * succeeds completely or fails), there is no subsequent call with
> + * non-zero offsets.
> + */
> + WARN_ON_ONCE(offset);
> + ret = seamldr_install_module(data, size);
> + switch (ret) {
> + case 0:
> + *written = size;
> + return FW_UPLOAD_ERR_NONE;
> + case -EBUSY:
> + return FW_UPLOAD_ERR_BUSY;
> + case -EIO:
> + return FW_UPLOAD_ERR_HW_ERROR;
> + case -ENOMEM:
> + return FW_UPLOAD_ERR_RW_ERROR;
> + default:
> + return FW_UPLOAD_ERR_FW_INVALID;
It's hard to review whether these error codes match because the function doesn't
return them yet. Why isn't this patch just done later in the series after
everything is in place?
> + }
> +}
> +