Re: [PATCH 2/2] coco/tdx-host: Expose TDX module version

From: Huang, Kai
Date: Wed Oct 01 2025 - 00:12:24 EST


On Tue, 2025-09-30 at 19:22 -0700, Chao Gao wrote:
> Currently these is no way to know the TDX module version from the
^
there is

> userspace. such information is helpful for bug reporting or
^
Such

> debugging.
>
>

[...]

> +static ssize_t version_show(struct device *dev, struct device_attribute *attr,
> + char *buf)
> +{
> + const struct tdx_sys_info *tdx_sysinfo = tdx_get_sysinfo();
> + const struct tdx_sys_info_version *ver;
> +
> + if (!tdx_sysinfo)
> + return -ENXIO;
> +
> + ver = &tdx_sysinfo->version;
> +
> + return sysfs_emit(buf, "%u.%u.%02u\n", ver->major_version,
> + ver->minor_version,
> + ver->update_version);

Nit: not sure whether the "%u.%u.%02u" needs a comment, e.g., why the %02u
is used for the update_version?