diff mbox series

[1/5] KVM: arm64: Move vcpu_has_feature() to asm/kvm_host.h

Message ID 20210714095601.184854-2-alexandru.elisei@arm.com (mailing list archive)
State New, archived
Headers show
Series KVM: arm64: Cleanups and one optimization | expand

Commit Message

Alexandru Elisei July 14, 2021, 9:55 a.m. UTC
Move the vcpu_has_feature() function to asm/kvm_host.h in preparation for
replacing test_bit() feature checks.

struct kvm_vcpu is defined in linux/kvm_host.h, which includes
asm/kvm_host.h; the function has been transformed into a macro to avoid
compiler errors about struct kvm_vcpu being undefined.

Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
---
 arch/arm64/include/asm/kvm_emulate.h | 5 -----
 arch/arm64/include/asm/kvm_host.h    | 3 +++
 2 files changed, 3 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index fd418955e31e..6bf776c2399c 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -466,9 +466,4 @@  static __always_inline void kvm_incr_pc(struct kvm_vcpu *vcpu)
 	vcpu->arch.flags |= KVM_ARM64_INCREMENT_PC;
 }
 
-static inline bool vcpu_has_feature(struct kvm_vcpu *vcpu, int feature)
-{
-	return test_bit(feature, vcpu->arch.features);
-}
-
 #endif /* __ARM64_KVM_EMULATE_H__ */
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 41911585ae0c..0b087bcfcfeb 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -774,6 +774,9 @@  int kvm_arm_setup_stage2(struct kvm *kvm, unsigned long type);
 int kvm_arm_vcpu_finalize(struct kvm_vcpu *vcpu, int feature);
 bool kvm_arm_vcpu_is_finalized(struct kvm_vcpu *vcpu);
 
+#define vcpu_has_feature(vcpu, feature) \
+	(test_bit((feature), (vcpu)->arch.features))
+
 #define kvm_arm_vcpu_sve_finalized(vcpu) \
 	((vcpu)->arch.flags & KVM_ARM64_VCPU_SVE_FINALIZED)