storage-attributes.h 2.3 KB

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