Acked-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
qapi/machine.json | 131 +++++++++++++++++++++++++++++++
qapi/misc.json | 132 --------------------------------
include/hw/mem/memory-device.h | 1 +
include/hw/virtio/virtio-pmem.h | 2 +-
4 files changed, 133 insertions(+), 133 deletions(-)
diff --git a/qapi/machine.json b/qapi/machine.json
index 3ab1089a44..d1490edeb1 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -1519,3 +1519,134 @@
#
##
{ 'command': 'query-pci', 'returns': ['PciInfo'] }
+
+##
+# @MemoryInfo:
+#
+# Actual memory information in bytes.
+#
+# @base-memory: size of "base" memory specified with command line
+# option -m.
+#
+# @plugged-memory: size of memory that can be hot-unplugged. This field
+# is omitted if target doesn't support memory hotplug
+# (i.e. CONFIG_MEM_DEVICE not defined at build time).
+#
+# Since: 2.11.0
+##
+{ 'struct': 'MemoryInfo',
+ 'data' : { 'base-memory': 'size', '*plugged-memory': 'size' } }
+
+##
+# @query-memory-size-summary:
+#
+# Return the amount of initially allocated and present hotpluggable (if
+# enabled) memory in bytes.
+#
+# Example:
+#
+# -> { "execute": "query-memory-size-summary" }
+# <- { "return": { "base-memory": 4294967296, "plugged-memory": 0 } }
+#
+# Since: 2.11.0
+##
+{ 'command': 'query-memory-size-summary', 'returns': 'MemoryInfo' }
+
+##
+# @PCDIMMDeviceInfo:
+#
+# PCDIMMDevice state information
+#
+# @id: device's ID
+#
+# @addr: physical address, where device is mapped
+#
+# @size: size of memory that the device provides
+#
+# @slot: slot number at which device is plugged in
+#
+# @node: NUMA node number where device is plugged in
+#
+# @memdev: memory backend linked with device
+#
+# @hotplugged: true if device was hotplugged
+#
+# @hotpluggable: true if device if could be added/removed while machine is running
+#
+# Since: 2.1
+##
+{ 'struct': 'PCDIMMDeviceInfo',
+ 'data': { '*id': 'str',
+ 'addr': 'int',
+ 'size': 'int',
+ 'slot': 'int',
+ 'node': 'int',
+ 'memdev': 'str',
+ 'hotplugged': 'bool',
+ 'hotpluggable': 'bool'
+ }
+}
+
+##
+# @VirtioPMEMDeviceInfo:
+#
+# VirtioPMEM state information
+#
+# @id: device's ID
+#
+# @memaddr: physical address in memory, where device is mapped
+#
+# @size: size of memory that the device provides
+#
+# @memdev: memory backend linked with device
+#
+# Since: 4.1
+##
+{ 'struct': 'VirtioPMEMDeviceInfo',
+ 'data': { '*id': 'str',
+ 'memaddr': 'size',
+ 'size': 'size',
+ 'memdev': 'str'
+ }
+}
+
+##
+# @MemoryDeviceInfo:
+#
+# Union containing information about a memory device
+#
+# nvdimm is included since 2.12. virtio-pmem is included since 4.1.
+#
+# Since: 2.1
+##
+{ 'union': 'MemoryDeviceInfo',
+ 'data': { 'dimm': 'PCDIMMDeviceInfo',
+ 'nvdimm': 'PCDIMMDeviceInfo',
+ 'virtio-pmem': 'VirtioPMEMDeviceInfo'
+ }
+}
+
+##
+# @query-memory-devices:
+#
+# Lists available memory devices and their state
+#
+# Since: 2.1
+#
+# Example:
+#
+# -> { "execute": "query-memory-devices" }
+# <- { "return": [ { "data":
+# { "addr": 5368709120,
+# "hotpluggable": true,
+# "hotplugged": true,
+# "id": "d1",
+# "memdev": "/objects/memX",
+# "node": 0,
+# "size": 1073741824,
+# "slot": 0},
+# "type": "dimm"
+# } ] }
+#
+##
+{ 'command': 'query-memory-devices', 'returns': ['MemoryDeviceInfo'] }
diff --git a/qapi/misc.json b/qapi/misc.json
index 3f4add1c2e..d241f67bad 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -519,39 +519,6 @@
##
{ 'command': 'closefd', 'data': {'fdname': 'str'} }
-##
-# @MemoryInfo:
-#
-# Actual memory information in bytes.
-#
-# @base-memory: size of "base" memory specified with command line
-# option -m.
-#
-# @plugged-memory: size of memory that can be hot-unplugged. This field
-# is omitted if target doesn't support memory hotplug
-# (i.e. CONFIG_MEM_DEVICE not defined at build time).
-#
-# Since: 2.11.0
-##
-{ 'struct': 'MemoryInfo',
- 'data' : { 'base-memory': 'size', '*plugged-memory': 'size' } }
-
-##
-# @query-memory-size-summary:
-#
-# Return the amount of initially allocated and present hotpluggable (if
-# enabled) memory in bytes.
-#
-# Example:
-#
-# -> { "execute": "query-memory-size-summary" }
-# <- { "return": { "base-memory": 4294967296, "plugged-memory": 0 } }
-#
-# Since: 2.11.0
-##
-{ 'command': 'query-memory-size-summary', 'returns': 'MemoryInfo' }
-
-
##
# @AddfdInfo:
#
@@ -789,105 +756,6 @@
'returns': ['CommandLineOptionInfo'],
'allow-preconfig': true }
-##
-# @PCDIMMDeviceInfo:
-#
-# PCDIMMDevice state information
-#
-# @id: device's ID
-#
-# @addr: physical address, where device is mapped
-#
-# @size: size of memory that the device provides
-#
-# @slot: slot number at which device is plugged in
-#
-# @node: NUMA node number where device is plugged in
-#
-# @memdev: memory backend linked with device
-#
-# @hotplugged: true if device was hotplugged
-#
-# @hotpluggable: true if device if could be added/removed while machine is running
-#
-# Since: 2.1
-##
-{ 'struct': 'PCDIMMDeviceInfo',
- 'data': { '*id': 'str',
- 'addr': 'int',
- 'size': 'int',
- 'slot': 'int',
- 'node': 'int',
- 'memdev': 'str',
- 'hotplugged': 'bool',
- 'hotpluggable': 'bool'
- }
-}
-
-##
-# @VirtioPMEMDeviceInfo:
-#
-# VirtioPMEM state information
-#
-# @id: device's ID
-#
-# @memaddr: physical address in memory, where device is mapped
-#
-# @size: size of memory that the device provides
-#
-# @memdev: memory backend linked with device
-#
-# Since: 4.1
-##
-{ 'struct': 'VirtioPMEMDeviceInfo',
- 'data': { '*id': 'str',
- 'memaddr': 'size',
- 'size': 'size',
- 'memdev': 'str'
- }
-}
-
-##
-# @MemoryDeviceInfo:
-#
-# Union containing information about a memory device
-#
-# nvdimm is included since 2.12. virtio-pmem is included since 4.1.
-#
-# Since: 2.1
-##
-{ 'union': 'MemoryDeviceInfo',
- 'data': { 'dimm': 'PCDIMMDeviceInfo',
- 'nvdimm': 'PCDIMMDeviceInfo',
- 'virtio-pmem': 'VirtioPMEMDeviceInfo'
- }
-}
-
-##
-# @query-memory-devices:
-#
-# Lists available memory devices and their state
-#
-# Since: 2.1
-#
-# Example:
-#
-# -> { "execute": "query-memory-devices" }
-# <- { "return": [ { "data":
-# { "addr": 5368709120,
-# "hotpluggable": true,
-# "hotplugged": true,
-# "id": "d1",
-# "memdev": "/objects/memX",
-# "node": 0,
-# "size": 1073741824,
-# "slot": 0},
-# "type": "dimm"
-# } ] }
-#
-##
-{ 'command': 'query-memory-devices', 'returns': ['MemoryDeviceInfo'] }
-
##
# @ReplayMode:
#
diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h
index 04476acb8f..76f3de0f7e 100644
--- a/include/hw/mem/memory-device.h
+++ b/include/hw/mem/memory-device.h
@@ -14,6 +14,7 @@
#define MEMORY_DEVICE_H
#include "hw/qdev-core.h"
+#include "qapi/qapi-types-machine.h"
#include "qapi/qapi-types-misc.h"
#include "qom/object.h"
diff --git a/include/hw/virtio/virtio-pmem.h b/include/hw/virtio/virtio-pmem.h
index 33f1999320..72863412b2 100644
--- a/include/hw/virtio/virtio-pmem.h
+++ b/include/hw/virtio/virtio-pmem.h
@@ -15,7 +15,7 @@
#define HW_VIRTIO_PMEM_H
#include "hw/virtio/virtio.h"
-#include "qapi/qapi-types-misc.h"
+#include "qapi/qapi-types-machine.h"
#define TYPE_VIRTIO_PMEM "virtio-pmem"
--
2.21.3
Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> Acked-by: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
All patches: drop the /misc from qapi/misc: in the title, if you don't
mind.
Observation:
before series after
machine-target.json 14KiB in 325 lines 15KiB in 370 lines
machine.json 24KiB in 933 lines 43KiB in 1652 lines
misc.json 38KiB in 1552 lines 18KiB in 796 lines
machine.json is becoming too big. Can we move some parts to new modules
instead? Bonus: these modules can then be covered properly in
MAINTAINERS, unlike the machine.json grabbag.
Obvious candidates for moving to new modules:
* PATCH 8 PCI (304 lines)
This stuff belongs to MAINTAINERS section "PCI".
Michael, Marcel, any objections to new qapi/pci.json?
The QMP command code already lives in hw/pci/pci.c: qmp_query_pci().
Elsewhere, we keep QMP command code in files named like
hw/pci/pci-qmp-cmds.c, but that's probably overkill for just one
command.
* PATCH 7 ACPI (154 lines)
This stuff belongs to MAINTAINERS section "ACPI/SMBIOS", I think.
Michael, Igor, any objections to new qapi/acpi.json?
The QMP command code lives in monitor/qmp-cmds.c:
qmp_query_acpi_ospm_status(). If we move the schema part to
acpi.json, we should consider moving the C part to hw/acpi/.
* PATCH 9 memory (131 lines)
MAINTAINERS section? include/hw/mem/memory-device.h is not covered.
hw/mem/memory-device.c is under "ACPI/SMBIOS".
Michael, Igor, should this stuff go into acpi.json, too?
The QMP command code lives in monitor/qmp-cmds.c:
qmp_query_memory_size_summary(). If we move the schema part to
acpi.json, we should consider moving the C part to hw/acpi/.
* Any others?
© 2016 - 2026 Red Hat, Inc.