| 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 | |
| 15 | #include "hw/core/qdev.h" |
| 16 | #include "qom/object.h" |
| 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 | OBJECT_DECLARE_TYPE(S390StAttribState, S390StAttribClass, S390_STATTRIB) |
| 23 | |
| 24 | struct S390StAttribState { |
| 25 | DeviceState parent_obj; |
| 26 | uint64_t migration_cur_gfn; |
| 27 | }; |
| 28 | |
| 29 | |
| 30 | struct S390StAttribClass { |
| 31 | DeviceClass parent_class; |
| 32 | /* Return value: < 0 on error, or new count */ |
| 33 | int (*get_stattr)(S390StAttribState *sa, uint64_t *start_gfn, |
| 34 | uint32_t count, uint8_t *values); |
| 35 | int (*peek_stattr)(S390StAttribState *sa, uint64_t start_gfn, |
| 36 | uint32_t count, uint8_t *values); |
| 37 | int (*set_stattr)(S390StAttribState *sa, uint64_t start_gfn, |
| 38 | uint32_t count, uint8_t *values); |
| 39 | void (*synchronize)(S390StAttribState *sa); |
| 40 | int (*set_migrationmode)(S390StAttribState *sa, bool value, Error **errp); |
| 41 | int (*get_active)(S390StAttribState *sa); |
| 42 | long long (*get_dirtycount)(S390StAttribState *sa); |
| 43 | }; |
| 44 | |
| 45 | typedef struct QEMUS390StAttribState QEMUS390StAttribState; |
| 46 | DECLARE_INSTANCE_CHECKER(QEMUS390StAttribState, QEMU_S390_STATTRIB, |
| 47 | TYPE_QEMU_S390_STATTRIB) |
| 48 | |
| 49 | struct QEMUS390StAttribState { |
| 50 | S390StAttribState parent_obj; |
| 51 | }; |
| 52 | |
| 53 | typedef struct KVMS390StAttribState KVMS390StAttribState; |
| 54 | DECLARE_INSTANCE_CHECKER(KVMS390StAttribState, KVM_S390_STATTRIB, |
| 55 | TYPE_KVM_S390_STATTRIB) |
| 56 | |
| 57 | struct KVMS390StAttribState { |
| 58 | S390StAttribState parent_obj; |
| 59 | uint64_t still_dirty; |
| 60 | uint8_t *incoming_buffer; |
| 61 | }; |
| 62 | |
| 63 | void s390_stattrib_init(void); |
| 64 | |
| 65 | #ifdef CONFIG_KVM |
| 66 | Object *kvm_s390_stattrib_create(void); |
| 67 | #else |
| 68 | static inline Object *kvm_s390_stattrib_create(void) |
| 69 | { |
| 70 | return NULL; |
| 71 | } |
| 72 | #endif |
| 73 | |
| 74 | #endif /* S390_STORAGE_ATTRIBUTES_H */ |