Merge tag 'pull-monitor-2023-02-03-v2' of https://repo.or.cz/qemu/armbru into staging

Monitor patches for 2023-02-03

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmPeAkgSHGFybWJydUBy
# ZWRoYXQuY29tAAoJEDhwtADrkYZTUagP/iZ24jXaWoFOKaO70wdQ/tdoQObWZnUV
# 8xJNJYmYYbWoiq9wQXHebi/yEgBudso1lLzAnp8lsF12ybnNV1zsjyV/yumEKSNW
# 3nL1NZIcuY9IDmCe97clY9nm9H2lUhjjyCG3gnjg+uC3JjlSjO/T8lbkdT+fYnkR
# AInVTCPYFjSO9MIOhN0WNIY73HlAjr4zx5TEgS/D4pFj6iGq2qEniSDGMRf+/fVr
# uSbIXbQlum+VAdxbGMSVf8yQPlNcFUXUpSJrbgJE272H6saQuvn5mkwD0RcYXyaI
# OlfXpATDRNTsP3yYImxgr7y29Exo1HnCuC6T1n/+fwkirtMR3a7X6XjaQwFsWcrx
# xxGiHQOve3r/I3DAO6A64T2ceD/XuI43LygqkkljfuoXifnJz7Lo39P9HrY0dhpC
# KSld2n/Vv4xYyykvqAzpvzijwq679ILIbTplhm9gOrfrDRZjWad3uLAcYxsTXXR8
# BQbHGovcAzTOEx/0Quo3NThpAeNYPGyrPz3xBIV+XtPJGWvFsrA/s/po4qWDTmF6
# UTzPoEmznsD+DRboNOKfinCsOnpTAru4gbXevi7sfmMHQbLYN5xgsrF7WdlaxWa6
# 4QbJyNUq0O+aL0gyfVLuiZBCQ32Jaz1WvowK856Yl4jwczP5HM0ujyyM75+Kx072
# PdnMgxYYLSij
# =d+wL
# -----END PGP SIGNATURE-----
# gpg: Signature made Sat 04 Feb 2023 06:59:20 GMT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* tag 'pull-monitor-2023-02-03-v2' of https://repo.or.cz/qemu/armbru: (35 commits)
  monitor: Rename misc.c to hmp-target.c
  monitor: Loosen coupling between misc.c and monitor.c slightly
  monitor: Move remaining QMP stuff from misc.c to qmp-cmds.c
  monitor: Move remaining HMP commands from misc.c to hmp-cmds.c
  monitor: Move target-dependent HMP commands to hmp-cmds-target.c
  monitor: Move monitor_putc() next to monitor_puts & external linkage
  monitor: Split file descriptor passing stuff off misc.c
  qdev: Move HMP command completion from monitor to softmmu/
  acpi: Move the QMP command from monitor/ to hw/acpi/
  stats: Move HMP commands from monitor/ to stats/
  stats: Move QMP commands from monitor/ to stats/
  runstate: Move HMP commands from monitor/ to softmmu/
  tpm: Move HMP commands from monitor/ to softmmu/
  virtio: Move HMP commands from monitor/ to hw/virtio/
  migration: Move the QMP command from monitor/ to migration/
  migration: Move HMP commands from monitor/ to migration/
  net: Move hmp_info_network() to net-hmp-cmds.c
  net: Move HMP commands from monitor to net/
  hmp: Rewrite strlist_from_comma_list() as hmp_split_at_comma()
  rocker: Move HMP commands from monitor to hw/net/rocker/
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell
2023-02-04 10:19:55 +00:00
54 changed files with 4576 additions and 4284 deletions
+10 -4
View File
@@ -437,7 +437,7 @@ M: Richard Henderson <richard.henderson@linaro.org>
R: Paolo Bonzini <pbonzini@redhat.com>
S: Maintained
F: include/qemu/accel.h
F: include/sysemu/accel-ops.h
F: include/sysemu/accel-*.h
F: include/hw/core/accel-cpu.h
F: accel/accel-*.c
F: accel/Makefile.objs
@@ -2801,8 +2801,7 @@ F: softmmu/cpus.c
F: softmmu/cpu-throttle.c
F: softmmu/cpu-timers.c
F: softmmu/icount.c
F: softmmu/runstate-action.c
F: softmmu/runstate.c
F: softmmu/runstate*
F: qapi/run-state.json
Read, Copy, Update (RCU)
@@ -3036,6 +3035,11 @@ F: net/slirp.c
F: include/net/slirp.h
T: git https://people.debian.org/~sthibault/qemu.git slirp
Stats
S: Orphan
F: include/sysemu/stats.h
F: stats/
Streams
M: Edgar E. Iglesias <edgar.iglesias@gmail.com>
S: Maintained
@@ -3064,7 +3068,7 @@ T: git https://github.com/stefanha/qemu.git tracing
TPM
M: Stefan Berger <stefanb@linux.ibm.com>
S: Maintained
F: tpm.c
F: softmmu/tpm*
F: hw/tpm/*
F: include/hw/acpi/tpm.h
F: include/sysemu/tpm*
@@ -3085,6 +3089,7 @@ S: Maintained
F: hw/core/vmstate-if.c
F: include/hw/vmstate-if.h
F: include/migration/
F: include/qemu/userfaultfd.h
F: migration/
F: scripts/vmstate-static-checker.py
F: tests/vmstate-static-checker-data/
@@ -3092,6 +3097,7 @@ F: tests/qtest/migration-test.c
F: docs/devel/migration.rst
F: qapi/migration.json
F: tests/migration/
F: util/userfaultfd.c
D-Bus
M: Marc-André Lureau <marcandre.lureau@redhat.com>
+1 -1
View File
@@ -50,7 +50,7 @@
#include "qemu/range.h"
#include "hw/boards.h"
#include "monitor/stats.h"
#include "sysemu/stats.h"
/* This check must be after config-host.h is included */
#ifdef CONFIG_EVENTFD
+83
View File
@@ -0,0 +1,83 @@
/*
* HMP commands related to audio backends
*
* Copyright (c) 2003-2004 Fabrice Bellard
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "audio/audio.h"
#include "monitor/hmp.h"
#include "monitor/monitor.h"
#include "qapi/qmp/qdict.h"
static QLIST_HEAD (capture_list_head, CaptureState) capture_head;
void hmp_info_capture(Monitor *mon, const QDict *qdict)
{
int i;
CaptureState *s;
for (s = capture_head.lh_first, i = 0; s; s = s->entries.le_next, ++i) {
monitor_printf(mon, "[%d]: ", i);
s->ops.info (s->opaque);
}
}
void hmp_stopcapture(Monitor *mon, const QDict *qdict)
{
int i;
int n = qdict_get_int(qdict, "n");
CaptureState *s;
for (s = capture_head.lh_first, i = 0; s; s = s->entries.le_next, ++i) {
if (i == n) {
s->ops.destroy (s->opaque);
QLIST_REMOVE (s, entries);
g_free (s);
return;
}
}
}
void hmp_wavcapture(Monitor *mon, const QDict *qdict)
{
const char *path = qdict_get_str(qdict, "path");
int freq = qdict_get_try_int(qdict, "freq", 44100);
int bits = qdict_get_try_int(qdict, "bits", 16);
int nchannels = qdict_get_try_int(qdict, "nchannels", 2);
const char *audiodev = qdict_get_str(qdict, "audiodev");
CaptureState *s;
AudioState *as = audio_state_by_name(audiodev);
if (!as) {
monitor_printf(mon, "Audiodev '%s' not found\n", audiodev);
return;
}
s = g_malloc0 (sizeof (*s));
if (wav_start_capture(as, s, path, freq, bits, nchannels)) {
monitor_printf(mon, "Failed to add wave capture\n");
g_free (s);
return;
}
QLIST_INSERT_HEAD (&capture_head, s, entries);
}
+1
View File
@@ -1,5 +1,6 @@
softmmu_ss.add([spice_headers, files('audio.c')])
softmmu_ss.add(files(
'audio-hmp-cmds.c',
'audio_legacy.c',
'mixeng.c',
'noaudio.c',
+21
View File
@@ -1005,3 +1005,24 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
g_free(sn_tab);
g_free(global_snapshots);
}
void hmp_change_medium(Monitor *mon, const char *device, const char *target,
const char *arg, const char *read_only, bool force,
Error **errp)
{
ERRP_GUARD();
BlockdevChangeReadOnlyMode read_only_mode = 0;
if (read_only) {
read_only_mode =
qapi_enum_parse(&BlockdevChangeReadOnlyMode_lookup,
read_only,
BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, errp);
if (*errp) {
return;
}
}
qmp_blockdev_change_medium(device, NULL, target, arg, true, force,
!!read_only, read_only_mode, errp);
}
+220
View File
@@ -0,0 +1,220 @@
/*
* HMP commands related to character devices
*
* Copyright IBM, Corp. 2011
*
* Authors:
* Anthony Liguori <aliguori@us.ibm.com>
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*
* Contributions after 2012-01-13 are licensed under the terms of the
* GNU GPL, version 2 or (at your option) any later version.
*/
#include "qemu/osdep.h"
#include "chardev/char.h"
#include "monitor/hmp.h"
#include "monitor/monitor.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-char.h"
#include "qapi/qmp/qdict.h"
#include "qemu/config-file.h"
#include "qemu/option.h"
void hmp_info_chardev(Monitor *mon, const QDict *qdict)
{
ChardevInfoList *char_info, *info;
char_info = qmp_query_chardev(NULL);
for (info = char_info; info; info = info->next) {
monitor_printf(mon, "%s: filename=%s\n", info->value->label,
info->value->filename);
}
qapi_free_ChardevInfoList(char_info);
}
void hmp_ringbuf_write(Monitor *mon, const QDict *qdict)
{
const char *chardev = qdict_get_str(qdict, "device");
const char *data = qdict_get_str(qdict, "data");
Error *err = NULL;
qmp_ringbuf_write(chardev, data, false, 0, &err);
hmp_handle_error(mon, err);
}
void hmp_ringbuf_read(Monitor *mon, const QDict *qdict)
{
uint32_t size = qdict_get_int(qdict, "size");
const char *chardev = qdict_get_str(qdict, "device");
char *data;
Error *err = NULL;
int i;
data = qmp_ringbuf_read(chardev, size, false, 0, &err);
if (hmp_handle_error(mon, err)) {
return;
}
for (i = 0; data[i]; i++) {
unsigned char ch = data[i];
if (ch == '\\') {
monitor_printf(mon, "\\\\");
} else if ((ch < 0x20 && ch != '\n' && ch != '\t') || ch == 0x7F) {
monitor_printf(mon, "\\u%04X", ch);
} else {
monitor_printf(mon, "%c", ch);
}
}
monitor_printf(mon, "\n");
g_free(data);
}
void hmp_chardev_add(Monitor *mon, const QDict *qdict)
{
const char *args = qdict_get_str(qdict, "args");
Error *err = NULL;
QemuOpts *opts;
opts = qemu_opts_parse_noisily(qemu_find_opts("chardev"), args, true);
if (opts == NULL) {
error_setg(&err, "Parsing chardev args failed");
} else {
qemu_chr_new_from_opts(opts, NULL, &err);
qemu_opts_del(opts);
}
hmp_handle_error(mon, err);
}
void hmp_chardev_change(Monitor *mon, const QDict *qdict)
{
const char *args = qdict_get_str(qdict, "args");
const char *id;
Error *err = NULL;
ChardevBackend *backend = NULL;
ChardevReturn *ret = NULL;
QemuOpts *opts = qemu_opts_parse_noisily(qemu_find_opts("chardev"), args,
true);
if (!opts) {
error_setg(&err, "Parsing chardev args failed");
goto end;
}
id = qdict_get_str(qdict, "id");
if (qemu_opts_id(opts)) {
error_setg(&err, "Unexpected 'id' parameter");
goto end;
}
backend = qemu_chr_parse_opts(opts, &err);
if (!backend) {
goto end;
}
ret = qmp_chardev_change(id, backend, &err);
end:
qapi_free_ChardevReturn(ret);
qapi_free_ChardevBackend(backend);
qemu_opts_del(opts);
hmp_handle_error(mon, err);
}
void hmp_chardev_remove(Monitor *mon, const QDict *qdict)
{
Error *local_err = NULL;
qmp_chardev_remove(qdict_get_str(qdict, "id"), &local_err);
hmp_handle_error(mon, local_err);
}
void hmp_chardev_send_break(Monitor *mon, const QDict *qdict)
{
Error *local_err = NULL;
qmp_chardev_send_break(qdict_get_str(qdict, "id"), &local_err);
hmp_handle_error(mon, local_err);
}
void chardev_add_completion(ReadLineState *rs, int nb_args, const char *str)
{
size_t len;
ChardevBackendInfoList *list, *start;
if (nb_args != 2) {
return;
}
len = strlen(str);
readline_set_completion_index(rs, len);
start = list = qmp_query_chardev_backends(NULL);
while (list) {
const char *chr_name = list->value->name;
if (!strncmp(chr_name, str, len)) {
readline_add_completion(rs, chr_name);
}
list = list->next;
}
qapi_free_ChardevBackendInfoList(start);
}
void chardev_remove_completion(ReadLineState *rs, int nb_args, const char *str)
{
size_t len;
ChardevInfoList *list, *start;
if (nb_args != 2) {
return;
}
len = strlen(str);
readline_set_completion_index(rs, len);
start = list = qmp_query_chardev(NULL);
while (list) {
ChardevInfo *chr = list->value;
if (!strncmp(chr->label, str, len)) {
readline_add_completion(rs, chr->label);
}
list = list->next;
}
qapi_free_ChardevInfoList(start);
}
static void ringbuf_completion(ReadLineState *rs, const char *str)
{
size_t len;
ChardevInfoList *list, *start;
len = strlen(str);
readline_set_completion_index(rs, len);
start = list = qmp_query_chardev(NULL);
while (list) {
ChardevInfo *chr_info = list->value;
if (!strncmp(chr_info->label, str, len)) {
Chardev *chr = qemu_chr_find(chr_info->label);
if (chr && CHARDEV_IS_RINGBUF(chr)) {
readline_add_completion(rs, chr_info->label);
}
}
list = list->next;
}
qapi_free_ChardevInfoList(start);
}
void ringbuf_write_completion(ReadLineState *rs, int nb_args, const char *str)
{
if (nb_args != 2) {
return;
}
ringbuf_completion(rs, str);
}
+20
View File
@@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "qemu/cutils.h"
#include "monitor/monitor.h"
#include "monitor/qmp-helpers.h"
#include "qemu/config-file.h"
#include "qemu/error-report.h"
#include "qemu/qemu-print.h"
@@ -1166,6 +1167,25 @@ void qmp_chardev_send_break(const char *id, Error **errp)
qemu_chr_be_event(chr, CHR_EVENT_BREAK);
}
bool qmp_add_client_char(int fd, bool has_skipauth, bool skipauth,
bool has_tls, bool tls, const char *protocol,
Error **errp)
{
Chardev *s = qemu_chr_find(protocol);
if (!s) {
error_setg(errp, "protocol '%s' is invalid", protocol);
close(fd);
return false;
}
if (qemu_chr_add_client(s, fd) < 0) {
error_setg(errp, "failed to add client");
close(fd);
return false;
}
return true;
}
/*
* Add a timeout callback for the chardev (in milliseconds), return
* the GSource object created. Please use this to add timeout hook for
+5 -1
View File
@@ -28,7 +28,11 @@ chardev_ss.add(when: 'CONFIG_WIN32', if_true: files(
chardev_ss = chardev_ss.apply(config_host, strict: false)
softmmu_ss.add(files('msmouse.c', 'wctablet.c', 'testdev.c'))
softmmu_ss.add(files(
'char-hmp-cmds.c',
'msmouse.c',
'wctablet.c',
'testdev.c'))
chardev_modules = {}
+2 -2
View File
@@ -11,7 +11,7 @@ HXCOMM HXCOMM can be used for comments, discarded from both rST and C.
.args_type = "name:S?",
.params = "[cmd]",
.help = "show the help",
.cmd = do_help_cmd,
.cmd = hmp_help,
.flags = "p",
},
@@ -563,7 +563,7 @@ ERST
.args_type = "fmt:/,val:l",
.params = "/fmt expr",
.help = "print expression value (use $reg for CPU register access)",
.cmd = do_print,
.cmd = hmp_print,
},
SRST
+30
View File
@@ -0,0 +1,30 @@
/*
* QMP commands related to ACPI
*
* This work is licensed under the terms of the GNU GPL, version 2 or
* (at your option) any later version.
*/
#include "qemu/osdep.h"
#include "hw/acpi/acpi_dev_interface.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-acpi.h"
ACPIOSTInfoList *qmp_query_acpi_ospm_status(Error **errp)
{
bool ambig;
ACPIOSTInfoList *head = NULL;
ACPIOSTInfoList **prev = &head;
Object *obj = object_resolve_path_type("", TYPE_ACPI_DEVICE_IF, &ambig);
if (obj) {
AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(obj);
AcpiDeviceIf *adev = ACPI_DEVICE_IF(obj);
adevc->ospm_status(adev, &prev);
} else {
error_setg(errp, "command is not supported, missing ACPI device");
}
return head;
}
+1
View File
@@ -38,3 +38,4 @@ softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('acpi-stub.c', 'aml-build-stub
'acpi-mem-hotplug-stub.c', 'acpi-cpu-hotplug-stub.c',
'acpi-pci-hotplug-stub.c', 'acpi-nvdimm-stub.c',
'cxl-stub.c', 'pci-bridge-stub.c'))
softmmu_ss.add(files('acpi-qmp-cmds.c'))
+208
View File
@@ -134,3 +134,211 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict)
qapi_free_MemdevList(memdev_list);
hmp_handle_error(mon, err);
}
void hmp_info_kvm(Monitor *mon, const QDict *qdict)
{
KvmInfo *info;
info = qmp_query_kvm(NULL);
monitor_printf(mon, "kvm support: ");
if (info->present) {
monitor_printf(mon, "%s\n", info->enabled ? "enabled" : "disabled");
} else {
monitor_printf(mon, "not compiled\n");
}
qapi_free_KvmInfo(info);
}
void hmp_info_uuid(Monitor *mon, const QDict *qdict)
{
UuidInfo *info;
info = qmp_query_uuid(NULL);
monitor_printf(mon, "%s\n", info->UUID);
qapi_free_UuidInfo(info);
}
void hmp_info_balloon(Monitor *mon, const QDict *qdict)
{
BalloonInfo *info;
Error *err = NULL;
info = qmp_query_balloon(&err);
if (hmp_handle_error(mon, err)) {
return;
}
monitor_printf(mon, "balloon: actual=%" PRId64 "\n", info->actual >> 20);
qapi_free_BalloonInfo(info);
}
void hmp_system_reset(Monitor *mon, const QDict *qdict)
{
qmp_system_reset(NULL);
}
void hmp_system_powerdown(Monitor *mon, const QDict *qdict)
{
qmp_system_powerdown(NULL);
}
void hmp_memsave(Monitor *mon, const QDict *qdict)
{
uint32_t size = qdict_get_int(qdict, "size");
const char *filename = qdict_get_str(qdict, "filename");
uint64_t addr = qdict_get_int(qdict, "val");
Error *err = NULL;
int cpu_index = monitor_get_cpu_index(mon);
if (cpu_index < 0) {
monitor_printf(mon, "No CPU available\n");
return;
}
qmp_memsave(addr, size, filename, true, cpu_index, &err);
hmp_handle_error(mon, err);
}
void hmp_pmemsave(Monitor *mon, const QDict *qdict)
{
uint32_t size = qdict_get_int(qdict, "size");
const char *filename = qdict_get_str(qdict, "filename");
uint64_t addr = qdict_get_int(qdict, "val");
Error *err = NULL;
qmp_pmemsave(addr, size, filename, &err);
hmp_handle_error(mon, err);
}
void hmp_system_wakeup(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
qmp_system_wakeup(&err);
hmp_handle_error(mon, err);
}
void hmp_nmi(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
qmp_inject_nmi(&err);
hmp_handle_error(mon, err);
}
void hmp_balloon(Monitor *mon, const QDict *qdict)
{
int64_t value = qdict_get_int(qdict, "value");
Error *err = NULL;
qmp_balloon(value, &err);
hmp_handle_error(mon, err);
}
void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
MemoryDeviceInfoList *info_list = qmp_query_memory_devices(&err);
MemoryDeviceInfoList *info;
VirtioPMEMDeviceInfo *vpi;
VirtioMEMDeviceInfo *vmi;
MemoryDeviceInfo *value;
PCDIMMDeviceInfo *di;
SgxEPCDeviceInfo *se;
for (info = info_list; info; info = info->next) {
value = info->value;
if (value) {
switch (value->type) {
case MEMORY_DEVICE_INFO_KIND_DIMM:
case MEMORY_DEVICE_INFO_KIND_NVDIMM:
di = value->type == MEMORY_DEVICE_INFO_KIND_DIMM ?
value->u.dimm.data : value->u.nvdimm.data;
monitor_printf(mon, "Memory device [%s]: \"%s\"\n",
MemoryDeviceInfoKind_str(value->type),
di->id ? di->id : "");
monitor_printf(mon, " addr: 0x%" PRIx64 "\n", di->addr);
monitor_printf(mon, " slot: %" PRId64 "\n", di->slot);
monitor_printf(mon, " node: %" PRId64 "\n", di->node);
monitor_printf(mon, " size: %" PRIu64 "\n", di->size);
monitor_printf(mon, " memdev: %s\n", di->memdev);
monitor_printf(mon, " hotplugged: %s\n",
di->hotplugged ? "true" : "false");
monitor_printf(mon, " hotpluggable: %s\n",
di->hotpluggable ? "true" : "false");
break;
case MEMORY_DEVICE_INFO_KIND_VIRTIO_PMEM:
vpi = value->u.virtio_pmem.data;
monitor_printf(mon, "Memory device [%s]: \"%s\"\n",
MemoryDeviceInfoKind_str(value->type),
vpi->id ? vpi->id : "");
monitor_printf(mon, " memaddr: 0x%" PRIx64 "\n", vpi->memaddr);
monitor_printf(mon, " size: %" PRIu64 "\n", vpi->size);
monitor_printf(mon, " memdev: %s\n", vpi->memdev);
break;
case MEMORY_DEVICE_INFO_KIND_VIRTIO_MEM:
vmi = value->u.virtio_mem.data;
monitor_printf(mon, "Memory device [%s]: \"%s\"\n",
MemoryDeviceInfoKind_str(value->type),
vmi->id ? vmi->id : "");
monitor_printf(mon, " memaddr: 0x%" PRIx64 "\n", vmi->memaddr);
monitor_printf(mon, " node: %" PRId64 "\n", vmi->node);
monitor_printf(mon, " requested-size: %" PRIu64 "\n",
vmi->requested_size);
monitor_printf(mon, " size: %" PRIu64 "\n", vmi->size);
monitor_printf(mon, " max-size: %" PRIu64 "\n", vmi->max_size);
monitor_printf(mon, " block-size: %" PRIu64 "\n",
vmi->block_size);
monitor_printf(mon, " memdev: %s\n", vmi->memdev);
break;
case MEMORY_DEVICE_INFO_KIND_SGX_EPC:
se = value->u.sgx_epc.data;
monitor_printf(mon, "Memory device [%s]: \"%s\"\n",
MemoryDeviceInfoKind_str(value->type),
se->id ? se->id : "");
monitor_printf(mon, " memaddr: 0x%" PRIx64 "\n", se->memaddr);
monitor_printf(mon, " size: %" PRIu64 "\n", se->size);
monitor_printf(mon, " node: %" PRId64 "\n", se->node);
monitor_printf(mon, " memdev: %s\n", se->memdev);
break;
default:
g_assert_not_reached();
}
}
}
qapi_free_MemoryDeviceInfoList(info_list);
hmp_handle_error(mon, err);
}
void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
GuidInfo *info = qmp_query_vm_generation_id(&err);
if (info) {
monitor_printf(mon, "%s\n", info->guid);
}
hmp_handle_error(mon, err);
qapi_free_GuidInfo(info);
}
void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
MemoryInfo *info = qmp_query_memory_size_summary(&err);
if (info) {
monitor_printf(mon, "base memory: %" PRIu64 "\n",
info->base_memory);
if (info->has_plugged_memory) {
monitor_printf(mon, "plugged memory: %" PRIu64 "\n",
info->plugged_memory);
}
qapi_free_MemoryInfo(info);
}
hmp_handle_error(mon, err);
}
+144
View File
@@ -9,6 +9,9 @@
#include "qemu/osdep.h"
#include "hw/boards.h"
#include "hw/intc/intc.h"
#include "hw/mem/memory-device.h"
#include "hw/rdma/rdma.h"
#include "qapi/error.h"
#include "qapi/qapi-builtin-visit.h"
#include "qapi/qapi-commands-machine.h"
@@ -17,11 +20,13 @@
#include "qapi/qobject-input-visitor.h"
#include "qapi/type-helpers.h"
#include "qemu/main-loop.h"
#include "qemu/uuid.h"
#include "qom/qom-qobject.h"
#include "sysemu/hostmem.h"
#include "sysemu/hw_accel.h"
#include "sysemu/numa.h"
#include "sysemu/runstate.h"
#include "sysemu/sysemu.h"
static void cpustate_to_cpuinfo_s390(CpuInfoS390 *info, const CPUState *cpu)
{
@@ -239,3 +244,142 @@ HumanReadableText *qmp_x_query_numa(Error **errp)
done:
return human_readable_text_from_str(buf);
}
KvmInfo *qmp_query_kvm(Error **errp)
{
KvmInfo *info = g_malloc0(sizeof(*info));
info->enabled = kvm_enabled();
info->present = accel_find("kvm");
return info;
}
UuidInfo *qmp_query_uuid(Error **errp)
{
UuidInfo *info = g_malloc0(sizeof(*info));
info->UUID = qemu_uuid_unparse_strdup(&qemu_uuid);
return info;
}
void qmp_system_reset(Error **errp)
{
qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET);
}
void qmp_system_powerdown(Error **errp)
{
qemu_system_powerdown_request();
}
void qmp_system_wakeup(Error **errp)
{
if (!qemu_wakeup_suspend_enabled()) {
error_setg(errp,
"wake-up from suspend is not supported by this guest");
return;
}
qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, errp);
}
MemoryDeviceInfoList *qmp_query_memory_devices(Error **errp)
{
return qmp_memory_device_list();
}
MemoryInfo *qmp_query_memory_size_summary(Error **errp)
{
MemoryInfo *mem_info = g_new0(MemoryInfo, 1);
MachineState *ms = MACHINE(qdev_get_machine());
mem_info->base_memory = ms->ram_size;
mem_info->plugged_memory = get_plugged_memory_size();
mem_info->has_plugged_memory =
mem_info->plugged_memory != (uint64_t)-1;
return mem_info;
}
static int qmp_x_query_rdma_foreach(Object *obj, void *opaque)
{
RdmaProvider *rdma;
RdmaProviderClass *k;
GString *buf = opaque;
if (object_dynamic_cast(obj, INTERFACE_RDMA_PROVIDER)) {
rdma = RDMA_PROVIDER(obj);
k = RDMA_PROVIDER_GET_CLASS(obj);
if (k->format_statistics) {
k->format_statistics(rdma, buf);
} else {
g_string_append_printf(buf,
"RDMA statistics not available for %s.\n",
object_get_typename(obj));
}
}
return 0;
}
HumanReadableText *qmp_x_query_rdma(Error **errp)
{
g_autoptr(GString) buf = g_string_new("");
object_child_foreach_recursive(object_get_root(),
qmp_x_query_rdma_foreach, buf);
return human_readable_text_from_str(buf);
}
HumanReadableText *qmp_x_query_ramblock(Error **errp)
{
g_autoptr(GString) buf = ram_block_format();
return human_readable_text_from_str(buf);
}
static int qmp_x_query_irq_foreach(Object *obj, void *opaque)
{
InterruptStatsProvider *intc;
InterruptStatsProviderClass *k;
GString *buf = opaque;
if (object_dynamic_cast(obj, TYPE_INTERRUPT_STATS_PROVIDER)) {
intc = INTERRUPT_STATS_PROVIDER(obj);
k = INTERRUPT_STATS_PROVIDER_GET_CLASS(obj);
uint64_t *irq_counts;
unsigned int nb_irqs, i;
if (k->get_statistics &&
k->get_statistics(intc, &irq_counts, &nb_irqs)) {
if (nb_irqs > 0) {
g_string_append_printf(buf, "IRQ statistics for %s:\n",
object_get_typename(obj));
for (i = 0; i < nb_irqs; i++) {
if (irq_counts[i] > 0) {
g_string_append_printf(buf, "%2d: %" PRId64 "\n", i,
irq_counts[i]);
}
}
}
} else {
g_string_append_printf(buf,
"IRQ statistics not available for %s.\n",
object_get_typename(obj));
}
}
return 0;
}
HumanReadableText *qmp_x_query_irq(Error **errp)
{
g_autoptr(GString) buf = g_string_new("");
object_child_foreach_recursive(object_get_root(),
qmp_x_query_irq_foreach, buf);
return human_readable_text_from_str(buf);
}
+1
View File
@@ -68,5 +68,6 @@ softmmu_ss.add(when: 'CONFIG_ROCKER', if_true: files(
'rocker/rocker_world.c',
), if_false: files('rocker/qmp-norocker.c'))
softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('rocker/qmp-norocker.c'))
softmmu_ss.add(files('rocker/rocker-hmp-cmds.c'))
subdir('can')
+316
View File
@@ -0,0 +1,316 @@
/*
* Human Monitor Interface commands
*
* Copyright IBM, Corp. 2011
*
* Authors:
* Anthony Liguori <aliguori@us.ibm.com>
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*
* Contributions after 2012-01-13 are licensed under the terms of the
* GNU GPL, version 2 or (at your option) any later version.
*/
#include "qemu/osdep.h"
#include "monitor/hmp.h"
#include "monitor/monitor.h"
#include "net/eth.h"
#include "qapi/qapi-commands-rocker.h"
#include "qapi/qmp/qdict.h"
void hmp_rocker(Monitor *mon, const QDict *qdict)
{
const char *name = qdict_get_str(qdict, "name");
RockerSwitch *rocker;
Error *err = NULL;
rocker = qmp_query_rocker(name, &err);
if (hmp_handle_error(mon, err)) {
return;
}
monitor_printf(mon, "name: %s\n", rocker->name);
monitor_printf(mon, "id: 0x%" PRIx64 "\n", rocker->id);
monitor_printf(mon, "ports: %d\n", rocker->ports);
qapi_free_RockerSwitch(rocker);
}
void hmp_rocker_ports(Monitor *mon, const QDict *qdict)
{
RockerPortList *list, *port;
const char *name = qdict_get_str(qdict, "name");
Error *err = NULL;
list = qmp_query_rocker_ports(name, &err);
if (hmp_handle_error(mon, err)) {
return;
}
monitor_printf(mon, " ena/ speed/ auto\n");
monitor_printf(mon, " port link duplex neg?\n");
for (port = list; port; port = port->next) {
monitor_printf(mon, "%10s %-4s %-3s %2s %s\n",
port->value->name,
port->value->enabled ? port->value->link_up ?
"up" : "down" : "!ena",
port->value->speed == 10000 ? "10G" : "??",
port->value->duplex ? "FD" : "HD",
port->value->autoneg ? "Yes" : "No");
}
qapi_free_RockerPortList(list);
}
void hmp_rocker_of_dpa_flows(Monitor *mon, const QDict *qdict)
{
RockerOfDpaFlowList *list, *info;
const char *name = qdict_get_str(qdict, "name");
uint32_t tbl_id = qdict_get_try_int(qdict, "tbl_id", -1);
Error *err = NULL;
list = qmp_query_rocker_of_dpa_flows(name, tbl_id != -1, tbl_id, &err);
if (hmp_handle_error(mon, err)) {
return;
}
monitor_printf(mon, "prio tbl hits key(mask) --> actions\n");
for (info = list; info; info = info->next) {
RockerOfDpaFlow *flow = info->value;
RockerOfDpaFlowKey *key = flow->key;
RockerOfDpaFlowMask *mask = flow->mask;
RockerOfDpaFlowAction *action = flow->action;
if (flow->hits) {
monitor_printf(mon, "%-4d %-3d %-4" PRIu64,
key->priority, key->tbl_id, flow->hits);
} else {
monitor_printf(mon, "%-4d %-3d ",
key->priority, key->tbl_id);
}
if (key->has_in_pport) {
monitor_printf(mon, " pport %d", key->in_pport);
if (mask->has_in_pport) {
monitor_printf(mon, "(0x%x)", mask->in_pport);
}
}
if (key->has_vlan_id) {
monitor_printf(mon, " vlan %d",
key->vlan_id & VLAN_VID_MASK);
if (mask->has_vlan_id) {
monitor_printf(mon, "(0x%x)", mask->vlan_id);
}
}
if (key->has_tunnel_id) {
monitor_printf(mon, " tunnel %d", key->tunnel_id);
if (mask->has_tunnel_id) {
monitor_printf(mon, "(0x%x)", mask->tunnel_id);
}
}
if (key->has_eth_type) {
switch (key->eth_type) {
case 0x0806:
monitor_printf(mon, " ARP");
break;
case 0x0800:
monitor_printf(mon, " IP");
break;
case 0x86dd:
monitor_printf(mon, " IPv6");
break;
case 0x8809:
monitor_printf(mon, " LACP");
break;
case 0x88cc:
monitor_printf(mon, " LLDP");
break;
default:
monitor_printf(mon, " eth type 0x%04x", key->eth_type);
break;
}
}
if (key->eth_src) {
if ((strcmp(key->eth_src, "01:00:00:00:00:00") == 0) &&
mask->eth_src &&
(strcmp(mask->eth_src, "01:00:00:00:00:00") == 0)) {
monitor_printf(mon, " src <any mcast/bcast>");
} else if ((strcmp(key->eth_src, "00:00:00:00:00:00") == 0) &&
mask->eth_src &&
(strcmp(mask->eth_src, "01:00:00:00:00:00") == 0)) {
monitor_printf(mon, " src <any ucast>");
} else {
monitor_printf(mon, " src %s", key->eth_src);
if (mask->eth_src) {
monitor_printf(mon, "(%s)", mask->eth_src);
}
}
}
if (key->eth_dst) {
if ((strcmp(key->eth_dst, "01:00:00:00:00:00") == 0) &&
mask->eth_dst &&
(strcmp(mask->eth_dst, "01:00:00:00:00:00") == 0)) {
monitor_printf(mon, " dst <any mcast/bcast>");
} else if ((strcmp(key->eth_dst, "00:00:00:00:00:00") == 0) &&
mask->eth_dst &&
(strcmp(mask->eth_dst, "01:00:00:00:00:00") == 0)) {
monitor_printf(mon, " dst <any ucast>");
} else {
monitor_printf(mon, " dst %s", key->eth_dst);
if (mask->eth_dst) {
monitor_printf(mon, "(%s)", mask->eth_dst);
}
}
}
if (key->has_ip_proto) {
monitor_printf(mon, " proto %d", key->ip_proto);
if (mask->has_ip_proto) {
monitor_printf(mon, "(0x%x)", mask->ip_proto);
}
}
if (key->has_ip_tos) {
monitor_printf(mon, " TOS %d", key->ip_tos);
if (mask->has_ip_tos) {
monitor_printf(mon, "(0x%x)", mask->ip_tos);
}
}
if (key->ip_dst) {
monitor_printf(mon, " dst %s", key->ip_dst);
}
if (action->has_goto_tbl || action->has_group_id ||
action->has_new_vlan_id) {
monitor_printf(mon, " -->");
}
if (action->has_new_vlan_id) {
monitor_printf(mon, " apply new vlan %d",
ntohs(action->new_vlan_id));
}
if (action->has_group_id) {
monitor_printf(mon, " write group 0x%08x", action->group_id);
}
if (action->has_goto_tbl) {
monitor_printf(mon, " goto tbl %d", action->goto_tbl);
}
monitor_printf(mon, "\n");
}
qapi_free_RockerOfDpaFlowList(list);
}
void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict)
{
RockerOfDpaGroupList *list, *g;
const char *name = qdict_get_str(qdict, "name");
uint8_t type = qdict_get_try_int(qdict, "type", 9);
Error *err = NULL;
list = qmp_query_rocker_of_dpa_groups(name, type != 9, type, &err);
if (hmp_handle_error(mon, err)) {
return;
}
monitor_printf(mon, "id (decode) --> buckets\n");
for (g = list; g; g = g->next) {
RockerOfDpaGroup *group = g->value;
bool set = false;
monitor_printf(mon, "0x%08x", group->id);
monitor_printf(mon, " (type %s", group->type == 0 ? "L2 interface" :
group->type == 1 ? "L2 rewrite" :
group->type == 2 ? "L3 unicast" :
group->type == 3 ? "L2 multicast" :
group->type == 4 ? "L2 flood" :
group->type == 5 ? "L3 interface" :
group->type == 6 ? "L3 multicast" :
group->type == 7 ? "L3 ECMP" :
group->type == 8 ? "L2 overlay" :
"unknown");
if (group->has_vlan_id) {
monitor_printf(mon, " vlan %d", group->vlan_id);
}
if (group->has_pport) {
monitor_printf(mon, " pport %d", group->pport);
}
if (group->has_index) {
monitor_printf(mon, " index %d", group->index);
}
monitor_printf(mon, ") -->");
if (group->has_set_vlan_id && group->set_vlan_id) {
set = true;
monitor_printf(mon, " set vlan %d",
group->set_vlan_id & VLAN_VID_MASK);
}
if (group->set_eth_src) {
if (!set) {
set = true;
monitor_printf(mon, " set");
}
monitor_printf(mon, " src %s", group->set_eth_src);
}
if (group->set_eth_dst) {
if (!set) {
monitor_printf(mon, " set");
}
monitor_printf(mon, " dst %s", group->set_eth_dst);
}
if (group->has_ttl_check && group->ttl_check) {
monitor_printf(mon, " check TTL");
}
if (group->has_group_id && group->group_id) {
monitor_printf(mon, " group id 0x%08x", group->group_id);
}
if (group->has_pop_vlan && group->pop_vlan) {
monitor_printf(mon, " pop vlan");
}
if (group->has_out_pport) {
monitor_printf(mon, " out pport %d", group->out_pport);
}
if (group->has_group_ids) {
struct uint32List *id;
monitor_printf(mon, " groups [");
for (id = group->group_ids; id; id = id->next) {
monitor_printf(mon, "0x%08x", id->value);
if (id->next) {
monitor_printf(mon, ",");
}
}
monitor_printf(mon, "]");
}
monitor_printf(mon, "\n");
}
qapi_free_RockerOfDpaGroupList(list);
}
+1
View File
@@ -67,5 +67,6 @@ softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c'))
softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('virtio-stub.c'))
softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c'))
softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('virtio-stub.c'))
softmmu_ss.add(files('virtio-hmp-cmds.c'))
specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: specific_virtio_ss)
+321
View File
@@ -0,0 +1,321 @@
/*
* HMP commands related to virtio
*
* This work is licensed under the terms of the GNU GPL, version 2 or
* (at your option) any later version.
*/
#include "qemu/osdep.h"
#include "monitor/hmp.h"
#include "monitor/monitor.h"
#include "qapi/qapi-commands-virtio.h"
#include "qapi/qmp/qdict.h"
static void hmp_virtio_dump_protocols(Monitor *mon,
VhostDeviceProtocols *pcol)
{
strList *pcol_list = pcol->protocols;
while (pcol_list) {
monitor_printf(mon, "\t%s", pcol_list->value);
pcol_list = pcol_list->next;
if (pcol_list != NULL) {
monitor_printf(mon, ",\n");
}
}
monitor_printf(mon, "\n");
if (pcol->has_unknown_protocols) {
monitor_printf(mon, " unknown-protocols(0x%016"PRIx64")\n",
pcol->unknown_protocols);
}
}
static void hmp_virtio_dump_status(Monitor *mon,
VirtioDeviceStatus *status)
{
strList *status_list = status->statuses;
while (status_list) {
monitor_printf(mon, "\t%s", status_list->value);
status_list = status_list->next;
if (status_list != NULL) {
monitor_printf(mon, ",\n");
}
}
monitor_printf(mon, "\n");
if (status->has_unknown_statuses) {
monitor_printf(mon, " unknown-statuses(0x%016"PRIx32")\n",
status->unknown_statuses);
}
}
static void hmp_virtio_dump_features(Monitor *mon,
VirtioDeviceFeatures *features)
{
strList *transport_list = features->transports;
while (transport_list) {
monitor_printf(mon, "\t%s", transport_list->value);
transport_list = transport_list->next;
if (transport_list != NULL) {
monitor_printf(mon, ",\n");
}
}
monitor_printf(mon, "\n");
strList *list = features->dev_features;
if (list) {
while (list) {
monitor_printf(mon, "\t%s", list->value);
list = list->next;
if (list != NULL) {
monitor_printf(mon, ",\n");
}
}
monitor_printf(mon, "\n");
}
if (features->has_unknown_dev_features) {
monitor_printf(mon, " unknown-features(0x%016"PRIx64")\n",
features->unknown_dev_features);
}
}
void hmp_virtio_query(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
VirtioInfoList *list = qmp_x_query_virtio(&err);
VirtioInfoList *node;
if (err != NULL) {
hmp_handle_error(mon, err);
return;
}
if (list == NULL) {
monitor_printf(mon, "No VirtIO devices\n");
return;
}
node = list;
while (node) {
monitor_printf(mon, "%s [%s]\n", node->value->path,
node->value->name);
node = node->next;
}
qapi_free_VirtioInfoList(list);
}
void hmp_virtio_status(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
const char *path = qdict_get_try_str(qdict, "path");
VirtioStatus *s = qmp_x_query_virtio_status(path, &err);
if (err != NULL) {
hmp_handle_error(mon, err);
return;
}
monitor_printf(mon, "%s:\n", path);
monitor_printf(mon, " device_name: %s %s\n",
s->name, s->vhost_dev ? "(vhost)" : "");
monitor_printf(mon, " device_id: %d\n", s->device_id);
monitor_printf(mon, " vhost_started: %s\n",
s->vhost_started ? "true" : "false");
monitor_printf(mon, " bus_name: %s\n", s->bus_name);
monitor_printf(mon, " broken: %s\n",
s->broken ? "true" : "false");
monitor_printf(mon, " disabled: %s\n",
s->disabled ? "true" : "false");
monitor_printf(mon, " disable_legacy_check: %s\n",
s->disable_legacy_check ? "true" : "false");
monitor_printf(mon, " started: %s\n",
s->started ? "true" : "false");
monitor_printf(mon, " use_started: %s\n",
s->use_started ? "true" : "false");
monitor_printf(mon, " start_on_kick: %s\n",
s->start_on_kick ? "true" : "false");
monitor_printf(mon, " use_guest_notifier_mask: %s\n",
s->use_guest_notifier_mask ? "true" : "false");
monitor_printf(mon, " vm_running: %s\n",
s->vm_running ? "true" : "false");
monitor_printf(mon, " num_vqs: %"PRId64"\n", s->num_vqs);
monitor_printf(mon, " queue_sel: %d\n",
s->queue_sel);
monitor_printf(mon, " isr: %d\n", s->isr);
monitor_printf(mon, " endianness: %s\n",
s->device_endian);
monitor_printf(mon, " status:\n");
hmp_virtio_dump_status(mon, s->status);
monitor_printf(mon, " Guest features:\n");
hmp_virtio_dump_features(mon, s->guest_features);
monitor_printf(mon, " Host features:\n");
hmp_virtio_dump_features(mon, s->host_features);
monitor_printf(mon, " Backend features:\n");
hmp_virtio_dump_features(mon, s->backend_features);
if (s->vhost_dev) {
monitor_printf(mon, " VHost:\n");
monitor_printf(mon, " nvqs: %d\n",
s->vhost_dev->nvqs);
monitor_printf(mon, " vq_index: %"PRId64"\n",
s->vhost_dev->vq_index);
monitor_printf(mon, " max_queues: %"PRId64"\n",
s->vhost_dev->max_queues);
monitor_printf(mon, " n_mem_sections: %"PRId64"\n",
s->vhost_dev->n_mem_sections);
monitor_printf(mon, " n_tmp_sections: %"PRId64"\n",
s->vhost_dev->n_tmp_sections);
monitor_printf(mon, " backend_cap: %"PRId64"\n",
s->vhost_dev->backend_cap);
monitor_printf(mon, " log_enabled: %s\n",
s->vhost_dev->log_enabled ? "true" : "false");
monitor_printf(mon, " log_size: %"PRId64"\n",
s->vhost_dev->log_size);
monitor_printf(mon, " Features:\n");
hmp_virtio_dump_features(mon, s->vhost_dev->features);
monitor_printf(mon, " Acked features:\n");
hmp_virtio_dump_features(mon, s->vhost_dev->acked_features);
monitor_printf(mon, " Backend features:\n");
hmp_virtio_dump_features(mon, s->vhost_dev->backend_features);
monitor_printf(mon, " Protocol features:\n");
hmp_virtio_dump_protocols(mon, s->vhost_dev->protocol_features);
}
qapi_free_VirtioStatus(s);
}
void hmp_vhost_queue_status(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
const char *path = qdict_get_try_str(qdict, "path");
int queue = qdict_get_int(qdict, "queue");
VirtVhostQueueStatus *s =
qmp_x_query_virtio_vhost_queue_status(path, queue, &err);
if (err != NULL) {
hmp_handle_error(mon, err);
return;
}
monitor_printf(mon, "%s:\n", path);
monitor_printf(mon, " device_name: %s (vhost)\n",
s->name);
monitor_printf(mon, " kick: %"PRId64"\n", s->kick);
monitor_printf(mon, " call: %"PRId64"\n", s->call);
monitor_printf(mon, " VRing:\n");
monitor_printf(mon, " num: %"PRId64"\n", s->num);
monitor_printf(mon, " desc: 0x%016"PRIx64"\n", s->desc);
monitor_printf(mon, " desc_phys: 0x%016"PRIx64"\n",
s->desc_phys);
monitor_printf(mon, " desc_size: %"PRId32"\n", s->desc_size);
monitor_printf(mon, " avail: 0x%016"PRIx64"\n", s->avail);
monitor_printf(mon, " avail_phys: 0x%016"PRIx64"\n",
s->avail_phys);
monitor_printf(mon, " avail_size: %"PRId32"\n", s->avail_size);
monitor_printf(mon, " used: 0x%016"PRIx64"\n", s->used);
monitor_printf(mon, " used_phys: 0x%016"PRIx64"\n",
s->used_phys);
monitor_printf(mon, " used_size: %"PRId32"\n", s->used_size);
qapi_free_VirtVhostQueueStatus(s);
}
void hmp_virtio_queue_status(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
const char *path = qdict_get_try_str(qdict, "path");
int queue = qdict_get_int(qdict, "queue");
VirtQueueStatus *s = qmp_x_query_virtio_queue_status(path, queue, &err);
if (err != NULL) {
hmp_handle_error(mon, err);
return;
}
monitor_printf(mon, "%s:\n", path);
monitor_printf(mon, " device_name: %s\n", s->name);
monitor_printf(mon, " queue_index: %d\n", s->queue_index);
monitor_printf(mon, " inuse: %d\n", s->inuse);
monitor_printf(mon, " used_idx: %d\n", s->used_idx);
monitor_printf(mon, " signalled_used: %d\n",
s->signalled_used);
monitor_printf(mon, " signalled_used_valid: %s\n",
s->signalled_used_valid ? "true" : "false");
if (s->has_last_avail_idx) {
monitor_printf(mon, " last_avail_idx: %d\n",
s->last_avail_idx);
}
if (s->has_shadow_avail_idx) {
monitor_printf(mon, " shadow_avail_idx: %d\n",
s->shadow_avail_idx);
}
monitor_printf(mon, " VRing:\n");
monitor_printf(mon, " num: %"PRId32"\n", s->vring_num);
monitor_printf(mon, " num_default: %"PRId32"\n",
s->vring_num_default);
monitor_printf(mon, " align: %"PRId32"\n",
s->vring_align);
monitor_printf(mon, " desc: 0x%016"PRIx64"\n",
s->vring_desc);
monitor_printf(mon, " avail: 0x%016"PRIx64"\n",
s->vring_avail);
monitor_printf(mon, " used: 0x%016"PRIx64"\n",
s->vring_used);
qapi_free_VirtQueueStatus(s);
}
void hmp_virtio_queue_element(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
const char *path = qdict_get_try_str(qdict, "path");
int queue = qdict_get_int(qdict, "queue");
int index = qdict_get_try_int(qdict, "index", -1);
VirtioQueueElement *e;
VirtioRingDescList *list;
e = qmp_x_query_virtio_queue_element(path, queue, index != -1,
index, &err);
if (err != NULL) {
hmp_handle_error(mon, err);
return;
}
monitor_printf(mon, "%s:\n", path);
monitor_printf(mon, " device_name: %s\n", e->name);
monitor_printf(mon, " index: %d\n", e->index);
monitor_printf(mon, " desc:\n");
monitor_printf(mon, " descs:\n");
list = e->descs;
while (list) {
monitor_printf(mon, " addr 0x%"PRIx64" len %d",
list->value->addr, list->value->len);
if (list->value->flags) {
strList *flag = list->value->flags;
monitor_printf(mon, " (");
while (flag) {
monitor_printf(mon, "%s", flag->value);
flag = flag->next;
if (flag) {
monitor_printf(mon, ", ");
}
}
monitor_printf(mon, ")");
}
list = list->next;
if (list) {
monitor_printf(mon, ",\n");
}
}
monitor_printf(mon, "\n");
monitor_printf(mon, " avail:\n");
monitor_printf(mon, " flags: %d\n", e->avail->flags);
monitor_printf(mon, " idx: %d\n", e->avail->idx);
monitor_printf(mon, " ring: %d\n", e->avail->ring);
monitor_printf(mon, " used:\n");
monitor_printf(mon, " flags: %d\n", e->used->flags);
monitor_printf(mon, " idx: %d\n", e->used->idx);
qapi_free_VirtioQueueElement(e);
}
+6
View File
@@ -51,5 +51,11 @@ void hmp_info_local_apic(Monitor *mon, const QDict *qdict);
void hmp_info_sev(Monitor *mon, const QDict *qdict);
void hmp_info_sgx(Monitor *mon, const QDict *qdict);
void hmp_info_via(Monitor *mon, const QDict *qdict);
void hmp_memory_dump(Monitor *mon, const QDict *qdict);
void hmp_physical_memory_dump(Monitor *mon, const QDict *qdict);
void hmp_info_registers(Monitor *mon, const QDict *qdict);
void hmp_gva2gpa(Monitor *mon, const QDict *qdict);
void hmp_gpa2hva(Monitor *mon, const QDict *qdict);
void hmp_gpa2hpa(Monitor *mon, const QDict *qdict);
#endif /* MONITOR_HMP_TARGET_H */
+27
View File
@@ -18,6 +18,8 @@
#include "qapi/qapi-types-common.h"
bool hmp_handle_error(Monitor *mon, Error *err);
void hmp_help_cmd(Monitor *mon, const char *name);
strList *hmp_split_at_comma(const char *str);
void hmp_info_name(Monitor *mon, const QDict *qdict);
void hmp_info_version(Monitor *mon, const QDict *qdict);
@@ -54,6 +56,7 @@ void hmp_ringbuf_read(Monitor *mon, const QDict *qdict);
void hmp_cont(Monitor *mon, const QDict *qdict);
void hmp_system_wakeup(Monitor *mon, const QDict *qdict);
void hmp_nmi(Monitor *mon, const QDict *qdict);
void hmp_info_network(Monitor *mon, const QDict *qdict);
void hmp_set_link(Monitor *mon, const QDict *qdict);
void hmp_balloon(Monitor *mon, const QDict *qdict);
void hmp_loadvm(Monitor *mon, const QDict *qdict);
@@ -77,6 +80,9 @@ void hmp_change_vnc(Monitor *mon, const char *device, const char *target,
const char *arg, const char *read_only, bool force,
Error **errp);
#endif
void hmp_change_medium(Monitor *mon, const char *device, const char *target,
const char *arg, const char *read_only, bool force,
Error **errp);
void hmp_migrate(Monitor *mon, const QDict *qdict);
void hmp_device_add(Monitor *mon, const QDict *qdict);
void hmp_device_del(Monitor *mon, const QDict *qdict);
@@ -150,6 +156,27 @@ void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict);
void hmp_human_readable_text_helper(Monitor *mon,
HumanReadableText *(*qmp_handler)(Error **));
void hmp_info_stats(Monitor *mon, const QDict *qdict);
void hmp_singlestep(Monitor *mon, const QDict *qdict);
void hmp_watchdog_action(Monitor *mon, const QDict *qdict);
void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict);
void hmp_info_capture(Monitor *mon, const QDict *qdict);
void hmp_stopcapture(Monitor *mon, const QDict *qdict);
void hmp_wavcapture(Monitor *mon, const QDict *qdict);
void hmp_trace_event(Monitor *mon, const QDict *qdict);
void hmp_trace_file(Monitor *mon, const QDict *qdict);
void hmp_info_trace_events(Monitor *mon, const QDict *qdict);
void hmp_help(Monitor *mon, const QDict *qdict);
void hmp_info_help(Monitor *mon, const QDict *qdict);
void hmp_info_sync_profile(Monitor *mon, const QDict *qdict);
void hmp_info_history(Monitor *mon, const QDict *qdict);
void hmp_logfile(Monitor *mon, const QDict *qdict);
void hmp_log(Monitor *mon, const QDict *qdict);
void hmp_gdbserver(Monitor *mon, const QDict *qdict);
void hmp_print(Monitor *mon, const QDict *qdict);
void hmp_sum(Monitor *mon, const QDict *qdict);
void hmp_ioport_read(Monitor *mon, const QDict *qdict);
void hmp_ioport_write(Monitor *mon, const QDict *qdict);
void hmp_boot_set(Monitor *mon, const QDict *qdict);
void hmp_info_mtree(Monitor *mon, const QDict *qdict);
#endif
+1
View File
@@ -35,6 +35,7 @@ int monitor_puts(Monitor *mon, const char *str);
int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
G_GNUC_PRINTF(2, 0);
int monitor_printf(Monitor *mon, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
void monitor_printc(Monitor *mon, int ch);
void monitor_flush(Monitor *mon);
int monitor_set_cpu(Monitor *mon, int cpu_index);
int monitor_get_cpu_index(Monitor *mon);

Some files were not shown because too many files have changed in this diff Show More