| .. | .. | 
|---|
| 4 | 4 |   | 
|---|
| 5 | 5 |  #include <asm/processor.h> | 
|---|
| 6 | 6 |  #include <asm/alternative.h> | 
|---|
 | 7 | +#include <linux/interrupt.h>  | 
|---|
| 7 | 8 |  #include <uapi/asm/kvm_para.h> | 
|---|
| 8 |  | -  | 
|---|
| 9 |  | -extern void kvmclock_init(void);  | 
|---|
| 10 | 9 |   | 
|---|
| 11 | 10 |  #ifdef CONFIG_KVM_GUEST | 
|---|
| 12 | 11 |  bool kvm_check_and_clear_guest_paused(void); | 
|---|
| .. | .. | 
|---|
| 18 | 17 |  #endif /* CONFIG_KVM_GUEST */ | 
|---|
| 19 | 18 |   | 
|---|
| 20 | 19 |  #define KVM_HYPERCALL \ | 
|---|
| 21 |  | -        ALTERNATIVE(".byte 0x0f,0x01,0xc1", ".byte 0x0f,0x01,0xd9", X86_FEATURE_VMMCALL)  | 
|---|
 | 20 | +        ALTERNATIVE("vmcall", "vmmcall", X86_FEATURE_VMMCALL)  | 
|---|
| 22 | 21 |   | 
|---|
| 23 | 22 |  /* For KVM hypercalls, a three-byte sequence of either the vmcall or the vmmcall | 
|---|
| 24 | 23 |   * instruction.  The hypervisor may replace it with something else but only the | 
|---|
| .. | .. | 
|---|
| 85 | 84 |  } | 
|---|
| 86 | 85 |   | 
|---|
| 87 | 86 |  #ifdef CONFIG_KVM_GUEST | 
|---|
 | 87 | +void kvmclock_init(void);  | 
|---|
 | 88 | +void kvmclock_disable(void);  | 
|---|
| 88 | 89 |  bool kvm_para_available(void); | 
|---|
| 89 | 90 |  unsigned int kvm_arch_para_features(void); | 
|---|
| 90 | 91 |  unsigned int kvm_arch_para_hints(void); | 
|---|
| 91 |  | -void kvm_async_pf_task_wait(u32 token, int interrupt_kernel);  | 
|---|
 | 92 | +void kvm_async_pf_task_wait_schedule(u32 token);  | 
|---|
| 92 | 93 |  void kvm_async_pf_task_wake(u32 token); | 
|---|
| 93 |  | -u32 kvm_read_and_reset_pf_reason(void);  | 
|---|
| 94 |  | -extern void kvm_disable_steal_time(void);  | 
|---|
 | 94 | +u32 kvm_read_and_reset_apf_flags(void);  | 
|---|
 | 95 | +bool __kvm_handle_async_pf(struct pt_regs *regs, u32 token);  | 
|---|
 | 96 | +  | 
|---|
 | 97 | +DECLARE_STATIC_KEY_FALSE(kvm_async_pf_enabled);  | 
|---|
 | 98 | +  | 
|---|
 | 99 | +static __always_inline bool kvm_handle_async_pf(struct pt_regs *regs, u32 token)  | 
|---|
 | 100 | +{  | 
|---|
 | 101 | +	if (static_branch_unlikely(&kvm_async_pf_enabled))  | 
|---|
 | 102 | +		return __kvm_handle_async_pf(regs, token);  | 
|---|
 | 103 | +	else  | 
|---|
 | 104 | +		return false;  | 
|---|
 | 105 | +}  | 
|---|
| 95 | 106 |   | 
|---|
| 96 | 107 |  #ifdef CONFIG_PARAVIRT_SPINLOCKS | 
|---|
| 97 | 108 |  void __init kvm_spinlock_init(void); | 
|---|
| .. | .. | 
|---|
| 102 | 113 |  #endif /* CONFIG_PARAVIRT_SPINLOCKS */ | 
|---|
| 103 | 114 |   | 
|---|
| 104 | 115 |  #else /* CONFIG_KVM_GUEST */ | 
|---|
| 105 |  | -#define kvm_async_pf_task_wait(T, I) do {} while(0)  | 
|---|
 | 116 | +#define kvm_async_pf_task_wait_schedule(T) do {} while(0)  | 
|---|
| 106 | 117 |  #define kvm_async_pf_task_wake(T) do {} while(0) | 
|---|
| 107 | 118 |   | 
|---|
| 108 | 119 |  static inline bool kvm_para_available(void) | 
|---|
| .. | .. | 
|---|
| 120 | 131 |  	return 0; | 
|---|
| 121 | 132 |  } | 
|---|
| 122 | 133 |   | 
|---|
| 123 |  | -static inline u32 kvm_read_and_reset_pf_reason(void)  | 
|---|
 | 134 | +static inline u32 kvm_read_and_reset_apf_flags(void)  | 
|---|
| 124 | 135 |  { | 
|---|
| 125 | 136 |  	return 0; | 
|---|
| 126 | 137 |  } | 
|---|
| 127 | 138 |   | 
|---|
| 128 |  | -static inline void kvm_disable_steal_time(void)  | 
|---|
 | 139 | +static __always_inline bool kvm_handle_async_pf(struct pt_regs *regs, u32 token)  | 
|---|
| 129 | 140 |  { | 
|---|
| 130 |  | -	return;  | 
|---|
 | 141 | +	return false;  | 
|---|
| 131 | 142 |  } | 
|---|
| 132 | 143 |  #endif | 
|---|
| 133 | 144 |   | 
|---|