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

From: Kiryl Shutsemau
Date: Wed Oct 01 2025 - 07:27:59 EST


On Wed, Oct 01, 2025 at 04:12:10AM +0000, Huang, Kai wrote:
> 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?

That's how TDX module version formatted:

https://github.com/intel/tdx-module/tags

I think it is good idea to match it.

--
Kiryl Shutsemau / Kirill A. Shutemov