multi-process: create IOHUB object to handle irq
[qemu/ar7.git] / include / hw / s390x / pv.h
blob1f1f545bfc20231604b119783ef660b379821284
1 /*
2 * Protected Virtualization header
4 * Copyright IBM Corp. 2020
5 * Author(s):
6 * Janosch Frank <frankja@linux.ibm.com>
8 * This work is licensed under the terms of the GNU GPL, version 2 or (at
9 * your option) any later version. See the COPYING file in the top-level
10 * directory.
12 #ifndef HW_S390_PV_H
13 #define HW_S390_PV_H
15 #include "qapi/error.h"
16 #include "sysemu/kvm.h"
18 #ifdef CONFIG_KVM
19 #include "cpu.h"
20 #include "hw/s390x/s390-virtio-ccw.h"
22 static inline bool s390_is_pv(void)
24 static S390CcwMachineState *ccw;
25 Object *obj;
27 if (ccw) {
28 return ccw->pv;
31 /* we have to bail out for the "none" machine */
32 obj = object_dynamic_cast(qdev_get_machine(),
33 TYPE_S390_CCW_MACHINE);
34 if (!obj) {
35 return false;
37 ccw = S390_CCW_MACHINE(obj);
38 return ccw->pv;
41 int s390_pv_vm_enable(void);
42 void s390_pv_vm_disable(void);
43 int s390_pv_set_sec_parms(uint64_t origin, uint64_t length);
44 int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak);
45 void s390_pv_prep_reset(void);
46 int s390_pv_verify(void);
47 void s390_pv_unshare(void);
48 void s390_pv_inject_reset_error(CPUState *cs);
49 #else /* CONFIG_KVM */
50 static inline bool s390_is_pv(void) { return false; }
51 static inline int s390_pv_vm_enable(void) { return 0; }
52 static inline void s390_pv_vm_disable(void) {}
53 static inline int s390_pv_set_sec_parms(uint64_t origin, uint64_t length) { return 0; }
54 static inline int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak) { return 0; }
55 static inline void s390_pv_prep_reset(void) {}
56 static inline int s390_pv_verify(void) { return 0; }
57 static inline void s390_pv_unshare(void) {}
58 static inline void s390_pv_inject_reset_error(CPUState *cs) {};
59 #endif /* CONFIG_KVM */
61 int s390_pv_kvm_init(ConfidentialGuestSupport *cgs, Error **errp);
62 static inline int s390_pv_init(ConfidentialGuestSupport *cgs, Error **errp)
64 if (!cgs) {
65 return 0;
67 if (kvm_enabled()) {
68 return s390_pv_kvm_init(cgs, errp);
71 error_setg(errp, "Protected Virtualization requires KVM");
72 return -1;
75 #endif /* HW_S390_PV_H */