Skip to content

RFC Expose Confidential Computing capabilities on sysfs

Alejandro Jimenez kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3x86: Expose Secure Memory Encryption capabilities in sysfsDocumentation/ABI/testing/sysfs-kernel-mm-mem-encrypt arch/x86/include/asm/mem_encrypt.h arch/x86/mm/mem_encrypt.c +1 more+256 -00 replies
2/3x86: Expose SEV capabilities in sysfsDocumentation/ABI/testing/sysfs-kernel-mm-mem-encrypt arch/x86/mm/mem_encrypt_amd.c+129 -80 replies
3/3x86: Expose SEV-ES capabilities in sysfsDocumentation/ABI/testing/sysfs-kernel-mm-mem-encrypt arch/x86/mm/mem_encrypt_amd.c+66 -20 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchDarren Kenny
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC 0/3] Expose Confidential Computing capabilities on sysfs

Given the growing number of Confidential Computing features (AMD SME/SEV, Intel TDX), I believe it is useful to expose relevant state/parameters in sysfs. e.g. For AMD memory encryption features, the distinction between possible states (supported/enabled/active) is explained in the documentation at:

https://www.kernel.org/doc/Documentation/x86/amd-memory-encryption.txt

but there are currently no standard interfaces to determine state and other relevant info (e.g. nr of SEV ASIDs) besides searching dmesg or manually reading various CPUID leaves and MSRs.

This patchset implements a sysfs interface where only relevant attributes are displayed depending on context (e.g. no SME entry or ASID attributes are created when running on a guest)

On EPYC Milan host:

$ grep -r . /sys/kernel/mm/mem_encrypt/*
/sys/kernel/mm/mem_encrypt/c_bit_position:51
/sys/kernel/mm/mem_encrypt/sev/nr_sev_asid:509
/sys/kernel/mm/mem_encrypt/sev/status:enabled
/sys/kernel/mm/mem_encrypt/sev/nr_asid_available:509
/sys/kernel/mm/mem_encrypt/sev_es/nr_sev_es_asid:0
/sys/kernel/mm/mem_encrypt/sev_es/status:enabled
/sys/kernel/mm/mem_encrypt/sev_es/nr_asid_available:509
/sys/kernel/mm/mem_encrypt/sme/status:active

On SEV guest running on EPYC Milan host (displays only relevant entries):

$ grep -r . /sys/kernel/mm/mem_encrypt/*
/sys/kernel/mm/mem_encrypt/c_bit_position:51
/sys/kernel/mm/mem_encrypt/sev/status:active
/sys/kernel/mm/mem_encrypt/sev_es/status:unsupported

The full directory tree looks like:

/sys/kernel/mm/mem_encrypt/

├── c_bit_position
├── sev
│   ├── nr_asid_available
│   ├── nr_sev_asid
│   └── status
├── sev_es
│   ├── nr_asid_available
│   ├── nr_sev_es_asid
│   └── status
└── sme
    └── status

The goal is to be able to easily add new entries as new features (TDX, SEV-SNP) are merged.

I'd appreciate any suggestions/comments.

Thank you,
Alejandro

Alejandro Jimenez (3):
x86: Expose Secure Memory Encryption capabilities in sysfs
x86: Expose SEV capabilities in sysfs
x86: Expose SEV-ES capabilities in sysfs

 .../ABI/testing/sysfs-kernel-mm-mem-encrypt   |  88 +++++
 arch/x86/include/asm/mem_encrypt.h            |   6 +
 arch/x86/mm/mem_encrypt.c                     |  27 ++
 arch/x86/mm/mem_encrypt_amd.c                 | 320 ++++++++++++++++++
 4 files changed, 441 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-kernel-mm-mem-encrypt
Signature · 1 line
2.34.1