forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/arch/x86/include/asm/kvm_para.h
....@@ -4,9 +4,8 @@
44
55 #include <asm/processor.h>
66 #include <asm/alternative.h>
7
+#include <linux/interrupt.h>
78 #include <uapi/asm/kvm_para.h>
8
-
9
-extern void kvmclock_init(void);
109
1110 #ifdef CONFIG_KVM_GUEST
1211 bool kvm_check_and_clear_guest_paused(void);
....@@ -18,7 +17,7 @@
1817 #endif /* CONFIG_KVM_GUEST */
1918
2019 #define KVM_HYPERCALL \
21
- ALTERNATIVE(".byte 0x0f,0x01,0xc1", ".byte 0x0f,0x01,0xd9", X86_FEATURE_VMMCALL)
20
+ ALTERNATIVE("vmcall", "vmmcall", X86_FEATURE_VMMCALL)
2221
2322 /* For KVM hypercalls, a three-byte sequence of either the vmcall or the vmmcall
2423 * instruction. The hypervisor may replace it with something else but only the
....@@ -85,13 +84,25 @@
8584 }
8685
8786 #ifdef CONFIG_KVM_GUEST
87
+void kvmclock_init(void);
88
+void kvmclock_disable(void);
8889 bool kvm_para_available(void);
8990 unsigned int kvm_arch_para_features(void);
9091 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);
9293 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
+}
95106
96107 #ifdef CONFIG_PARAVIRT_SPINLOCKS
97108 void __init kvm_spinlock_init(void);
....@@ -102,7 +113,7 @@
102113 #endif /* CONFIG_PARAVIRT_SPINLOCKS */
103114
104115 #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)
106117 #define kvm_async_pf_task_wake(T) do {} while(0)
107118
108119 static inline bool kvm_para_available(void)
....@@ -120,14 +131,14 @@
120131 return 0;
121132 }
122133
123
-static inline u32 kvm_read_and_reset_pf_reason(void)
134
+static inline u32 kvm_read_and_reset_apf_flags(void)
124135 {
125136 return 0;
126137 }
127138
128
-static inline void kvm_disable_steal_time(void)
139
+static __always_inline bool kvm_handle_async_pf(struct pt_regs *regs, u32 token)
129140 {
130
- return;
141
+ return false;
131142 }
132143 #endif
133144