Commit 4ebb105e authored by Paolo Bonzini's avatar Paolo Bonzini

KVM: SEV: introduce to_kvm_sev_info

Suggested-by: default avatarSean Christopherson <seanjc@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Message-ID: <20240404121327.3107131-10-pbonzini@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 2a955c4d
...@@ -96,7 +96,7 @@ static int sev_flush_asids(unsigned int min_asid, unsigned int max_asid) ...@@ -96,7 +96,7 @@ static int sev_flush_asids(unsigned int min_asid, unsigned int max_asid)
static inline bool is_mirroring_enc_context(struct kvm *kvm) static inline bool is_mirroring_enc_context(struct kvm *kvm)
{ {
return !!to_kvm_svm(kvm)->sev_info.enc_context_owner; return !!to_kvm_sev_info(kvm)->enc_context_owner;
} }
static bool sev_vcpu_has_debug_swap(struct vcpu_svm *svm) static bool sev_vcpu_has_debug_swap(struct vcpu_svm *svm)
...@@ -653,7 +653,7 @@ static int __sev_launch_update_vmsa(struct kvm *kvm, struct kvm_vcpu *vcpu, ...@@ -653,7 +653,7 @@ static int __sev_launch_update_vmsa(struct kvm *kvm, struct kvm_vcpu *vcpu,
clflush_cache_range(svm->sev_es.vmsa, PAGE_SIZE); clflush_cache_range(svm->sev_es.vmsa, PAGE_SIZE);
vmsa.reserved = 0; vmsa.reserved = 0;
vmsa.handle = to_kvm_svm(kvm)->sev_info.handle; vmsa.handle = to_kvm_sev_info(kvm)->handle;
vmsa.address = __sme_pa(svm->sev_es.vmsa); vmsa.address = __sme_pa(svm->sev_es.vmsa);
vmsa.len = PAGE_SIZE; vmsa.len = PAGE_SIZE;
ret = sev_issue_cmd(kvm, SEV_CMD_LAUNCH_UPDATE_VMSA, &vmsa, error); ret = sev_issue_cmd(kvm, SEV_CMD_LAUNCH_UPDATE_VMSA, &vmsa, error);
......
...@@ -319,6 +319,11 @@ static __always_inline struct kvm_svm *to_kvm_svm(struct kvm *kvm) ...@@ -319,6 +319,11 @@ static __always_inline struct kvm_svm *to_kvm_svm(struct kvm *kvm)
return container_of(kvm, struct kvm_svm, kvm); return container_of(kvm, struct kvm_svm, kvm);
} }
static __always_inline struct kvm_sev_info *to_kvm_sev_info(struct kvm *kvm)
{
return &to_kvm_svm(kvm)->sev_info;
}
static __always_inline bool sev_guest(struct kvm *kvm) static __always_inline bool sev_guest(struct kvm *kvm)
{ {
#ifdef CONFIG_KVM_AMD_SEV #ifdef CONFIG_KVM_AMD_SEV
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment