2 * HMP commands related to cryptodev
4 * Copyright (c) 2023 Bytedance.Inc
7 * zhenwei pi<pizhenwei@bytedance.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or
10 * (at your option) any later version.
13 #include "qemu/osdep.h"
14 #include "monitor/hmp.h"
15 #include "monitor/monitor.h"
16 #include "qapi/qapi-commands-cryptodev.h"
17 #include "qapi/qmp/qdict.h"
20 void hmp_info_cryptodev(Monitor
*mon
, const QDict
*qdict
)
22 QCryptodevInfoList
*il
;
23 QCryptodevBackendServiceTypeList
*sl
;
24 QCryptodevBackendClientList
*cl
;
26 for (il
= qmp_query_cryptodev(NULL
); il
; il
= il
->next
) {
27 g_autofree
char *services
= NULL
;
28 QCryptodevInfo
*info
= il
->value
;
31 /* build a string like 'service=[akcipher|mac|hash|cipher]' */
32 for (sl
= info
->service
; sl
; sl
= sl
->next
) {
33 const char *service
= QCryptodevBackendServiceType_str(sl
->value
);
36 services
= g_strdup(service
);
38 tmp_services
= g_strjoin("|", services
, service
, NULL
);
40 services
= tmp_services
;
43 monitor_printf(mon
, "%s: service=[%s]\n", info
->id
, services
);
45 for (cl
= info
->client
; cl
; cl
= cl
->next
) {
46 QCryptodevBackendClient
*client
= cl
->value
;
47 monitor_printf(mon
, " queue %" PRIu32
": type=%s\n",
49 QCryptodevBackendType_str(client
->type
));
53 qapi_free_QCryptodevInfoList(il
);