Re: [PATCH 2/2] x86/sev: Make SEV_STATUS available via SYSFS
From: Dave Hansen
Date: Wed Mar 12 2025 - 12:04:33 EST
On 3/12/25 08:07, Joerg Roedel wrote:
> Hi Dave,
>
> On Wed, Mar 12, 2025 at 07:57:31AM -0700, Dave Hansen wrote:
>> Do we really want to just plumb the raw MSR out to userspace? Users
>> would still need to parse the thing, so it's not _really_ human readable.
>
> I agree that this is not really human readable. On the other side SYSFS
> is more an interface targeted for tools than optimized for human
> readability (see the one-datum-per-file rule).
Right, but I think it's also intended to be independent and not
*require* tools to make sense of the output. A raw MSR requires tooling
or someone sitting there with the hardware docs to make sense of it.
That's why we have things like:
/sys/kernel/mm/transparent_hugepage/enabled
that tell you:
[always] madvise never
as opposed to the old style in:
/proc/sys/vm/zone_reclaim_mode
which require you to go read the docs and figure out what 0/1/2 mean.
> The actual use-case (and the reason for these patches) of the sev_status
> file is to provide a better and more secure interface than /dev/msr to a
> tool named snpguest.
Let's draw this out to its natural conclusion. There are also a bunch of
TDX attributes that tell you about the capabilities of the VM and the
TDX module.
Should we have:
/sys/devices/system/cpu/tdx/tdx_attributes
which just dumps out the raw register values that come back from the
TDCALL? Then we'll go write a tdxguest tool to parse those values.