xref: /qemu/include/hw/s390x/s390-virtio-ccw.h (revision a056332e732110c8ef0d40ffd49bd03afc2f04ca)
1 /*
2  * virtio ccw machine definitions
3  *
4  * Copyright 2012, 2016 IBM Corp.
5  * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
6  *
7  * This work is licensed under the terms of the GNU GPL, version 2 or (at
8  * your option) any later version. See the COPYING file in the top-level
9  * directory.
10  */
11 #ifndef HW_S390X_S390_VIRTIO_CCW_H
12 #define HW_S390X_S390_VIRTIO_CCW_H
13 
14 #include "hw/boards.h"
15 #include "qom/object.h"
16 #include "hw/s390x/sclp.h"
17 
18 #define TYPE_S390_CCW_MACHINE               "s390-ccw-machine"
19 
20 OBJECT_DECLARE_TYPE(S390CcwMachineState, S390CcwMachineClass, S390_CCW_MACHINE)
21 
22 
23 struct S390CcwMachineState {
24     /*< private >*/
25     MachineState parent_obj;
26 
27     /*< public >*/
28     bool aes_key_wrap;
29     bool dea_key_wrap;
30     bool pv;
31     uint8_t loadparm[8];
32     uint64_t memory_limit;
33 
34     SCLPDevice *sclp;
35 };
36 
37 static inline uint64_t s390_get_memory_limit(S390CcwMachineState *s390ms)
38 {
39     /* We expect to be called only after the limit was set. */
40     assert(s390ms->memory_limit);
41     return s390ms->memory_limit;
42 }
43 
44 #define S390_PTF_REASON_NONE (0x00 << 8)
45 #define S390_PTF_REASON_DONE (0x01 << 8)
46 #define S390_PTF_REASON_BUSY (0x02 << 8)
47 #define S390_TOPO_FC_MASK 0xffUL
48 void s390_handle_ptf(S390CPU *cpu, uint8_t r1, uintptr_t ra);
49 
50 struct S390CcwMachineClass {
51     /*< private >*/
52     MachineClass parent_class;
53 
54     /*< public >*/
55     bool ri_allowed;
56     bool cpu_model_allowed;
57     bool hpage_1m_allowed;
58     int max_threads;
59 };
60 
61 /* runtime-instrumentation allowed by the machine */
62 bool ri_allowed(void);
63 /* cpu model allowed by the machine */
64 bool cpu_model_allowed(void);
65 /* 1M huge page mappings allowed by the machine */
66 bool hpage_1m_allowed(void);
67 
68 #endif
69