1903fd80bSClaudio Imbrenda /* 2903fd80bSClaudio Imbrenda * s390 storage attributes device 3903fd80bSClaudio Imbrenda * 4903fd80bSClaudio Imbrenda * Copyright 2016 IBM Corp. 5903fd80bSClaudio Imbrenda * Author(s): Claudio Imbrenda <imbrenda@linux.vnet.ibm.com> 6903fd80bSClaudio Imbrenda * 7903fd80bSClaudio Imbrenda * This work is licensed under the terms of the GNU GPL, version 2 or (at 8903fd80bSClaudio Imbrenda * your option) any later version. See the COPYING file in the top-level 9903fd80bSClaudio Imbrenda * directory. 10903fd80bSClaudio Imbrenda */ 11903fd80bSClaudio Imbrenda 12903fd80bSClaudio Imbrenda #ifndef S390_STORAGE_ATTRIBUTES_H 13903fd80bSClaudio Imbrenda #define S390_STORAGE_ATTRIBUTES_H 14903fd80bSClaudio Imbrenda 15a27bd6c7SMarkus Armbruster #include "hw/qdev-core.h" 16f860d497SClaudio Imbrenda #include "monitor/monitor.h" 17db1015e9SEduardo Habkost #include "qom/object.h" 18903fd80bSClaudio Imbrenda 19903fd80bSClaudio Imbrenda #define TYPE_S390_STATTRIB "s390-storage_attributes" 20903fd80bSClaudio Imbrenda #define TYPE_QEMU_S390_STATTRIB "s390-storage_attributes-qemu" 21903fd80bSClaudio Imbrenda #define TYPE_KVM_S390_STATTRIB "s390-storage_attributes-kvm" 22903fd80bSClaudio Imbrenda 23*a489d195SEduardo Habkost OBJECT_DECLARE_TYPE(S390StAttribState, S390StAttribClass, S390_STATTRIB) 24903fd80bSClaudio Imbrenda 25db1015e9SEduardo Habkost struct S390StAttribState { 26903fd80bSClaudio Imbrenda DeviceState parent_obj; 27903fd80bSClaudio Imbrenda uint64_t migration_cur_gfn; 28903fd80bSClaudio Imbrenda bool migration_enabled; 29db1015e9SEduardo Habkost }; 30903fd80bSClaudio Imbrenda 31903fd80bSClaudio Imbrenda 32db1015e9SEduardo Habkost struct S390StAttribClass { 33903fd80bSClaudio Imbrenda DeviceClass parent_class; 34903fd80bSClaudio Imbrenda /* Return value: < 0 on error, or new count */ 35903fd80bSClaudio Imbrenda int (*get_stattr)(S390StAttribState *sa, uint64_t *start_gfn, 36903fd80bSClaudio Imbrenda uint32_t count, uint8_t *values); 37903fd80bSClaudio Imbrenda int (*peek_stattr)(S390StAttribState *sa, uint64_t start_gfn, 38903fd80bSClaudio Imbrenda uint32_t count, uint8_t *values); 39903fd80bSClaudio Imbrenda int (*set_stattr)(S390StAttribState *sa, uint64_t start_gfn, 40903fd80bSClaudio Imbrenda uint32_t count, uint8_t *values); 41903fd80bSClaudio Imbrenda void (*synchronize)(S390StAttribState *sa); 42903fd80bSClaudio Imbrenda int (*set_migrationmode)(S390StAttribState *sa, bool value); 43903fd80bSClaudio Imbrenda int (*get_active)(S390StAttribState *sa); 44903fd80bSClaudio Imbrenda long long (*get_dirtycount)(S390StAttribState *sa); 45db1015e9SEduardo Habkost }; 46903fd80bSClaudio Imbrenda 47db1015e9SEduardo Habkost typedef struct QEMUS390StAttribState QEMUS390StAttribState; 488110fa1dSEduardo Habkost DECLARE_INSTANCE_CHECKER(QEMUS390StAttribState, QEMU_S390_STATTRIB, 498110fa1dSEduardo Habkost TYPE_QEMU_S390_STATTRIB) 50903fd80bSClaudio Imbrenda 51db1015e9SEduardo Habkost struct QEMUS390StAttribState { 52903fd80bSClaudio Imbrenda S390StAttribState parent_obj; 53db1015e9SEduardo Habkost }; 54903fd80bSClaudio Imbrenda 55db1015e9SEduardo Habkost typedef struct KVMS390StAttribState KVMS390StAttribState; 568110fa1dSEduardo Habkost DECLARE_INSTANCE_CHECKER(KVMS390StAttribState, KVM_S390_STATTRIB, 578110fa1dSEduardo Habkost TYPE_KVM_S390_STATTRIB) 58903fd80bSClaudio Imbrenda 59db1015e9SEduardo Habkost struct KVMS390StAttribState { 60903fd80bSClaudio Imbrenda S390StAttribState parent_obj; 61903fd80bSClaudio Imbrenda uint64_t still_dirty; 62903fd80bSClaudio Imbrenda uint8_t *incoming_buffer; 63db1015e9SEduardo Habkost }; 64903fd80bSClaudio Imbrenda 65903fd80bSClaudio Imbrenda void s390_stattrib_init(void); 66903fd80bSClaudio Imbrenda 67903fd80bSClaudio Imbrenda #ifdef CONFIG_KVM 68903fd80bSClaudio Imbrenda Object *kvm_s390_stattrib_create(void); 69903fd80bSClaudio Imbrenda #else 70903fd80bSClaudio Imbrenda static inline Object *kvm_s390_stattrib_create(void) 71903fd80bSClaudio Imbrenda { 72903fd80bSClaudio Imbrenda return NULL; 73903fd80bSClaudio Imbrenda } 74903fd80bSClaudio Imbrenda #endif 75903fd80bSClaudio Imbrenda 76f860d497SClaudio Imbrenda void hmp_info_cmma(Monitor *mon, const QDict *qdict); 77f860d497SClaudio Imbrenda void hmp_migrationmode(Monitor *mon, const QDict *qdict); 78f860d497SClaudio Imbrenda 79903fd80bSClaudio Imbrenda #endif /* S390_STORAGE_ATTRIBUTES_H */ 80