diff mbox series

[2/5] KVM: x86: Clean up redundant CC macro definition

Message ID 20210809093410.59304-3-likexu@tencent.com (mailing list archive)
State New, archived
Headers show
Series KVM: x86: Clean up redundant macro definitions | expand

Commit Message

Like Xu Aug. 9, 2021, 9:34 a.m. UTC
From: Like Xu <likexu@tencent.com>

With the exception of drivers/dma/pl330.c, the CC macro is defined and used
in {svm, vmx}/nested.c, and the KVM_NESTED_VMENTER_CONSISTENCY_CHECK
macro it refers to is defined in x86.h, so it's safe to move it into x86.h
without intended functional changes.

Signed-off-by: Like Xu <likexu@tencent.com>
---
 arch/x86/kvm/svm/nested.c | 2 --
 arch/x86/kvm/vmx/nested.c | 2 --
 arch/x86/kvm/x86.h        | 2 ++
 3 files changed, 2 insertions(+), 4 deletions(-)

Comments

Paolo Bonzini Aug. 10, 2021, 5:47 p.m. UTC | #1
On 09/08/21 11:34, Like Xu wrote:
> From: Like Xu <likexu@tencent.com>
> 
> With the exception of drivers/dma/pl330.c, the CC macro is defined and used
> in {svm, vmx}/nested.c, and the KVM_NESTED_VMENTER_CONSISTENCY_CHECK
> macro it refers to is defined in x86.h, so it's safe to move it into x86.h
> without intended functional changes.
> 
> Signed-off-by: Like Xu <likexu@tencent.com>

This one is just a shortcut that should not available outside nested.c, 
so I am not applying it.

Paolo

> ---
>   arch/x86/kvm/svm/nested.c | 2 --
>   arch/x86/kvm/vmx/nested.c | 2 --
>   arch/x86/kvm/x86.h        | 2 ++
>   3 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
> index 5e13357da21e..57c288ba6ef0 100644
> --- a/arch/x86/kvm/svm/nested.c
> +++ b/arch/x86/kvm/svm/nested.c
> @@ -29,8 +29,6 @@
>   #include "lapic.h"
>   #include "svm.h"
>   
> -#define CC KVM_NESTED_VMENTER_CONSISTENCY_CHECK
> -
>   static void nested_svm_inject_npf_exit(struct kvm_vcpu *vcpu,
>   				       struct x86_exception *fault)
>   {
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 0d0dd6580cfd..404db7c854d2 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -22,8 +22,6 @@ module_param_named(enable_shadow_vmcs, enable_shadow_vmcs, bool, S_IRUGO);
>   static bool __read_mostly nested_early_check = 0;
>   module_param(nested_early_check, bool, S_IRUGO);
>   
> -#define CC KVM_NESTED_VMENTER_CONSISTENCY_CHECK
> -
>   /*
>    * Hyper-V requires all of these, so mark them as supported even though
>    * they are just treated the same as all-context.
> diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
> index 6aac4a901b65..b8a024b0f91c 100644
> --- a/arch/x86/kvm/x86.h
> +++ b/arch/x86/kvm/x86.h
> @@ -67,6 +67,8 @@ static __always_inline void kvm_guest_exit_irqoff(void)
>   	failed;								\
>   })
>   
> +#define CC KVM_NESTED_VMENTER_CONSISTENCY_CHECK
> +
>   #define KVM_DEFAULT_PLE_GAP		128
>   #define KVM_VMX_DEFAULT_PLE_WINDOW	4096
>   #define KVM_DEFAULT_PLE_WINDOW_GROW	2
>
diff mbox series

Patch

diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index 5e13357da21e..57c288ba6ef0 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -29,8 +29,6 @@ 
 #include "lapic.h"
 #include "svm.h"
 
-#define CC KVM_NESTED_VMENTER_CONSISTENCY_CHECK
-
 static void nested_svm_inject_npf_exit(struct kvm_vcpu *vcpu,
 				       struct x86_exception *fault)
 {
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 0d0dd6580cfd..404db7c854d2 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -22,8 +22,6 @@  module_param_named(enable_shadow_vmcs, enable_shadow_vmcs, bool, S_IRUGO);
 static bool __read_mostly nested_early_check = 0;
 module_param(nested_early_check, bool, S_IRUGO);
 
-#define CC KVM_NESTED_VMENTER_CONSISTENCY_CHECK
-
 /*
  * Hyper-V requires all of these, so mark them as supported even though
  * they are just treated the same as all-context.
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 6aac4a901b65..b8a024b0f91c 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -67,6 +67,8 @@  static __always_inline void kvm_guest_exit_irqoff(void)
 	failed;								\
 })
 
+#define CC KVM_NESTED_VMENTER_CONSISTENCY_CHECK
+
 #define KVM_DEFAULT_PLE_GAP		128
 #define KVM_VMX_DEFAULT_PLE_WINDOW	4096
 #define KVM_DEFAULT_PLE_WINDOW_GROW	2