Re: [PATCH v7 06/22] coco/tdx-host: Expose P-SEAMLDR information via sysfs

Dave Hansen
2026-03-31T14:58:08Z

On 3/31/26 05:41, Chao Gao wrote:
> +/*
> + * Open-code DEVICE_ATTR_ADMIN_RO to specify a different 'show' function
> + * for P-SEAMLDR version as version_show() is used for TDX module version.
> + *
> + * Admin-only readable as reading these attributes calls into P-SEAMLDR,
> + * which may have potential performance and system impact.
> + */
> +static struct device_attribute dev_attr_seamldr_version =
> + __ATTR(version, 0400, seamldr_version_show, NULL);
> +static DEVICE_ATTR_ADMIN_RO(num_remaining_updates);

I don't like that these are really *exactly* the same, except for the
name but are defined so differently. I see three alternatives that are
better:

1. Open code *both* so they look the same
2. Define a macro that both can use that has a seamldr_## prefix
3. Move the code to a new file to avoid symbol conflicts.

I'd honestly be fine with any of those.

The other option is to just put the module information at the top
directory so the sysfs name differentiates things.

For real, how many things are going to be in the seamldr directory? If
it's just two, is it worth having a directory?