Re: [PATCH v7 07/22] coco/tdx-host: Implement firmware upload sysfs ABI for TDX module updates
From: Chao Gao
Date: Tue Apr 14 2026 - 05:51:05 EST
On Sat, Apr 11, 2026 at 08:26:23AM +0800, Edgecombe, Rick P wrote:
>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?
Good point.
The series is ordered top-down (user interface first, implementation details
later). I could either move this patch later, or add each error mapping in the
patch that introduces the corresponding return value. I'd prefer the latter to
keep the top-down ordering. Would that work for you?