Claudio Imbrenda | 903fd80 | 2016-08-15 18:43:14 +0200 | [diff] [blame] | 1 | /* |
| 2 | * s390 storage attributes device |
| 3 | * |
| 4 | * Copyright 2016 IBM Corp. |
| 5 | * Author(s): Claudio Imbrenda <imbrenda@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_ATTRIBUTES_H |
| 13 | #define S390_STORAGE_ATTRIBUTES_H |
| 14 | |
Markus Armbruster | a27bd6c | 2019-08-12 07:23:51 +0200 | [diff] [blame] | 15 | #include "hw/qdev-core.h" |
Claudio Imbrenda | f860d49 | 2016-08-15 18:44:04 +0200 | [diff] [blame] | 16 | #include "monitor/monitor.h" |
Claudio Imbrenda | 903fd80 | 2016-08-15 18:43:14 +0200 | [diff] [blame] | 17 | |
| 18 | #define TYPE_S390_STATTRIB "s390-storage_attributes" |
| 19 | #define TYPE_QEMU_S390_STATTRIB "s390-storage_attributes-qemu" |
| 20 | #define TYPE_KVM_S390_STATTRIB "s390-storage_attributes-kvm" |
| 21 | |
| 22 | #define S390_STATTRIB(obj) \ |
| 23 | OBJECT_CHECK(S390StAttribState, (obj), TYPE_S390_STATTRIB) |
| 24 | |
| 25 | typedef struct S390StAttribState { |
| 26 | DeviceState parent_obj; |
| 27 | uint64_t migration_cur_gfn; |
| 28 | bool migration_enabled; |
| 29 | } S390StAttribState; |
| 30 | |
| 31 | #define S390_STATTRIB_CLASS(klass) \ |
| 32 | OBJECT_CLASS_CHECK(S390StAttribClass, (klass), TYPE_S390_STATTRIB) |
| 33 | #define S390_STATTRIB_GET_CLASS(obj) \ |
| 34 | OBJECT_GET_CLASS(S390StAttribClass, (obj), TYPE_S390_STATTRIB) |
| 35 | |
| 36 | typedef struct S390StAttribClass { |
| 37 | DeviceClass parent_class; |
| 38 | /* Return value: < 0 on error, or new count */ |
| 39 | int (*get_stattr)(S390StAttribState *sa, uint64_t *start_gfn, |
| 40 | uint32_t count, uint8_t *values); |
| 41 | int (*peek_stattr)(S390StAttribState *sa, uint64_t start_gfn, |
| 42 | uint32_t count, uint8_t *values); |
| 43 | int (*set_stattr)(S390StAttribState *sa, uint64_t start_gfn, |
| 44 | uint32_t count, uint8_t *values); |
| 45 | void (*synchronize)(S390StAttribState *sa); |
| 46 | int (*set_migrationmode)(S390StAttribState *sa, bool value); |
| 47 | int (*get_active)(S390StAttribState *sa); |
| 48 | long long (*get_dirtycount)(S390StAttribState *sa); |
| 49 | } S390StAttribClass; |
| 50 | |
| 51 | #define QEMU_S390_STATTRIB(obj) \ |
| 52 | OBJECT_CHECK(QEMUS390StAttribState, (obj), TYPE_QEMU_S390_STATTRIB) |
| 53 | |
| 54 | typedef struct QEMUS390StAttribState { |
| 55 | S390StAttribState parent_obj; |
| 56 | } QEMUS390StAttribState; |
| 57 | |
| 58 | #define KVM_S390_STATTRIB(obj) \ |
| 59 | OBJECT_CHECK(KVMS390StAttribState, (obj), TYPE_KVM_S390_STATTRIB) |
| 60 | |
| 61 | typedef struct KVMS390StAttribState { |
| 62 | S390StAttribState parent_obj; |
| 63 | uint64_t still_dirty; |
| 64 | uint8_t *incoming_buffer; |
| 65 | } KVMS390StAttribState; |
| 66 | |
| 67 | void s390_stattrib_init(void); |
| 68 | |
| 69 | #ifdef CONFIG_KVM |
| 70 | Object *kvm_s390_stattrib_create(void); |
| 71 | #else |
| 72 | static inline Object *kvm_s390_stattrib_create(void) |
| 73 | { |
| 74 | return NULL; |
| 75 | } |
| 76 | #endif |
| 77 | |
Claudio Imbrenda | f860d49 | 2016-08-15 18:44:04 +0200 | [diff] [blame] | 78 | void hmp_info_cmma(Monitor *mon, const QDict *qdict); |
| 79 | void hmp_migrationmode(Monitor *mon, const QDict *qdict); |
| 80 | |
Claudio Imbrenda | 903fd80 | 2016-08-15 18:43:14 +0200 | [diff] [blame] | 81 | #endif /* S390_STORAGE_ATTRIBUTES_H */ |