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/qdev-core.h" 16 #include "monitor/monitor.h" 17 #include "qom/object.h" 18 19 #define TYPE_S390_STATTRIB "s390-storage_attributes" 20 #define TYPE_QEMU_S390_STATTRIB "s390-storage_attributes-qemu" 21 #define TYPE_KVM_S390_STATTRIB "s390-storage_attributes-kvm" 22 23 typedef struct S390StAttribClass S390StAttribClass; 24 typedef struct S390StAttribState S390StAttribState; 25 DECLARE_OBJ_CHECKERS(S390StAttribState, S390StAttribClass, 26 S390_STATTRIB, TYPE_S390_STATTRIB) 27 28 struct S390StAttribState { 29 DeviceState parent_obj; 30 uint64_t migration_cur_gfn; 31 bool migration_enabled; 32 }; 33 34 35 struct S390StAttribClass { 36 DeviceClass parent_class; 37 /* Return value: < 0 on error, or new count */ 38 int (*get_stattr)(S390StAttribState *sa, uint64_t *start_gfn, 39 uint32_t count, uint8_t *values); 40 int (*peek_stattr)(S390StAttribState *sa, uint64_t start_gfn, 41 uint32_t count, uint8_t *values); 42 int (*set_stattr)(S390StAttribState *sa, uint64_t start_gfn, 43 uint32_t count, uint8_t *values); 44 void (*synchronize)(S390StAttribState *sa); 45 int (*set_migrationmode)(S390StAttribState *sa, bool value); 46 int (*get_active)(S390StAttribState *sa); 47 long long (*get_dirtycount)(S390StAttribState *sa); 48 }; 49 50 typedef struct QEMUS390StAttribState QEMUS390StAttribState; 51 DECLARE_INSTANCE_CHECKER(QEMUS390StAttribState, QEMU_S390_STATTRIB, 52 TYPE_QEMU_S390_STATTRIB) 53 54 struct QEMUS390StAttribState { 55 S390StAttribState parent_obj; 56 }; 57 58 typedef struct KVMS390StAttribState KVMS390StAttribState; 59 DECLARE_INSTANCE_CHECKER(KVMS390StAttribState, KVM_S390_STATTRIB, 60 TYPE_KVM_S390_STATTRIB) 61 62 struct KVMS390StAttribState { 63 S390StAttribState parent_obj; 64 uint64_t still_dirty; 65 uint8_t *incoming_buffer; 66 }; 67 68 void s390_stattrib_init(void); 69 70 #ifdef CONFIG_KVM 71 Object *kvm_s390_stattrib_create(void); 72 #else 73 static inline Object *kvm_s390_stattrib_create(void) 74 { 75 return NULL; 76 } 77 #endif 78 79 void hmp_info_cmma(Monitor *mon, const QDict *qdict); 80 void hmp_migrationmode(Monitor *mon, const QDict *qdict); 81 82 #endif /* S390_STORAGE_ATTRIBUTES_H */ 83