Skip to contentSkip to conversation

KVM: TDX: Remove always true ifdef

PATCH Applied Nikolay Borisov 3 participants 4 messages Aug 26 – Sep 21

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: TDX: Remove always true ifdef

CONFIG_KVM_INTEL_TDX depends on KVM_TDX_HOST, which in turn depends on CONFIG_X86_64. So it's guaranteed that any code under ifdef CONFIG_KVM_INTEL_TDX is also running under CONFIG_X86_64 being true, remove pointless ifdef guard.

---
 arch/x86/kvm/vmx/main.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/kvm/vmx/main.c +0 -2
index f204a0fc0a57..e9cca303c855 100644
@@ -799,7 +799,6 @@ static void vt_write_tsc_multiplier(struct kvm_vcpu *vcpu)
 	vmx_write_tsc_multiplier(vcpu);
 }
 
-#ifdef CONFIG_X86_64
 static int vt_set_hv_timer(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc,
 			      bool *expired)
 {
@@ -818,7 +817,6 @@ static void vt_cancel_hv_timer(struct kvm_vcpu *vcpu)
 
 	vmx_cancel_hv_timer(vcpu);
 }
-#endif
 
 static void vt_setup_mce(struct kvm_vcpu *vcpu)
 {
Signature · 1 line
2.34.1
#1 lore raw
Quoted 6 lines · Nikolay Borisov

CONFIG_KVM_INTEL_TDX depends on KVM_TDX_HOST, which in turn depends on CONFIG_X86_64. So it's guaranteed that any code under ifdef CONFIG_KVM_INTEL_TDX is also running under CONFIG_X86_64 being true, remove pointless ifdef guard.

Gentle ping.

Quoted 24 lines
---
  arch/x86/kvm/vmx/main.c | 2 --
  1 file changed, 2 deletions(-)
arch/x86/kvm/vmx/main.c +0 -2
index f204a0fc0a57..e9cca303c855 100644
@@ -799,7 +799,6 @@ static void vt_write_tsc_multiplier(struct kvm_vcpu *vcpu)
  	vmx_write_tsc_multiplier(vcpu);
  }
 
-#ifdef CONFIG_X86_64
  static int vt_set_hv_timer(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc,
  			      bool *expired)
  {
@@ -818,7 +817,6 @@ static void vt_cancel_hv_timer(struct kvm_vcpu *vcpu)
 
  	vmx_cancel_hv_timer(vcpu);
  }
-#endif
 
  static void vt_setup_mce(struct kvm_vcpu *vcpu)
  {
Reviewed-by
#2 lore raw
Quoted 9 lines · Nikolay Borisov
Quoted 6 lines · Nikolay Borisov

CONFIG_KVM_INTEL_TDX depends on KVM_TDX_HOST, which in turn depends on CONFIG_X86_64. So it's guaranteed that any code under ifdef CONFIG_KVM_INTEL_TDX is also running under CONFIG_X86_64 being true, remove pointless ifdef guard.

Quoted 2 lines

Gentle ping.

BTW, I find the patch has been applied to kvm-x86 next branch already.

Quoted 24 lines
Quoted 23 lines

---
  arch/x86/kvm/vmx/main.c | 2 --

  1 file changed, 2 deletions(-)
arch/x86/kvm/vmx/main.c +0 -0
index f204a0fc0a57..e9cca303c855 100644
@@ -799,7 +799,6 @@ static void vt_write_tsc_multiplier(struct kvm_vcpu *vcpu)
       vmx_write_tsc_multiplier(vcpu);
   }

  -#ifdef CONFIG_X86_64
  static int vt_set_hv_timer(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc, bool *expired)
  {

arch/x86/kvm/vmx/main.c +0 -1
@@ -818,7 +817,6 @@ static void vt_cancel_hv_timer(struct kvm_vcpu *vcpu)
         vmx_cancel_hv_timer(vcpu);
   }
-#endif
     static void vt_setup_mce(struct kvm_vcpu *vcpu)
   {
maintainer Applied
#3 lore raw
In reply to Nikolay Borisov
Quoted 6 lines · Nikolay Borisov

CONFIG_KVM_INTEL_TDX depends on KVM_TDX_HOST, which in turn depends on CONFIG_X86_64. So it's guaranteed that any code under ifdef CONFIG_KVM_INTEL_TDX is also running under CONFIG_X86_64 being true, remove pointless ifdef guard.

Applied to kvm-x86 vmx, thanks!

[1/1] KVM: TDX: Remove always true ifdef

      https://github.com/kvm-x86/linux/commit/363479c41f02

--
https://github.com/kvm-x86/linux/tree/next