KVM: x86: Move HF_GIF_MASK into "struct vcpu_svm" as "guest_gif"
authorMaxim Levitsky <mlevitsk@redhat.com>
Tue, 31 Jan 2023 00:32:53 +0000 (16:32 -0800)
committerSean Christopherson <seanjc@google.com>
Tue, 31 Jan 2023 20:56:42 +0000 (12:56 -0800)
Move HF_GIF_MASK out of the common "hflags" and into vcpu_svm.guest_gif.
GIF is an SVM-only concept and has should never be consulted outside of
SVM-specific code.

No functional change is intended.

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Tested-by: Santosh Shukla <Santosh.Shukla@amd.com>
Link: https://lore.kernel.org/r/20221129193717.513824-5-mlevitsk@redhat.com
[sean: split to separate patch]
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/svm/svm.h

index 4d2bc08794e45c6ef11cd551ebd9a52f2e8dfc5b..e743220b10c393c885b4afc3fddd16c4393ade41 100644 (file)
@@ -2074,7 +2074,6 @@ enum {
        TASK_SWITCH_GATE = 3,
 };
 
-#define HF_GIF_MASK            (1 << 0)
 #define HF_NMI_MASK            (1 << 3)
 #define HF_IRET_MASK           (1 << 4)
 #define HF_GUEST_MASK          (1 << 5) /* VCPU is in guest-mode */
index a7073802450fb2bf69470df57fb86c97230184b1..45875c961df81af62a2b3c4967dffd5406442649 100644 (file)
@@ -273,6 +273,9 @@ struct vcpu_svm {
        bool guest_state_loaded;
 
        bool x2avic_msrs_intercepted;
+
+       /* Guest GIF value, used when vGIF is not enabled */
+       bool guest_gif;
 };
 
 struct svm_cpu_data {
@@ -490,7 +493,7 @@ static inline void enable_gif(struct vcpu_svm *svm)
        if (vmcb)
                vmcb->control.int_ctl |= V_GIF_MASK;
        else
-               svm->vcpu.arch.hflags |= HF_GIF_MASK;
+               svm->guest_gif = true;
 }
 
 static inline void disable_gif(struct vcpu_svm *svm)
@@ -500,7 +503,7 @@ static inline void disable_gif(struct vcpu_svm *svm)
        if (vmcb)
                vmcb->control.int_ctl &= ~V_GIF_MASK;
        else
-               svm->vcpu.arch.hflags &= ~HF_GIF_MASK;
+               svm->guest_gif = false;
 }
 
 static inline bool gif_set(struct vcpu_svm *svm)
@@ -510,7 +513,7 @@ static inline bool gif_set(struct vcpu_svm *svm)
        if (vmcb)
                return !!(vmcb->control.int_ctl & V_GIF_MASK);
        else
-               return !!(svm->vcpu.arch.hflags & HF_GIF_MASK);
+               return svm->guest_gif;
 }
 
 static inline bool nested_npt_enabled(struct vcpu_svm *svm)