s390x: protvirt: Support unpack facility
[qemu/ar7.git] / include / hw / s390x / pv.h
blobc6cb360f2f6a0a32a37970769e1bf2eb0220b199
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 #ifdef CONFIG_KVM
16 #include "hw/s390x/s390-virtio-ccw.h"
18 static inline bool s390_is_pv(void)
20 static S390CcwMachineState *ccw;
21 Object *obj;
23 if (ccw) {
24 return ccw->pv;
27 /* we have to bail out for the "none" machine */
28 obj = object_dynamic_cast(qdev_get_machine(),
29 TYPE_S390_CCW_MACHINE);
30 if (!obj) {
31 return false;
33 ccw = S390_CCW_MACHINE(obj);
34 return ccw->pv;
37 int s390_pv_vm_enable(void);
38 void s390_pv_vm_disable(void);
39 int s390_pv_set_sec_parms(uint64_t origin, uint64_t length);
40 int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak);
41 void s390_pv_perf_clear_reset(void);
42 int s390_pv_verify(void);
43 void s390_pv_unshare(void);
44 #else /* CONFIG_KVM */
45 static inline bool s390_is_pv(void) { return false; }
46 static inline int s390_pv_vm_enable(void) { return 0; }
47 static inline void s390_pv_vm_disable(void) {}
48 static inline int s390_pv_set_sec_parms(uint64_t origin, uint64_t length) { return 0; }
49 static inline int s390_pv_unpack(uint64_t addr, uint64_t size, uint64_t tweak) { return 0; }
50 static inline void s390_pv_perf_clear_reset(void) {}
51 static inline int s390_pv_verify(void) { return 0; }
52 static inline void s390_pv_unshare(void) {}
53 #endif /* CONFIG_KVM */
55 #endif /* HW_S390_PV_H */