]> git.proxmox.com Git - mirror_qemu.git/blame - qmp.c
hw/arm/virt: explain device-to-transport mapping in create_virtio_devices()
[mirror_qemu.git] / qmp.c
CommitLineData
48a32bed
AL
1/*
2 * QEMU Management Protocol
3 *
4 * Copyright IBM, Corp. 2011
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
11 *
6b620ca3
PB
12 * Contributions after 2012-01-13 are licensed under the terms of the
13 * GNU GPL, version 2 or (at your option) any later version.
48a32bed
AL
14 */
15
16#include "qemu-common.h"
9c17d615 17#include "sysemu/sysemu.h"
48a32bed 18#include "qmp-commands.h"
dccfcd0e 19#include "sysemu/char.h"
fbf796fd
LC
20#include "ui/qemu-spice.h"
21#include "ui/vnc.h"
9c17d615
PB
22#include "sysemu/kvm.h"
23#include "sysemu/arch_init.h"
b4b12c62 24#include "hw/qdev.h"
9c17d615 25#include "sysemu/blockdev.h"
14cccb61 26#include "qom/qom-qobject.h"
cff8b2c6
PB
27#include "qapi/qmp/qobject.h"
28#include "qapi/qmp-input-visitor.h"
69ca3ea5 29#include "hw/boards.h"
269e09f3 30#include "qom/object_interfaces.h"
6f2e2730 31#include "hw/mem/pc-dimm.h"
02419bcb 32#include "hw/acpi/acpi_dev_interface.h"
48a32bed
AL
33
34NameInfo *qmp_query_name(Error **errp)
35{
36 NameInfo *info = g_malloc0(sizeof(*info));
37
38 if (qemu_name) {
39 info->has_name = true;
40 info->name = g_strdup(qemu_name);
41 }
42
43 return info;
44}
b9c15f16 45
7daecb30 46VersionInfo *qmp_query_version(Error **errp)
b9c15f16
LC
47{
48 VersionInfo *info = g_malloc0(sizeof(*info));
49 const char *version = QEMU_VERSION;
50 char *tmp;
51
52 info->qemu.major = strtol(version, &tmp, 10);
53 tmp++;
54 info->qemu.minor = strtol(tmp, &tmp, 10);
55 tmp++;
56 info->qemu.micro = strtol(tmp, &tmp, 10);
57 info->package = g_strdup(QEMU_PKGVERSION);
58
59 return info;
60}
292a2602
LC
61
62KvmInfo *qmp_query_kvm(Error **errp)
63{
64 KvmInfo *info = g_malloc0(sizeof(*info));
65
66 info->enabled = kvm_enabled();
67 info->present = kvm_available();
68
69 return info;
70}
71
efab767e
LC
72UuidInfo *qmp_query_uuid(Error **errp)
73{
74 UuidInfo *info = g_malloc0(sizeof(*info));
75 char uuid[64];
76
77 snprintf(uuid, sizeof(uuid), UUID_FMT, qemu_uuid[0], qemu_uuid[1],
78 qemu_uuid[2], qemu_uuid[3], qemu_uuid[4], qemu_uuid[5],
79 qemu_uuid[6], qemu_uuid[7], qemu_uuid[8], qemu_uuid[9],
80 qemu_uuid[10], qemu_uuid[11], qemu_uuid[12], qemu_uuid[13],
81 qemu_uuid[14], qemu_uuid[15]);
82
83 info->UUID = g_strdup(uuid);
84 return info;
85}
86
7daecb30 87void qmp_quit(Error **errp)
7a7f325e
LC
88{
89 no_shutdown = 0;
90 qemu_system_shutdown_request();
91}
92
5f158f21
LC
93void qmp_stop(Error **errp)
94{
1e998146
PB
95 if (runstate_check(RUN_STATE_INMIGRATE)) {
96 autostart = 0;
97 } else {
98 vm_stop(RUN_STATE_PAUSED);
99 }
5f158f21
LC
100}
101
38d22653
LC
102void qmp_system_reset(Error **errp)
103{
104 qemu_system_reset_request();
105}
5bc465e4
LC
106
107void qmp_system_powerdown(Error **erp)
108{
109 qemu_system_powerdown_request();
110}
755f1968
LC
111
112void qmp_cpu(int64_t index, Error **errp)
113{
114 /* Just do nothing */
115}
2b54aa87 116
69ca3ea5
IM
117void qmp_cpu_add(int64_t id, Error **errp)
118{
0056ae24
MA
119 MachineClass *mc;
120
121 mc = MACHINE_GET_CLASS(current_machine);
958db90c
MA
122 if (mc->hot_add_cpu) {
123 mc->hot_add_cpu(id, errp);
69ca3ea5
IM
124 } else {
125 error_setg(errp, "Not supported");
126 }
127}
128
2b54aa87
LC
129#ifndef CONFIG_VNC
130/* If VNC support is enabled, the "true" query-vnc command is
131 defined in the VNC subsystem */
132VncInfo *qmp_query_vnc(Error **errp)
133{
134 error_set(errp, QERR_FEATURE_DISABLED, "vnc");
135 return NULL;
136};
137#endif
d1f29646
LC
138
139#ifndef CONFIG_SPICE
ad0ec14b
MA
140/*
141 * qmp-commands.hx ensures that QMP command query-spice exists only
142 * #ifdef CONFIG_SPICE. Necessary for an accurate query-commands
143 * result. However, the QAPI schema is blissfully unaware of that,
144 * and the QAPI code generator happily generates a dead
145 * qmp_marshal_input_query_spice() that calls qmp_query_spice().
146 * Provide it one, or else linking fails.
147 * FIXME Educate the QAPI schema on CONFIG_SPICE.
148 */
d1f29646
LC
149SpiceInfo *qmp_query_spice(Error **errp)
150{
ad0ec14b 151 abort();
d1f29646
LC
152};
153#endif
e42e818b 154
e42e818b
LC
155void qmp_cont(Error **errp)
156{
ab31979a 157 BlockDriverState *bs;
e42e818b 158
ede085b3 159 if (runstate_needs_reset()) {
f231b88d 160 error_setg(errp, "Resetting the Virtual Machine is required");
e42e818b 161 return;
ad02b96a
LC
162 } else if (runstate_check(RUN_STATE_SUSPENDED)) {
163 return;
e42e818b
LC
164 }
165
ab31979a
MA
166 for (bs = bdrv_next(NULL); bs; bs = bdrv_next(bs)) {
167 bdrv_iostatus_reset(bs);
168 }
169 for (bs = bdrv_next(NULL); bs; bs = bdrv_next(bs)) {
170 if (bdrv_key_required(bs)) {
171 error_set(errp, QERR_DEVICE_ENCRYPTED,
172 bdrv_get_device_name(bs),
173 bdrv_get_encrypted_filename(bs));
174 return;
175 }
e42e818b
LC
176 }
177
1e998146
PB
178 if (runstate_check(RUN_STATE_INMIGRATE)) {
179 autostart = 1;
180 } else {
181 vm_start();
182 }
e42e818b 183}
b4b12c62 184
9b9df25a
GH
185void qmp_system_wakeup(Error **errp)
186{
187 qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
188}
189
57c9fafe 190ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
b4b12c62 191{
57c9fafe 192 Object *obj;
b4b12c62 193 bool ambiguous = false;
57c9fafe
AL
194 ObjectPropertyInfoList *props = NULL;
195 ObjectProperty *prop;
b4b12c62 196
57c9fafe
AL
197 obj = object_resolve_path(path, &ambiguous);
198 if (obj == NULL) {
79772087
MT
199 if (ambiguous) {
200 error_setg(errp, "Path '%s' is ambiguous", path);
201 } else {
202 error_set(errp, QERR_DEVICE_NOT_FOUND, path);
203 }
b4b12c62
AL
204 return NULL;
205 }
206
57c9fafe
AL
207 QTAILQ_FOREACH(prop, &obj->properties, node) {
208 ObjectPropertyInfoList *entry = g_malloc0(sizeof(*entry));
b4b12c62 209
57c9fafe 210 entry->value = g_malloc0(sizeof(ObjectPropertyInfo));
b4b12c62
AL
211 entry->next = props;
212 props = entry;
213
214 entry->value->name = g_strdup(prop->name);
215 entry->value->type = g_strdup(prop->type);
216 }
217
218 return props;
219}
eb6e8ea5
AL
220
221/* FIXME: teach qapi about how to pass through Visitors */
222int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret)
223{
224 const char *path = qdict_get_str(qdict, "path");
225 const char *property = qdict_get_str(qdict, "property");
226 QObject *value = qdict_get(qdict, "value");
227 Error *local_err = NULL;
57c9fafe 228 Object *obj;
eb6e8ea5 229
57c9fafe
AL
230 obj = object_resolve_path(path, NULL);
231 if (!obj) {
eb6e8ea5
AL
232 error_set(&local_err, QERR_DEVICE_NOT_FOUND, path);
233 goto out;
234 }
235
9f5f1350 236 object_property_set_qobject(obj, value, property, &local_err);
eb6e8ea5
AL
237
238out:
239 if (local_err) {
240 qerror_report_err(local_err);
241 error_free(local_err);
242 return -1;
243 }
244
245 return 0;
246}
247
248int qmp_qom_get(Monitor *mon, const QDict *qdict, QObject **ret)
249{
250 const char *path = qdict_get_str(qdict, "path");
251 const char *property = qdict_get_str(qdict, "property");
252 Error *local_err = NULL;
57c9fafe 253 Object *obj;
eb6e8ea5 254
57c9fafe
AL
255 obj = object_resolve_path(path, NULL);
256 if (!obj) {
eb6e8ea5
AL
257 error_set(&local_err, QERR_DEVICE_NOT_FOUND, path);
258 goto out;
259 }
260
9f5f1350 261 *ret = object_property_get_qobject(obj, property, &local_err);
eb6e8ea5
AL
262
263out:
264 if (local_err) {
265 qerror_report_err(local_err);
266 error_free(local_err);
267 return -1;
268 }
269
270 return 0;
271}
fbf796fd
LC
272
273void qmp_set_password(const char *protocol, const char *password,
274 bool has_connected, const char *connected, Error **errp)
275{
276 int disconnect_if_connected = 0;
277 int fail_if_connected = 0;
278 int rc;
279
280 if (has_connected) {
281 if (strcmp(connected, "fail") == 0) {
282 fail_if_connected = 1;
283 } else if (strcmp(connected, "disconnect") == 0) {
284 disconnect_if_connected = 1;
285 } else if (strcmp(connected, "keep") == 0) {
286 /* nothing */
287 } else {
288 error_set(errp, QERR_INVALID_PARAMETER, "connected");
289 return;
290 }
291 }
292
293 if (strcmp(protocol, "spice") == 0) {
b25d81ba 294 if (!qemu_using_spice(errp)) {
fbf796fd
LC
295 return;
296 }
297 rc = qemu_spice_set_passwd(password, fail_if_connected,
298 disconnect_if_connected);
299 if (rc != 0) {
300 error_set(errp, QERR_SET_PASSWD_FAILED);
301 }
302 return;
303 }
304
305 if (strcmp(protocol, "vnc") == 0) {
306 if (fail_if_connected || disconnect_if_connected) {
307 /* vnc supports "connected=keep" only */
308 error_set(errp, QERR_INVALID_PARAMETER, "connected");
309 return;
310 }
311 /* Note that setting an empty password will not disable login through
312 * this interface. */
313 rc = vnc_display_password(NULL, password);
314 if (rc < 0) {
315 error_set(errp, QERR_SET_PASSWD_FAILED);
316 }
317 return;
318 }
319
320 error_set(errp, QERR_INVALID_PARAMETER, "protocol");
321}
9ad5372d
LC
322
323void qmp_expire_password(const char *protocol, const char *whenstr,
324 Error **errp)
325{
326 time_t when;
327 int rc;
328
329 if (strcmp(whenstr, "now") == 0) {
330 when = 0;
331 } else if (strcmp(whenstr, "never") == 0) {
332 when = TIME_MAX;
333 } else if (whenstr[0] == '+') {
334 when = time(NULL) + strtoull(whenstr+1, NULL, 10);
335 } else {
336 when = strtoull(whenstr, NULL, 10);
337 }
338
339 if (strcmp(protocol, "spice") == 0) {
b25d81ba 340 if (!qemu_using_spice(errp)) {
9ad5372d
LC
341 return;
342 }
343 rc = qemu_spice_set_pw_expire(when);
344 if (rc != 0) {
345 error_set(errp, QERR_SET_PASSWD_FAILED);
346 }
347 return;
348 }
349
350 if (strcmp(protocol, "vnc") == 0) {
351 rc = vnc_display_pw_expire(NULL, when);
352 if (rc != 0) {
353 error_set(errp, QERR_SET_PASSWD_FAILED);
354 }
355 return;
356 }
357
358 error_set(errp, QERR_INVALID_PARAMETER, "protocol");
359}
270b243f 360
333a96ec 361#ifdef CONFIG_VNC
270b243f
LC
362void qmp_change_vnc_password(const char *password, Error **errp)
363{
364 if (vnc_display_password(NULL, password) < 0) {
365 error_set(errp, QERR_SET_PASSWD_FAILED);
366 }
367}
333a96ec 368
007fcd3e 369static void qmp_change_vnc_listen(const char *target, Error **errp)
333a96ec 370{
4db14629
GH
371 QemuOptsList *olist = qemu_find_opts("vnc");
372 QemuOpts *opts;
373
374 if (strstr(target, "id=")) {
375 error_setg(errp, "id not supported");
376 return;
377 }
378
379 opts = qemu_opts_find(olist, "default");
380 if (opts) {
381 qemu_opts_del(opts);
382 }
383 opts = vnc_parse_func(target);
384 vnc_display_open("default", errp);
333a96ec
LC
385}
386
387static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,
388 Error **errp)
389{
390 if (strcmp(target, "passwd") == 0 || strcmp(target, "password") == 0) {
391 if (!has_arg) {
392 error_set(errp, QERR_MISSING_PARAMETER, "password");
393 } else {
394 qmp_change_vnc_password(arg, errp);
395 }
396 } else {
397 qmp_change_vnc_listen(target, errp);
398 }
399}
400#else
401void qmp_change_vnc_password(const char *password, Error **errp)
402{
403 error_set(errp, QERR_FEATURE_DISABLED, "vnc");
404}
405static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,
406 Error **errp)
407{
408 error_set(errp, QERR_FEATURE_DISABLED, "vnc");
409}
410#endif /* !CONFIG_VNC */
411
412void qmp_change(const char *device, const char *target,
7daecb30 413 bool has_arg, const char *arg, Error **errp)
333a96ec
LC
414{
415 if (strcmp(device, "vnc") == 0) {
7daecb30 416 qmp_change_vnc(target, has_arg, arg, errp);
333a96ec 417 } else {
7daecb30 418 qmp_change_blockdev(device, target, arg, errp);
333a96ec
LC
419 }
420}
5eeee3fa
AL
421
422static void qom_list_types_tramp(ObjectClass *klass, void *data)
423{
424 ObjectTypeInfoList *e, **pret = data;
425 ObjectTypeInfo *info;
426
427 info = g_malloc0(sizeof(*info));
428 info->name = g_strdup(object_class_get_name(klass));
429
430 e = g_malloc0(sizeof(*e));
431 e->value = info;
432 e->next = *pret;
433 *pret = e;
434}
435
436ObjectTypeInfoList *qmp_qom_list_types(bool has_implements,
437 const char *implements,
438 bool has_abstract,
439 bool abstract,
440 Error **errp)
441{
442 ObjectTypeInfoList *ret = NULL;
443
444 object_class_foreach(qom_list_types_tramp, implements, abstract, &ret);
445
446 return ret;
447}
1daa31b9 448
f4eb32b5
SH
449/* Return a DevicePropertyInfo for a qdev property.
450 *
451 * If a qdev property with the given name does not exist, use the given default
452 * type. If the qdev property info should not be shown, return NULL.
453 *
454 * The caller must free the return value.
455 */
456static DevicePropertyInfo *make_device_property_info(ObjectClass *klass,
457 const char *name,
07d09c58
GA
458 const char *default_type,
459 const char *description)
f4eb32b5
SH
460{
461 DevicePropertyInfo *info;
462 Property *prop;
463
464 do {
465 for (prop = DEVICE_CLASS(klass)->props; prop && prop->name; prop++) {
466 if (strcmp(name, prop->name) != 0) {
467 continue;
468 }
469
470 /*
471 * TODO Properties without a parser are just for dirty hacks.
472 * qdev_prop_ptr is the only such PropertyInfo. It's marked
473 * for removal. This conditional should be removed along with
474 * it.
475 */
476 if (!prop->info->set) {
477 return NULL; /* no way to set it, don't show */
478 }
479
480 info = g_malloc0(sizeof(*info));
481 info->name = g_strdup(prop->name);
07d09c58
GA
482 info->type = g_strdup(prop->info->name);
483 info->has_description = !!prop->info->description;
484 info->description = g_strdup(prop->info->description);
f4eb32b5
SH
485 return info;
486 }
487 klass = object_class_get_parent(klass);
488 } while (klass != object_class_by_name(TYPE_DEVICE));
489
490 /* Not a qdev property, use the default type */
491 info = g_malloc0(sizeof(*info));
492 info->name = g_strdup(name);
493 info->type = g_strdup(default_type);
07d09c58
GA
494 info->has_description = !!description;
495 info->description = g_strdup(description);
496
f4eb32b5
SH
497 return info;
498}
499
1daa31b9
AL
500DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
501 Error **errp)
502{
503 ObjectClass *klass;
f4eb32b5
SH
504 Object *obj;
505 ObjectProperty *prop;
1daa31b9
AL
506 DevicePropertyInfoList *prop_list = NULL;
507
508 klass = object_class_by_name(typename);
509 if (klass == NULL) {
510 error_set(errp, QERR_DEVICE_NOT_FOUND, typename);
511 return NULL;
512 }
513
514 klass = object_class_dynamic_cast(klass, TYPE_DEVICE);
515 if (klass == NULL) {
516 error_set(errp, QERR_INVALID_PARAMETER_VALUE,
517 "name", TYPE_DEVICE);
518 return NULL;
519 }
520
f4eb32b5 521 obj = object_new(typename);
1daa31b9 522
f4eb32b5
SH
523 QTAILQ_FOREACH(prop, &obj->properties, node) {
524 DevicePropertyInfo *info;
525 DevicePropertyInfoList *entry;
526
527 /* Skip Object and DeviceState properties */
528 if (strcmp(prop->name, "type") == 0 ||
529 strcmp(prop->name, "realized") == 0 ||
530 strcmp(prop->name, "hotpluggable") == 0 ||
4115dd65 531 strcmp(prop->name, "hotplugged") == 0 ||
f4eb32b5
SH
532 strcmp(prop->name, "parent_bus") == 0) {
533 continue;
534 }
1daa31b9 535
f4eb32b5
SH
536 /* Skip legacy properties since they are just string versions of
537 * properties that we already list.
538 */
539 if (strstart(prop->name, "legacy-", NULL)) {
540 continue;
541 }
1daa31b9 542
07d09c58
GA
543 info = make_device_property_info(klass, prop->name, prop->type,
544 prop->description);
f4eb32b5
SH
545 if (!info) {
546 continue;
1daa31b9 547 }
f4eb32b5
SH
548
549 entry = g_malloc0(sizeof(*entry));
550 entry->value = info;
551 entry->next = prop_list;
552 prop_list = entry;
553 }
554
555 object_unref(obj);
1daa31b9
AL
556
557 return prop_list;
558}
e4e31c63 559
76b64a7a
AL
560CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
561{
562 return arch_query_cpu_definitions(errp);
563}
564
b224e5e2
LC
565void qmp_add_client(const char *protocol, const char *fdname,
566 bool has_skipauth, bool skipauth, bool has_tls, bool tls,
567 Error **errp)
568{
569 CharDriverState *s;
570 int fd;
571
572 fd = monitor_get_fd(cur_mon, fdname, errp);
573 if (fd < 0) {
574 return;
575 }
576
577 if (strcmp(protocol, "spice") == 0) {
b25d81ba 578 if (!qemu_using_spice(errp)) {
b224e5e2
LC
579 close(fd);
580 return;
581 }
582 skipauth = has_skipauth ? skipauth : false;
583 tls = has_tls ? tls : false;
584 if (qemu_spice_display_add_client(fd, skipauth, tls) < 0) {
585 error_setg(errp, "spice failed to add client");
586 close(fd);
587 }
588 return;
589#ifdef CONFIG_VNC
590 } else if (strcmp(protocol, "vnc") == 0) {
591 skipauth = has_skipauth ? skipauth : false;
592 vnc_display_add_client(NULL, fd, skipauth);
593 return;
594#endif
595 } else if ((s = qemu_chr_find(protocol)) != NULL) {
596 if (qemu_chr_add_client(s, fd) < 0) {
597 error_setg(errp, "failed to add client");
598 close(fd);
599 return;
600 }
601 return;
602 }
603
604 error_setg(errp, "protocol '%s' is invalid", protocol);
605 close(fd);
606}
ab2d0531 607
cff8b2c6
PB
608void object_add(const char *type, const char *id, const QDict *qdict,
609 Visitor *v, Error **errp)
610{
611 Object *obj;
c3481247 612 ObjectClass *klass;
cff8b2c6
PB
613 const QDictEntry *e;
614 Error *local_err = NULL;
615
c3481247
EH
616 klass = object_class_by_name(type);
617 if (!klass) {
d1169464 618 error_setg(errp, "invalid object type: %s", type);
cff8b2c6
PB
619 return;
620 }
621
c3481247
EH
622 if (!object_class_dynamic_cast(klass, TYPE_USER_CREATABLE)) {
623 error_setg(errp, "object type '%s' isn't supported by object-add",
624 type);
625 return;
626 }
627
628 if (object_class_is_abstract(klass)) {
629 error_setg(errp, "object type '%s' is abstract", type);
630 return;
631 }
632
cff8b2c6
PB
633 obj = object_new(type);
634 if (qdict) {
635 for (e = qdict_first(qdict); e; e = qdict_next(qdict, e)) {
636 object_property_set(obj, v, e->key, &local_err);
637 if (local_err) {
69252c04 638 goto out;
cff8b2c6
PB
639 }
640 }
641 }
642
a790f4ec
IM
643 object_property_add_child(container_get(object_get_root(), "/objects"),
644 id, obj, &local_err);
269e09f3
IM
645 if (local_err) {
646 goto out;
647 }
648
a790f4ec
IM
649 user_creatable_complete(obj, &local_err);
650 if (local_err) {
651 object_property_del(container_get(object_get_root(), "/objects"),
652 id, &error_abort);
653 goto out;
654 }
69252c04
IM
655out:
656 if (local_err) {
657 error_propagate(errp, local_err);
658 }
cff8b2c6
PB
659 object_unref(obj);
660}
661
662int qmp_object_add(Monitor *mon, const QDict *qdict, QObject **ret)
663{
664 const char *type = qdict_get_str(qdict, "qom-type");
665 const char *id = qdict_get_str(qdict, "id");
666 QObject *props = qdict_get(qdict, "props");
667 const QDict *pdict = NULL;
668 Error *local_err = NULL;
669 QmpInputVisitor *qiv;
670
671 if (props) {
672 pdict = qobject_to_qdict(props);
673 if (!pdict) {
674 error_set(&local_err, QERR_INVALID_PARAMETER_TYPE, "props", "dict");
675 goto out;
676 }
677 }
678
679 qiv = qmp_input_visitor_new(props);
680 object_add(type, id, pdict, qmp_input_get_visitor(qiv), &local_err);
681 qmp_input_visitor_cleanup(qiv);
682
683out:
684 if (local_err) {
685 qerror_report_err(local_err);
686 error_free(local_err);
687 return -1;
688 }
689
690 return 0;
691}
692
ab2d0531
PB
693void qmp_object_del(const char *id, Error **errp)
694{
695 Object *container;
696 Object *obj;
697
698 container = container_get(object_get_root(), "/objects");
699 obj = object_resolve_path_component(container, id);
700 if (!obj) {
701 error_setg(errp, "object id not found");
702 return;
703 }
704 object_unparent(obj);
705}
6f2e2730
IM
706
707MemoryDeviceInfoList *qmp_query_memory_devices(Error **errp)
708{
709 MemoryDeviceInfoList *head = NULL;
710 MemoryDeviceInfoList **prev = &head;
711
712 qmp_pc_dimm_device_list(qdev_get_machine(), &prev);
713
714 return head;
715}
02419bcb
IM
716
717ACPIOSTInfoList *qmp_query_acpi_ospm_status(Error **errp)
718{
719 bool ambig;
720 ACPIOSTInfoList *head = NULL;
721 ACPIOSTInfoList **prev = &head;
722 Object *obj = object_resolve_path_type("", TYPE_ACPI_DEVICE_IF, &ambig);
723
724 if (obj) {
725 AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(obj);
726 AcpiDeviceIf *adev = ACPI_DEVICE_IF(obj);
727
728 adevc->ospm_status(adev, &prev);
729 } else {
730 error_setg(errp, "command is not supported, missing ACPI device");
731 }
732
733 return head;
734}