acpi_mem_hotplug.rst 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. QEMU<->ACPI BIOS memory hotplug interface
  2. =========================================
  3. ACPI BIOS GPE.3 handler is dedicated for notifying OS about memory hot-add
  4. and hot-remove events.
  5. Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access)
  6. ----------------------------------------------------------------
  7. Read access behavior
  8. ^^^^^^^^^^^^^^^^^^^^
  9. [0x0-0x3]
  10. Lo part of memory device phys address
  11. [0x4-0x7]
  12. Hi part of memory device phys address
  13. [0x8-0xb]
  14. Lo part of memory device size in bytes
  15. [0xc-0xf]
  16. Hi part of memory device size in bytes
  17. [0x10-0x13]
  18. Memory device proximity domain
  19. [0x14]
  20. Memory device status fields
  21. bits:
  22. 0:
  23. Device is enabled and may be used by guest
  24. 1:
  25. Device insert event, used to distinguish device for which
  26. no device check event to OSPM was issued.
  27. It's valid only when bit 1 is set.
  28. 2:
  29. Device remove event, used to distinguish device for which
  30. no device eject request to OSPM was issued.
  31. 3-7:
  32. reserved and should be ignored by OSPM
  33. [0x15-0x17]
  34. reserved
  35. Write access behavior
  36. ^^^^^^^^^^^^^^^^^^^^^
  37. [0x0-0x3]
  38. Memory device slot selector, selects active memory device.
  39. All following accesses to other registers in 0xa00-0xa17
  40. region will read/store data from/to selected memory device.
  41. [0x4-0x7]
  42. OST event code reported by OSPM
  43. [0x8-0xb]
  44. OST status code reported by OSPM
  45. [0xc-0x13]
  46. reserved, writes into it are ignored
  47. [0x14]
  48. Memory device control fields
  49. bits:
  50. 0:
  51. reserved, OSPM must clear it before writing to register.
  52. Due to BUG in versions prior 2.4 that field isn't cleared
  53. when other fields are written. Keep it reserved and don't
  54. try to reuse it.
  55. 1:
  56. if set to 1 clears device insert event, set by OSPM
  57. after it has emitted device check event for the
  58. selected memory device
  59. 2:
  60. if set to 1 clears device remove event, set by OSPM
  61. after it has emitted device eject request for the
  62. selected memory device
  63. 3:
  64. if set to 1 initiates device eject, set by OSPM when it
  65. triggers memory device removal and calls _EJ0 method
  66. 4-7:
  67. reserved, OSPM must clear them before writing to register
  68. Selecting memory device slot beyond present range has no effect on platform:
  69. - write accesses to memory hot-plug registers not documented above are ignored
  70. - read accesses to memory hot-plug registers not documented above return
  71. all bits set to 1.
  72. Memory hot remove process diagram
  73. ---------------------------------
  74. ::
  75. +-------------+ +-----------------------+ +------------------+
  76. | 1. QEMU | | 2. QEMU | |3. QEMU |
  77. | device_del +---->+ device unplug request +----->+Send SCI to guest,|
  78. | | | cb | |return control to |
  79. | | | | |management |
  80. +-------------+ +-----------------------+ +------------------+
  81. +---------------------------------------------------------------------+
  82. +---------------------+ +-------------------------+
  83. | OSPM: | remove event | OSPM: |
  84. | send Eject Request, | | Scan memory devices |
  85. | clear remove event +<-------------+ for event flags |
  86. | | | |
  87. +---------------------+ +-------------------------+
  88. |
  89. |
  90. +---------v--------+ +-----------------------+
  91. | Guest OS: | success | OSPM: |
  92. | process Ejection +----------->+ Execute _EJ0 method, |
  93. | request | | set eject bit in flags|
  94. +------------------+ +-----------------------+
  95. |failure |
  96. v v
  97. +------------------------+ +-----------------------+
  98. | OSPM: | | QEMU: |
  99. | set OST event & status | | call device unplug cb |
  100. | fields | | |
  101. +------------------------+ +-----------------------+
  102. | |
  103. v v
  104. +------------------+ +-------------------+
  105. |QEMU: | |QEMU: |
  106. |Send OST QMP event| |Send device deleted|
  107. | | |QMP event |
  108. +------------------+ | |
  109. +-------------------+