Re: [PATCH v9 08/23] coco/tdx-host: Expose P-SEAMLDR information via sysfs

From: Dave Hansen

Date: Fri May 15 2026 - 13:37:01 EST


> +What: /sys/devices/faux/tdx_host/seamldr_version
> +Contact: linux-coco@xxxxxxxxxxxxxxx
> +Description: (RO) Report the version of the loaded P-SEAMLDR. The P-SEAMLDR
> + version is formatted as x.y.z, where "x" is the major version,
> + "y" is the minor version and "z" is the update version. Versions
> + are used for bug reporting and compatibility checks.

Rather than a copy/paste, I'd just say the format is the same as the
main module version.

...
> +static ssize_t num_remaining_updates_show(struct device *dev,
> + struct device_attribute *attr,
> + char *buf)
> +{
> + struct seamldr_info info;
> + int ret;
> +
> + ret = seamldr_get_info(&info);
> + if (ret)
> + return ret;
> +
> + return sysfs_emit(buf, "%u\n", info.num_remaining_updates);
> +}
> +
> +static DEVICE_ATTR_ADMIN_RO(seamldr_version);
> +static DEVICE_ATTR_ADMIN_RO(num_remaining_updates);
> +
> +static struct attribute *seamldr_attrs[] = {
> + &dev_attr_seamldr_version.attr,
> + &dev_attr_num_remaining_updates.attr,
> + NULL,
> +};
> +
> +static umode_t seamldr_group_visible(struct kobject *kobj, struct attribute *attr, int idx)
> +{
> + const struct tdx_sys_info *sysinfo = tdx_get_sysinfo();
> +
> + if (!sysinfo)
> + return 0;
> +
> + return tdx_supports_runtime_update(sysinfo) ? attr->mode : 0;
> +}
> +
> +static const struct attribute_group seamldr_group = {
> + .attrs = seamldr_attrs,
> + .is_visible = seamldr_group_visible,
> +};

I feel like we need to mention *somewhere* that these are kinda nasty.
tdx_get_sysinfo() is slow and single-threaded. These very much are and
need to stay 0400 for good reason.

Talk about the DEVICE_ATTR_ADMIN_RO() choice _somewhere_, please.

With those fixed:

Reviewed-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>