On 2/15/24 02:19, Michael Roth wrote:
#define KVM_X86_DEFAULT_VM 0
#define KVM_X86_SW_PROTECTED_VM (KVM_X86_DEFAULT_VM | __KVM_X86_PRIVATE_MEM_TYPE)
+#define KVM_X86_SEV_VM 8
Hmm... would it make sense to decouple the VM types and their associated
capabilities? Only bit 2 is left in the lower range after this, and using any
bits beyond TDX's bit 4 risks overflowing check_extension ioctl's 32-bit return
value.
Yes, the idea was to leave 0..7 for vendor independent types (with 0 and
1 in use), 8..15 for AMD (3 of them being reserved already for
SEV/SEV-ES/SEV-SNP), 16..23 for Intel.
Maybe a separate lookup table instead?
The mask was nice because it can be used in relatively hot paths...
I'll keep them but move the constants away from uapi/ headers.
Paolo