xref: /openbmc/qemu/hw/virtio/virtio-hmp-cmds.c (revision 579510e196a544b42bd8bca9cc61688d4d1211ac)
1*fa1cea9dSMarkus Armbruster /*
2*fa1cea9dSMarkus Armbruster  * HMP commands related to virtio
3*fa1cea9dSMarkus Armbruster  *
4*fa1cea9dSMarkus Armbruster  * This work is licensed under the terms of the GNU GPL, version 2 or
5*fa1cea9dSMarkus Armbruster  * (at your option) any later version.
6*fa1cea9dSMarkus Armbruster  */
7*fa1cea9dSMarkus Armbruster 
8*fa1cea9dSMarkus Armbruster #include "qemu/osdep.h"
9*fa1cea9dSMarkus Armbruster #include "monitor/hmp.h"
10*fa1cea9dSMarkus Armbruster #include "monitor/monitor.h"
11*fa1cea9dSMarkus Armbruster #include "qapi/qapi-commands-virtio.h"
12*fa1cea9dSMarkus Armbruster #include "qapi/qmp/qdict.h"
13*fa1cea9dSMarkus Armbruster 
14*fa1cea9dSMarkus Armbruster 
hmp_virtio_dump_protocols(Monitor * mon,VhostDeviceProtocols * pcol)15*fa1cea9dSMarkus Armbruster static void hmp_virtio_dump_protocols(Monitor *mon,
16*fa1cea9dSMarkus Armbruster                                       VhostDeviceProtocols *pcol)
17*fa1cea9dSMarkus Armbruster {
18*fa1cea9dSMarkus Armbruster     strList *pcol_list = pcol->protocols;
19*fa1cea9dSMarkus Armbruster     while (pcol_list) {
20*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "\t%s", pcol_list->value);
21*fa1cea9dSMarkus Armbruster         pcol_list = pcol_list->next;
22*fa1cea9dSMarkus Armbruster         if (pcol_list != NULL) {
23*fa1cea9dSMarkus Armbruster             monitor_printf(mon, ",\n");
24*fa1cea9dSMarkus Armbruster         }
25*fa1cea9dSMarkus Armbruster     }
26*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "\n");
27*fa1cea9dSMarkus Armbruster     if (pcol->has_unknown_protocols) {
28*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "  unknown-protocols(0x%016"PRIx64")\n",
29*fa1cea9dSMarkus Armbruster                        pcol->unknown_protocols);
30*fa1cea9dSMarkus Armbruster     }
31*fa1cea9dSMarkus Armbruster }
32*fa1cea9dSMarkus Armbruster 
hmp_virtio_dump_status(Monitor * mon,VirtioDeviceStatus * status)33*fa1cea9dSMarkus Armbruster static void hmp_virtio_dump_status(Monitor *mon,
34*fa1cea9dSMarkus Armbruster                                    VirtioDeviceStatus *status)
35*fa1cea9dSMarkus Armbruster {
36*fa1cea9dSMarkus Armbruster     strList *status_list = status->statuses;
37*fa1cea9dSMarkus Armbruster     while (status_list) {
38*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "\t%s", status_list->value);
39*fa1cea9dSMarkus Armbruster         status_list = status_list->next;
40*fa1cea9dSMarkus Armbruster         if (status_list != NULL) {
41*fa1cea9dSMarkus Armbruster             monitor_printf(mon, ",\n");
42*fa1cea9dSMarkus Armbruster         }
43*fa1cea9dSMarkus Armbruster     }
44*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "\n");
45*fa1cea9dSMarkus Armbruster     if (status->has_unknown_statuses) {
46*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "  unknown-statuses(0x%016"PRIx32")\n",
47*fa1cea9dSMarkus Armbruster                        status->unknown_statuses);
48*fa1cea9dSMarkus Armbruster     }
49*fa1cea9dSMarkus Armbruster }
50*fa1cea9dSMarkus Armbruster 
hmp_virtio_dump_features(Monitor * mon,VirtioDeviceFeatures * features)51*fa1cea9dSMarkus Armbruster static void hmp_virtio_dump_features(Monitor *mon,
52*fa1cea9dSMarkus Armbruster                                      VirtioDeviceFeatures *features)
53*fa1cea9dSMarkus Armbruster {
54*fa1cea9dSMarkus Armbruster     strList *transport_list = features->transports;
55*fa1cea9dSMarkus Armbruster     while (transport_list) {
56*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "\t%s", transport_list->value);
57*fa1cea9dSMarkus Armbruster         transport_list = transport_list->next;
58*fa1cea9dSMarkus Armbruster         if (transport_list != NULL) {
59*fa1cea9dSMarkus Armbruster             monitor_printf(mon, ",\n");
60*fa1cea9dSMarkus Armbruster         }
61*fa1cea9dSMarkus Armbruster     }
62*fa1cea9dSMarkus Armbruster 
63*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "\n");
64*fa1cea9dSMarkus Armbruster     strList *list = features->dev_features;
65*fa1cea9dSMarkus Armbruster     if (list) {
66*fa1cea9dSMarkus Armbruster         while (list) {
67*fa1cea9dSMarkus Armbruster             monitor_printf(mon, "\t%s", list->value);
68*fa1cea9dSMarkus Armbruster             list = list->next;
69*fa1cea9dSMarkus Armbruster             if (list != NULL) {
70*fa1cea9dSMarkus Armbruster                 monitor_printf(mon, ",\n");
71*fa1cea9dSMarkus Armbruster             }
72*fa1cea9dSMarkus Armbruster         }
73*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "\n");
74*fa1cea9dSMarkus Armbruster     }
75*fa1cea9dSMarkus Armbruster 
76*fa1cea9dSMarkus Armbruster     if (features->has_unknown_dev_features) {
77*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "  unknown-features(0x%016"PRIx64")\n",
78*fa1cea9dSMarkus Armbruster                        features->unknown_dev_features);
79*fa1cea9dSMarkus Armbruster     }
80*fa1cea9dSMarkus Armbruster }
81*fa1cea9dSMarkus Armbruster 
hmp_virtio_query(Monitor * mon,const QDict * qdict)82*fa1cea9dSMarkus Armbruster void hmp_virtio_query(Monitor *mon, const QDict *qdict)
83*fa1cea9dSMarkus Armbruster {
84*fa1cea9dSMarkus Armbruster     Error *err = NULL;
85*fa1cea9dSMarkus Armbruster     VirtioInfoList *list = qmp_x_query_virtio(&err);
86*fa1cea9dSMarkus Armbruster     VirtioInfoList *node;
87*fa1cea9dSMarkus Armbruster 
88*fa1cea9dSMarkus Armbruster     if (err != NULL) {
89*fa1cea9dSMarkus Armbruster         hmp_handle_error(mon, err);
90*fa1cea9dSMarkus Armbruster         return;
91*fa1cea9dSMarkus Armbruster     }
92*fa1cea9dSMarkus Armbruster 
93*fa1cea9dSMarkus Armbruster     if (list == NULL) {
94*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "No VirtIO devices\n");
95*fa1cea9dSMarkus Armbruster         return;
96*fa1cea9dSMarkus Armbruster     }
97*fa1cea9dSMarkus Armbruster 
98*fa1cea9dSMarkus Armbruster     node = list;
99*fa1cea9dSMarkus Armbruster     while (node) {
100*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "%s [%s]\n", node->value->path,
101*fa1cea9dSMarkus Armbruster                        node->value->name);
102*fa1cea9dSMarkus Armbruster         node = node->next;
103*fa1cea9dSMarkus Armbruster     }
104*fa1cea9dSMarkus Armbruster     qapi_free_VirtioInfoList(list);
105*fa1cea9dSMarkus Armbruster }
106*fa1cea9dSMarkus Armbruster 
hmp_virtio_status(Monitor * mon,const QDict * qdict)107*fa1cea9dSMarkus Armbruster void hmp_virtio_status(Monitor *mon, const QDict *qdict)
108*fa1cea9dSMarkus Armbruster {
109*fa1cea9dSMarkus Armbruster     Error *err = NULL;
110*fa1cea9dSMarkus Armbruster     const char *path = qdict_get_try_str(qdict, "path");
111*fa1cea9dSMarkus Armbruster     VirtioStatus *s = qmp_x_query_virtio_status(path, &err);
112*fa1cea9dSMarkus Armbruster 
113*fa1cea9dSMarkus Armbruster     if (err != NULL) {
114*fa1cea9dSMarkus Armbruster         hmp_handle_error(mon, err);
115*fa1cea9dSMarkus Armbruster         return;
116*fa1cea9dSMarkus Armbruster     }
117*fa1cea9dSMarkus Armbruster 
118*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "%s:\n", path);
119*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  device_name:             %s %s\n",
120*fa1cea9dSMarkus Armbruster                    s->name, s->vhost_dev ? "(vhost)" : "");
121*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  device_id:               %d\n", s->device_id);
122*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  vhost_started:           %s\n",
123*fa1cea9dSMarkus Armbruster                    s->vhost_started ? "true" : "false");
124*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  bus_name:                %s\n", s->bus_name);
125*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  broken:                  %s\n",
126*fa1cea9dSMarkus Armbruster                    s->broken ? "true" : "false");
127*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  disabled:                %s\n",
128*fa1cea9dSMarkus Armbruster                    s->disabled ? "true" : "false");
129*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  disable_legacy_check:    %s\n",
130*fa1cea9dSMarkus Armbruster                    s->disable_legacy_check ? "true" : "false");
131*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  started:                 %s\n",
132*fa1cea9dSMarkus Armbruster                    s->started ? "true" : "false");
133*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  use_started:             %s\n",
134*fa1cea9dSMarkus Armbruster                    s->use_started ? "true" : "false");
135*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  start_on_kick:           %s\n",
136*fa1cea9dSMarkus Armbruster                    s->start_on_kick ? "true" : "false");
137*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  use_guest_notifier_mask: %s\n",
138*fa1cea9dSMarkus Armbruster                    s->use_guest_notifier_mask ? "true" : "false");
139*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  vm_running:              %s\n",
140*fa1cea9dSMarkus Armbruster                    s->vm_running ? "true" : "false");
141*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  num_vqs:                 %"PRId64"\n", s->num_vqs);
142*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  queue_sel:               %d\n",
143*fa1cea9dSMarkus Armbruster                    s->queue_sel);
144*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  isr:                     %d\n", s->isr);
145*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  endianness:              %s\n",
146*fa1cea9dSMarkus Armbruster                    s->device_endian);
147*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  status:\n");
148*fa1cea9dSMarkus Armbruster     hmp_virtio_dump_status(mon, s->status);
149*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  Guest features:\n");
150*fa1cea9dSMarkus Armbruster     hmp_virtio_dump_features(mon, s->guest_features);
151*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  Host features:\n");
152*fa1cea9dSMarkus Armbruster     hmp_virtio_dump_features(mon, s->host_features);
153*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  Backend features:\n");
154*fa1cea9dSMarkus Armbruster     hmp_virtio_dump_features(mon, s->backend_features);
155*fa1cea9dSMarkus Armbruster 
156*fa1cea9dSMarkus Armbruster     if (s->vhost_dev) {
157*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "  VHost:\n");
158*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "    nvqs:           %d\n",
159*fa1cea9dSMarkus Armbruster                        s->vhost_dev->nvqs);
160*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "    vq_index:       %"PRId64"\n",
161*fa1cea9dSMarkus Armbruster                        s->vhost_dev->vq_index);
162*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "    max_queues:     %"PRId64"\n",
163*fa1cea9dSMarkus Armbruster                        s->vhost_dev->max_queues);
164*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "    n_mem_sections: %"PRId64"\n",
165*fa1cea9dSMarkus Armbruster                        s->vhost_dev->n_mem_sections);
166*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "    n_tmp_sections: %"PRId64"\n",
167*fa1cea9dSMarkus Armbruster                        s->vhost_dev->n_tmp_sections);
168*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "    backend_cap:    %"PRId64"\n",
169*fa1cea9dSMarkus Armbruster                        s->vhost_dev->backend_cap);
170*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "    log_enabled:    %s\n",
171*fa1cea9dSMarkus Armbruster                        s->vhost_dev->log_enabled ? "true" : "false");
172*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "    log_size:       %"PRId64"\n",
173*fa1cea9dSMarkus Armbruster                        s->vhost_dev->log_size);
174*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "    Features:\n");
175*fa1cea9dSMarkus Armbruster         hmp_virtio_dump_features(mon, s->vhost_dev->features);
176*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "    Acked features:\n");
177*fa1cea9dSMarkus Armbruster         hmp_virtio_dump_features(mon, s->vhost_dev->acked_features);
178*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "    Backend features:\n");
179*fa1cea9dSMarkus Armbruster         hmp_virtio_dump_features(mon, s->vhost_dev->backend_features);
180*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "    Protocol features:\n");
181*fa1cea9dSMarkus Armbruster         hmp_virtio_dump_protocols(mon, s->vhost_dev->protocol_features);
182*fa1cea9dSMarkus Armbruster     }
183*fa1cea9dSMarkus Armbruster 
184*fa1cea9dSMarkus Armbruster     qapi_free_VirtioStatus(s);
185*fa1cea9dSMarkus Armbruster }
186*fa1cea9dSMarkus Armbruster 
hmp_vhost_queue_status(Monitor * mon,const QDict * qdict)187*fa1cea9dSMarkus Armbruster void hmp_vhost_queue_status(Monitor *mon, const QDict *qdict)
188*fa1cea9dSMarkus Armbruster {
189*fa1cea9dSMarkus Armbruster     Error *err = NULL;
190*fa1cea9dSMarkus Armbruster     const char *path = qdict_get_try_str(qdict, "path");
191*fa1cea9dSMarkus Armbruster     int queue = qdict_get_int(qdict, "queue");
192*fa1cea9dSMarkus Armbruster     VirtVhostQueueStatus *s =
193*fa1cea9dSMarkus Armbruster         qmp_x_query_virtio_vhost_queue_status(path, queue, &err);
194*fa1cea9dSMarkus Armbruster 
195*fa1cea9dSMarkus Armbruster     if (err != NULL) {
196*fa1cea9dSMarkus Armbruster         hmp_handle_error(mon, err);
197*fa1cea9dSMarkus Armbruster         return;
198*fa1cea9dSMarkus Armbruster     }
199*fa1cea9dSMarkus Armbruster 
200*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "%s:\n", path);
201*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  device_name:          %s (vhost)\n",
202*fa1cea9dSMarkus Armbruster                    s->name);
203*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  kick:                 %"PRId64"\n", s->kick);
204*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  call:                 %"PRId64"\n", s->call);
205*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  VRing:\n");
206*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    num:         %"PRId64"\n", s->num);
207*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    desc:        0x%016"PRIx64"\n", s->desc);
208*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    desc_phys:   0x%016"PRIx64"\n",
209*fa1cea9dSMarkus Armbruster                    s->desc_phys);
210*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    desc_size:   %"PRId32"\n", s->desc_size);
211*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    avail:       0x%016"PRIx64"\n", s->avail);
212*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    avail_phys:  0x%016"PRIx64"\n",
213*fa1cea9dSMarkus Armbruster                    s->avail_phys);
214*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    avail_size:  %"PRId32"\n", s->avail_size);
215*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    used:        0x%016"PRIx64"\n", s->used);
216*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    used_phys:   0x%016"PRIx64"\n",
217*fa1cea9dSMarkus Armbruster                    s->used_phys);
218*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    used_size:   %"PRId32"\n", s->used_size);
219*fa1cea9dSMarkus Armbruster 
220*fa1cea9dSMarkus Armbruster     qapi_free_VirtVhostQueueStatus(s);
221*fa1cea9dSMarkus Armbruster }
222*fa1cea9dSMarkus Armbruster 
hmp_virtio_queue_status(Monitor * mon,const QDict * qdict)223*fa1cea9dSMarkus Armbruster void hmp_virtio_queue_status(Monitor *mon, const QDict *qdict)
224*fa1cea9dSMarkus Armbruster {
225*fa1cea9dSMarkus Armbruster     Error *err = NULL;
226*fa1cea9dSMarkus Armbruster     const char *path = qdict_get_try_str(qdict, "path");
227*fa1cea9dSMarkus Armbruster     int queue = qdict_get_int(qdict, "queue");
228*fa1cea9dSMarkus Armbruster     VirtQueueStatus *s = qmp_x_query_virtio_queue_status(path, queue, &err);
229*fa1cea9dSMarkus Armbruster 
230*fa1cea9dSMarkus Armbruster     if (err != NULL) {
231*fa1cea9dSMarkus Armbruster         hmp_handle_error(mon, err);
232*fa1cea9dSMarkus Armbruster         return;
233*fa1cea9dSMarkus Armbruster     }
234*fa1cea9dSMarkus Armbruster 
235*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "%s:\n", path);
236*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  device_name:          %s\n", s->name);
237*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  queue_index:          %d\n", s->queue_index);
238*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  inuse:                %d\n", s->inuse);
239*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  used_idx:             %d\n", s->used_idx);
240*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  signalled_used:       %d\n",
241*fa1cea9dSMarkus Armbruster                    s->signalled_used);
242*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  signalled_used_valid: %s\n",
243*fa1cea9dSMarkus Armbruster                    s->signalled_used_valid ? "true" : "false");
244*fa1cea9dSMarkus Armbruster     if (s->has_last_avail_idx) {
245*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "  last_avail_idx:       %d\n",
246*fa1cea9dSMarkus Armbruster                        s->last_avail_idx);
247*fa1cea9dSMarkus Armbruster     }
248*fa1cea9dSMarkus Armbruster     if (s->has_shadow_avail_idx) {
249*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "  shadow_avail_idx:     %d\n",
250*fa1cea9dSMarkus Armbruster                        s->shadow_avail_idx);
251*fa1cea9dSMarkus Armbruster     }
252*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  VRing:\n");
253*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    num:          %"PRId32"\n", s->vring_num);
254*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    num_default:  %"PRId32"\n",
255*fa1cea9dSMarkus Armbruster                    s->vring_num_default);
256*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    align:        %"PRId32"\n",
257*fa1cea9dSMarkus Armbruster                    s->vring_align);
258*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    desc:         0x%016"PRIx64"\n",
259*fa1cea9dSMarkus Armbruster                    s->vring_desc);
260*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    avail:        0x%016"PRIx64"\n",
261*fa1cea9dSMarkus Armbruster                    s->vring_avail);
262*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    used:         0x%016"PRIx64"\n",
263*fa1cea9dSMarkus Armbruster                    s->vring_used);
264*fa1cea9dSMarkus Armbruster 
265*fa1cea9dSMarkus Armbruster     qapi_free_VirtQueueStatus(s);
266*fa1cea9dSMarkus Armbruster }
267*fa1cea9dSMarkus Armbruster 
hmp_virtio_queue_element(Monitor * mon,const QDict * qdict)268*fa1cea9dSMarkus Armbruster void hmp_virtio_queue_element(Monitor *mon, const QDict *qdict)
269*fa1cea9dSMarkus Armbruster {
270*fa1cea9dSMarkus Armbruster     Error *err = NULL;
271*fa1cea9dSMarkus Armbruster     const char *path = qdict_get_try_str(qdict, "path");
272*fa1cea9dSMarkus Armbruster     int queue = qdict_get_int(qdict, "queue");
273*fa1cea9dSMarkus Armbruster     int index = qdict_get_try_int(qdict, "index", -1);
274*fa1cea9dSMarkus Armbruster     VirtioQueueElement *e;
275*fa1cea9dSMarkus Armbruster     VirtioRingDescList *list;
276*fa1cea9dSMarkus Armbruster 
277*fa1cea9dSMarkus Armbruster     e = qmp_x_query_virtio_queue_element(path, queue, index != -1,
278*fa1cea9dSMarkus Armbruster                                          index, &err);
279*fa1cea9dSMarkus Armbruster     if (err != NULL) {
280*fa1cea9dSMarkus Armbruster         hmp_handle_error(mon, err);
281*fa1cea9dSMarkus Armbruster         return;
282*fa1cea9dSMarkus Armbruster     }
283*fa1cea9dSMarkus Armbruster 
284*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "%s:\n", path);
285*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  device_name: %s\n", e->name);
286*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  index:   %d\n", e->index);
287*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  desc:\n");
288*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    descs:\n");
289*fa1cea9dSMarkus Armbruster 
290*fa1cea9dSMarkus Armbruster     list = e->descs;
291*fa1cea9dSMarkus Armbruster     while (list) {
292*fa1cea9dSMarkus Armbruster         monitor_printf(mon, "        addr 0x%"PRIx64" len %d",
293*fa1cea9dSMarkus Armbruster                        list->value->addr, list->value->len);
294*fa1cea9dSMarkus Armbruster         if (list->value->flags) {
295*fa1cea9dSMarkus Armbruster             strList *flag = list->value->flags;
296*fa1cea9dSMarkus Armbruster             monitor_printf(mon, " (");
297*fa1cea9dSMarkus Armbruster             while (flag) {
298*fa1cea9dSMarkus Armbruster                 monitor_printf(mon, "%s", flag->value);
299*fa1cea9dSMarkus Armbruster                 flag = flag->next;
300*fa1cea9dSMarkus Armbruster                 if (flag) {
301*fa1cea9dSMarkus Armbruster                     monitor_printf(mon, ", ");
302*fa1cea9dSMarkus Armbruster                 }
303*fa1cea9dSMarkus Armbruster             }
304*fa1cea9dSMarkus Armbruster             monitor_printf(mon, ")");
305*fa1cea9dSMarkus Armbruster         }
306*fa1cea9dSMarkus Armbruster         list = list->next;
307*fa1cea9dSMarkus Armbruster         if (list) {
308*fa1cea9dSMarkus Armbruster             monitor_printf(mon, ",\n");
309*fa1cea9dSMarkus Armbruster         }
310*fa1cea9dSMarkus Armbruster     }
311*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "\n");
312*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  avail:\n");
313*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    flags: %d\n", e->avail->flags);
314*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    idx:   %d\n", e->avail->idx);
315*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    ring:  %d\n", e->avail->ring);
316*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "  used:\n");
317*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    flags: %d\n", e->used->flags);
318*fa1cea9dSMarkus Armbruster     monitor_printf(mon, "    idx:   %d\n", e->used->idx);
319*fa1cea9dSMarkus Armbruster 
320*fa1cea9dSMarkus Armbruster     qapi_free_VirtioQueueElement(e);
321*fa1cea9dSMarkus Armbruster }
322