aboutsummaryrefslogtreecommitdiff
path: root/monitor
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2022-10-12 16:00:15 -0400
committerStefan Hajnoczi <stefanha@redhat.com>2022-10-12 16:00:15 -0400
commitcdcb7dcb401757b5853ca99c1967a6d66e1deea5 (patch)
tree629a0b8da58fe630498804183659a7e6818cd655 /monitor
parentcdda364e1da45edcb70fad7fa77bd2bb5e6c023f (diff)
parent3216ab2acb08b47d4ff83e709406690d37e44aff (diff)
downloadqemu-cdcb7dcb401757b5853ca99c1967a6d66e1deea5.zip
qemu-cdcb7dcb401757b5853ca99c1967a6d66e1deea5.tar.gz
qemu-cdcb7dcb401757b5853ca99c1967a6d66e1deea5.tar.bz2
Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging
pc,virtio: features, tests, fixes, cleanups virtio introspection new serial number opton for cxl vhost user blk dynamic config size virtio-gpio vhost user backend Tests fixes cleanups all over the place Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # -----BEGIN PGP SIGNATURE----- # # iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmNEVeoPHG1zdEByZWRo # YXQuY29tAAoJECgfDbjSjVRph8YH+gMWpb5IglE0Q+H2JiQPBwB/Ghy1ohRKnOvZ # lChB7+oy18o2xXRFTOXwG9Ijqsbdn0QMbU/r3NWxBuMzxDow012xiMDniJlJmcXw # /4POOCSTKrIfzVBhsEErVSA9NwSE5cQKr1oiRBGIa9UdZfZ//v7s6SoP4vtyj8RZ # UJVYVnMDtq/0PaN92IMs06lhqo/LkegE7gTGHMBf8Nvw4SgQoZgfPyp1eR+dKOhz # lXNqqvTds9yt8yS65UWbuSrZ9d7GpCQf8nuyLaLaENHd6FQUVfmTTT37l2EKziwp # PK0EwWMHeGkj7LHrylztradhE9xBlIW23ROP8wPdGZHmgLNHbC0= # =20Zb # -----END PGP SIGNATURE----- # gpg: Signature made Mon 10 Oct 2022 13:27:06 EDT # gpg: using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469 # gpg: issuer "mst@redhat.com" # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu: (55 commits) x86: pci: acpi: consolidate PCI slots creation tests: acpi: update expected blobs x86: pci: acpi: reorder Device's _DSM method tests: acpi: whitelist pc/q35 DSDT before moving _ADR field tests: acpi: update expected blobs x86: pci: acpi: reorder Device's _ADR and _SUN fields tests: acpi: whitelist pc/q35 DSDT before moving _ADR field tests: acpi: update expected blobs x86: acpi: cleanup PCI device _DSM duplication tests: acpi: whitelist pc/q35 DSDT before switching _DSM to use ASUN tests: acpi: update expected blobs x86: acpi: _DSM: use Package to pass parameters acpi: x86: refactor PDSM method to reduce nesting tests: acpi: whitelist pc/q35 DSDT due to HPET AML move tests: acpi: update expected blobs after HPET move acpi: x86: deduplicate HPET AML building tests: acpi: whitelist pc/q35 DSDT due to HPET AML move hw/smbios: support for type 8 (port connector) pci: Sanity check mask argument to pci_set_*_by_mask() pci: Remove unused pci_get_*_by_mask() functions ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'monitor')
-rw-r--r--monitor/hmp-cmds.c310
1 files changed, 310 insertions, 0 deletions
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index f90eea8..bab86c5 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -43,6 +43,8 @@
#include "qapi/qapi-commands-stats.h"
#include "qapi/qapi-commands-tpm.h"
#include "qapi/qapi-commands-ui.h"
+#include "qapi/qapi-commands-virtio.h"
+#include "qapi/qapi-visit-virtio.h"
#include "qapi/qapi-visit-net.h"
#include "qapi/qapi-visit-migration.h"
#include "qapi/qmp/qdict.h"
@@ -2472,3 +2474,311 @@ exit:
exit_no_print:
error_free(err);
}
+
+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->has_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->has_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);
+}