xref: /qemu/include/hw/s390x/storage-keys.h (revision 8110fa1d)
1 /*
2  * s390 storage key device
3  *
4  * Copyright 2015 IBM Corp.
5  * Author(s): Jason J. Herne <jjherne@linux.vnet.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 
12 #ifndef S390_STORAGE_KEYS_H
13 #define S390_STORAGE_KEYS_H
14 
15 #include "hw/qdev-core.h"
16 #include "monitor/monitor.h"
17 #include "qom/object.h"
18 
19 #define TYPE_S390_SKEYS "s390-skeys"
20 typedef struct S390SKeysClass S390SKeysClass;
21 typedef struct S390SKeysState S390SKeysState;
22 DECLARE_OBJ_CHECKERS(S390SKeysState, S390SKeysClass,
23                      S390_SKEYS, TYPE_S390_SKEYS)
24 
25 struct S390SKeysState {
26     DeviceState parent_obj;
27     bool migration_enabled;
28 
29 };
30 
31 
32 struct S390SKeysClass {
33     DeviceClass parent_class;
34     int (*skeys_enabled)(S390SKeysState *ks);
35     int (*get_skeys)(S390SKeysState *ks, uint64_t start_gfn, uint64_t count,
36                      uint8_t *keys);
37     int (*set_skeys)(S390SKeysState *ks, uint64_t start_gfn, uint64_t count,
38                      uint8_t *keys);
39 };
40 
41 #define TYPE_KVM_S390_SKEYS "s390-skeys-kvm"
42 #define TYPE_QEMU_S390_SKEYS "s390-skeys-qemu"
43 typedef struct QEMUS390SKeysState QEMUS390SKeysState;
44 DECLARE_INSTANCE_CHECKER(QEMUS390SKeysState, QEMU_S390_SKEYS,
45                          TYPE_QEMU_S390_SKEYS)
46 
47 struct QEMUS390SKeysState {
48     S390SKeysState parent_obj;
49     uint8_t *keydata;
50     uint32_t key_count;
51 };
52 
53 void s390_skeys_init(void);
54 
55 S390SKeysState *s390_get_skeys_device(void);
56 
57 void hmp_dump_skeys(Monitor *mon, const QDict *qdict);
58 void hmp_info_skeys(Monitor *mon, const QDict *qdict);
59 
60 #endif /* S390_STORAGE_KEYS_H */
61