Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-4.1-sf1-v3' into...
[qemu/ar7.git] / include / hw / s390x / storage-keys.h
blob62df48ec06d2d3b18ae3679d5f88ebf7d371b401
1 /*
2 * s390 storage key device
4 * Copyright 2015 IBM Corp.
5 * Author(s): Jason J. Herne <jjherne@linux.vnet.ibm.com>
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.
12 #ifndef S390_STORAGE_KEYS_H
13 #define S390_STORAGE_KEYS_H
15 #include "hw/qdev.h"
16 #include "monitor/monitor.h"
18 #define TYPE_S390_SKEYS "s390-skeys"
19 #define S390_SKEYS(obj) \
20 OBJECT_CHECK(S390SKeysState, (obj), TYPE_S390_SKEYS)
22 typedef struct S390SKeysState {
23 DeviceState parent_obj;
24 bool migration_enabled;
26 } S390SKeysState;
28 #define S390_SKEYS_CLASS(klass) \
29 OBJECT_CLASS_CHECK(S390SKeysClass, (klass), TYPE_S390_SKEYS)
30 #define S390_SKEYS_GET_CLASS(obj) \
31 OBJECT_GET_CLASS(S390SKeysClass, (obj), TYPE_S390_SKEYS)
33 typedef struct S390SKeysClass {
34 DeviceClass parent_class;
35 int (*skeys_enabled)(S390SKeysState *ks);
36 int (*get_skeys)(S390SKeysState *ks, uint64_t start_gfn, uint64_t count,
37 uint8_t *keys);
38 int (*set_skeys)(S390SKeysState *ks, uint64_t start_gfn, uint64_t count,
39 uint8_t *keys);
40 } S390SKeysClass;
42 #define TYPE_KVM_S390_SKEYS "s390-skeys-kvm"
43 #define TYPE_QEMU_S390_SKEYS "s390-skeys-qemu"
44 #define QEMU_S390_SKEYS(obj) \
45 OBJECT_CHECK(QEMUS390SKeysState, (obj), TYPE_QEMU_S390_SKEYS)
47 typedef struct QEMUS390SKeysState {
48 S390SKeysState parent_obj;
49 uint8_t *keydata;
50 uint32_t key_count;
51 } QEMUS390SKeysState;
53 void s390_skeys_init(void);
55 S390SKeysState *s390_get_skeys_device(void);
57 void hmp_dump_skeys(Monitor *mon, const QDict *qdict);
58 void hmp_info_skeys(Monitor *mon, const QDict *qdict);
60 #endif /* S390_STORAGE_KEYS_H */