• Paolo Bonzini's avatar
    KVM: x86: add fields to struct kvm_arch for CoCo features · 517987e3
    Paolo Bonzini authored
    Some VM types have characteristics in common; in fact, the only use
    of VM types right now is kvm_arch_has_private_mem and it assumes that
    _all_ nonzero VM types have private memory.
    
    We will soon introduce a VM type for SEV and SEV-ES VMs, and at that
    point we will have two special characteristics of confidential VMs
    that depend on the VM type: not just if memory is private, but
    also whether guest state is protected.  For the latter we have
    kvm->arch.guest_state_protected, which is only set on a fully initialized
    VM.
    
    For VM types with protected guest state, we can actually fix a problem in
    the SEV-ES implementation, where ioctls to set registers do not cause an
    error even if the VM has been initialized and the guest state encrypted.
    Make sure that when using VM types that will become an error.
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Message-Id: <20240209183743.22030-7-pbonzini@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: default avatarIsaku Yamahata <isaku.yamahata@intel.com>
    Message-ID: <20240404121327.3107131-8-pbonzini@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    517987e3
x86.c 373 KB