2 * Protected Virtualization header
4 * Copyright IBM Corp. 2020
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
15 #include "qapi/error.h"
16 #include "sysemu/kvm.h"
20 #include "hw/s390x/s390-virtio-ccw.h"
22 static inline bool s390_is_pv(void)
24 static S390CcwMachineState
*ccw
;
31 /* we have to bail out for the "none" machine */
32 obj
= object_dynamic_cast(qdev_get_machine(),
33 TYPE_S390_CCW_MACHINE
);
37 ccw
= S390_CCW_MACHINE(obj
);
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
)
68 return s390_pv_kvm_init(cgs
, errp
);
71 error_setg(errp
, "Protected Virtualization requires KVM");
75 #endif /* HW_S390_PV_H */