[PATCH v1 09/28] KVM: SEV: Expose sev_get_asid() outside of sev.c
From: Yosry Ahmed
Date: Mon Jul 27 2026 - 20:37:34 EST
Move the function definition to svm.h in preparation for using it in
more SVM code.
No functional change intended.
Signed-off-by: Yosry Ahmed <yosry@xxxxxxxxxx>
---
arch/x86/kvm/svm/sev.c | 5 -----
arch/x86/kvm/svm/svm.h | 10 ++++++++++
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index 8717da0e9fe8a..3aac702f45b2b 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -313,11 +313,6 @@ static int sev_asid_new(struct kvm_sev_info *sev, unsigned long vm_type)
return ret;
}
-static unsigned int sev_get_asid(struct kvm *kvm)
-{
- return to_kvm_sev_info(kvm)->asid;
-}
-
static void sev_asid_free(struct kvm_sev_info *sev)
{
struct svm_cpu_data *sd;
diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h
index 2f18dff023bc5..d41d189ecf4e1 100644
--- a/arch/x86/kvm/svm/svm.h
+++ b/arch/x86/kvm/svm/svm.h
@@ -429,6 +429,11 @@ static __always_inline bool is_sev_snp_guest(struct kvm_vcpu *vcpu)
{
return ____sev_snp_guest(vcpu->kvm);
}
+
+static __always_inline unsigned int sev_get_asid(struct kvm *kvm)
+{
+ return to_kvm_sev_info(kvm)->asid;
+}
#else
static __always_inline bool is_sev_guest(struct kvm_vcpu *vcpu)
{
@@ -443,6 +448,11 @@ static __always_inline bool is_sev_snp_guest(struct kvm_vcpu *vcpu)
{
return false;
}
+
+static __always_inline unsigned int sev_get_asid(struct kvm *kvm)
+{
+ return 0;
+}
#endif
static inline bool ghcb_gpa_is_registered(struct vcpu_svm *svm, u64 val)
--
2.55.0.229.g6434b31f56-goog