hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/s390/kvm/kvm-s390.h
....@@ -2,7 +2,7 @@
22 /*
33 * definition for kvm on s390
44 *
5
- * Copyright IBM Corp. 2008, 2009
5
+ * Copyright IBM Corp. 2008, 2020
66 *
77 * Author(s): Carsten Otte <cotte@de.ibm.com>
88 * Christian Borntraeger <borntraeger@de.ibm.com>
....@@ -15,6 +15,7 @@
1515 #include <linux/hrtimer.h>
1616 #include <linux/kvm.h>
1717 #include <linux/kvm_host.h>
18
+#include <linux/lockdep.h>
1819 #include <asm/facility.h>
1920 #include <asm/processor.h>
2021 #include <asm/sclp.h>
....@@ -25,6 +26,17 @@
2526 #define IS_ITDB_VALID(vcpu) ((*(char *)vcpu->arch.sie_block->itdba == TDB_FORMAT1))
2627
2728 extern debug_info_t *kvm_s390_dbf;
29
+extern debug_info_t *kvm_s390_dbf_uv;
30
+
31
+#define KVM_UV_EVENT(d_kvm, d_loglevel, d_string, d_args...)\
32
+do { \
33
+ debug_sprintf_event((d_kvm)->arch.dbf, d_loglevel, d_string "\n", \
34
+ d_args); \
35
+ debug_sprintf_event(kvm_s390_dbf_uv, d_loglevel, \
36
+ "%d: " d_string "\n", (d_kvm)->userspace_pid, \
37
+ d_args); \
38
+} while (0)
39
+
2840 #define KVM_EVENT(d_loglevel, d_string, d_args...)\
2941 do { \
3042 debug_sprintf_event(kvm_s390_dbf, d_loglevel, d_string "\n", \
....@@ -67,7 +79,7 @@
6779
6880 static inline int is_vcpu_idle(struct kvm_vcpu *vcpu)
6981 {
70
- return test_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.float_int.idle_mask);
82
+ return test_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.idle_mask);
7183 }
7284
7385 static inline int kvm_is_ucontrol(struct kvm *kvm)
....@@ -196,6 +208,39 @@
196208 return kvm->arch.user_cpu_state_ctrl != 0;
197209 }
198210
211
+/* implemented in pv.c */
212
+int kvm_s390_pv_destroy_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc);
213
+int kvm_s390_pv_create_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc);
214
+int kvm_s390_pv_deinit_vm(struct kvm *kvm, u16 *rc, u16 *rrc);
215
+int kvm_s390_pv_init_vm(struct kvm *kvm, u16 *rc, u16 *rrc);
216
+int kvm_s390_pv_set_sec_parms(struct kvm *kvm, void *hdr, u64 length, u16 *rc,
217
+ u16 *rrc);
218
+int kvm_s390_pv_unpack(struct kvm *kvm, unsigned long addr, unsigned long size,
219
+ unsigned long tweak, u16 *rc, u16 *rrc);
220
+int kvm_s390_pv_set_cpu_state(struct kvm_vcpu *vcpu, u8 state);
221
+
222
+static inline u64 kvm_s390_pv_get_handle(struct kvm *kvm)
223
+{
224
+ return kvm->arch.pv.handle;
225
+}
226
+
227
+static inline u64 kvm_s390_pv_cpu_get_handle(struct kvm_vcpu *vcpu)
228
+{
229
+ return vcpu->arch.pv.handle;
230
+}
231
+
232
+static inline bool kvm_s390_pv_is_protected(struct kvm *kvm)
233
+{
234
+ lockdep_assert_held(&kvm->lock);
235
+ return !!kvm_s390_pv_get_handle(kvm);
236
+}
237
+
238
+static inline bool kvm_s390_pv_cpu_is_protected(struct kvm_vcpu *vcpu)
239
+{
240
+ lockdep_assert_held(&vcpu->mutex);
241
+ return !!kvm_s390_pv_cpu_get_handle(vcpu);
242
+}
243
+
199244 /* implemented in interrupt.c */
200245 int kvm_s390_handle_wait(struct kvm_vcpu *vcpu);
201246 void kvm_s390_vcpu_wakeup(struct kvm_vcpu *vcpu);
....@@ -281,15 +326,15 @@
281326 int kvm_s390_handle_sigp_pei(struct kvm_vcpu *vcpu);
282327
283328 /* implemented in kvm-s390.c */
284
-void kvm_s390_set_tod_clock(struct kvm *kvm,
285
- const struct kvm_s390_vm_tod_clock *gtod);
329
+int kvm_s390_try_set_tod_clock(struct kvm *kvm, const struct kvm_s390_vm_tod_clock *gtod);
286330 long kvm_arch_fault_in_page(struct kvm_vcpu *vcpu, gpa_t gpa, int writable);
287331 int kvm_s390_store_status_unloaded(struct kvm_vcpu *vcpu, unsigned long addr);
288332 int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr);
289
-void kvm_s390_vcpu_start(struct kvm_vcpu *vcpu);
290
-void kvm_s390_vcpu_stop(struct kvm_vcpu *vcpu);
333
+int kvm_s390_vcpu_start(struct kvm_vcpu *vcpu);
334
+int kvm_s390_vcpu_stop(struct kvm_vcpu *vcpu);
291335 void kvm_s390_vcpu_block(struct kvm_vcpu *vcpu);
292336 void kvm_s390_vcpu_unblock(struct kvm_vcpu *vcpu);
337
+bool kvm_s390_vcpu_sie_inhibited(struct kvm_vcpu *vcpu);
293338 void exit_sie(struct kvm_vcpu *vcpu);
294339 void kvm_s390_sync_request(int req, struct kvm_vcpu *vcpu);
295340 int kvm_s390_vcpu_setup_cmma(struct kvm_vcpu *vcpu);
....@@ -381,6 +426,8 @@
381426 void kvm_s390_gisa_init(struct kvm *kvm);
382427 void kvm_s390_gisa_clear(struct kvm *kvm);
383428 void kvm_s390_gisa_destroy(struct kvm *kvm);
429
+int kvm_s390_gib_init(u8 nisc);
430
+void kvm_s390_gib_destroy(void);
384431
385432 /* implemented in guestdbg.c */
386433 void kvm_s390_backup_guest_per_regs(struct kvm_vcpu *vcpu);