diff options
Diffstat (limited to 'arch/x86/kvm/x86.h')
-rw-r--r-- | arch/x86/kvm/x86.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h index 256da82856b..d36fe237c66 100644 --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h | |||
@@ -75,6 +75,42 @@ static inline u32 bit(int bitno) | |||
75 | return 1 << (bitno & 31); | 75 | return 1 << (bitno & 31); |
76 | } | 76 | } |
77 | 77 | ||
78 | static inline void vcpu_cache_mmio_info(struct kvm_vcpu *vcpu, | ||
79 | gva_t gva, gfn_t gfn, unsigned access) | ||
80 | { | ||
81 | vcpu->arch.mmio_gva = gva & PAGE_MASK; | ||
82 | vcpu->arch.access = access; | ||
83 | vcpu->arch.mmio_gfn = gfn; | ||
84 | } | ||
85 | |||
86 | /* | ||
87 | * Clear the mmio cache info for the given gva, | ||
88 | * specially, if gva is ~0ul, we clear all mmio cache info. | ||
89 | */ | ||
90 | static inline void vcpu_clear_mmio_info(struct kvm_vcpu *vcpu, gva_t gva) | ||
91 | { | ||
92 | if (gva != (~0ul) && vcpu->arch.mmio_gva != (gva & PAGE_MASK)) | ||
93 | return; | ||
94 | |||
95 | vcpu->arch.mmio_gva = 0; | ||
96 | } | ||
97 | |||
98 | static inline bool vcpu_match_mmio_gva(struct kvm_vcpu *vcpu, unsigned long gva) | ||
99 | { | ||
100 | if (vcpu->arch.mmio_gva && vcpu->arch.mmio_gva == (gva & PAGE_MASK)) | ||
101 | return true; | ||
102 | |||
103 | return false; | ||
104 | } | ||
105 | |||
106 | static inline bool vcpu_match_mmio_gpa(struct kvm_vcpu *vcpu, gpa_t gpa) | ||
107 | { | ||
108 | if (vcpu->arch.mmio_gfn && vcpu->arch.mmio_gfn == gpa >> PAGE_SHIFT) | ||
109 | return true; | ||
110 | |||
111 | return false; | ||
112 | } | ||
113 | |||
78 | void kvm_before_handle_nmi(struct kvm_vcpu *vcpu); | 114 | void kvm_before_handle_nmi(struct kvm_vcpu *vcpu); |
79 | void kvm_after_handle_nmi(struct kvm_vcpu *vcpu); | 115 | void kvm_after_handle_nmi(struct kvm_vcpu *vcpu); |
80 | int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq, int inc_eip); | 116 | int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq, int inc_eip); |