Skip to content

Commit

Permalink
ui/vdagent: core infrastructure
Browse files Browse the repository at this point in the history
The vdagent protocol allows the guest agent (spice-vdagent) and the
spice client exchange messages to implement features which require
guest cooperation, for example clipboard support.

This is a qemu implementation of the spice client side.  This allows
the spice guest agent talk to qemu directly when not using the spice
protocol.

usage: qemu \
  -chardev qemu-vdagent,id=vdagent \
  -device virtserialport,chardev=vdagent,name=com.redhat.spice.0

This patch adds just the protocol basics: initial handshake and
capability negotiation.  The following patches will add actual
functionality and also add fields to the initially empty
ChardevVDAgent qapi struct.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20210519053940.1888907-1-kraxel@redhat.com
Message-Id: <20210519053940.1888907-5-kraxel@redhat.com>
  • Loading branch information
kraxel committed May 21, 2021
1 parent 3f20c6d commit de74a22
Show file tree
Hide file tree
Showing 4 changed files with 386 additions and 1 deletion.
17 changes: 16 additions & 1 deletion qapi/char.json
Expand Up @@ -390,12 +390,25 @@
'data': { '*size': 'int' },
'base': 'ChardevCommon' }

##
# @ChardevQemuVDAgent:
#
# Configuration info for qemu vdagent implementation.
#
# Since: 6.1
#
##
{ 'struct': 'ChardevQemuVDAgent',
'data': { },
'base': 'ChardevCommon',
'if': 'defined(CONFIG_SPICE_PROTOCOL)' }

##
# @ChardevBackend:
#
# Configuration info for the new chardev backend.
#
# Since: 1.4 (testdev since 2.2, wctablet since 2.9)
# Since: 1.4 (testdev since 2.2, wctablet since 2.9, vdagent since 6.1)
##
{ 'union': 'ChardevBackend',
'data': { 'file': 'ChardevFile',
Expand All @@ -417,6 +430,8 @@
'if': 'defined(CONFIG_SPICE)' },
'spiceport': { 'type': 'ChardevSpicePort',
'if': 'defined(CONFIG_SPICE)' },
'qemu-vdagent': { 'type': 'ChardevQemuVDAgent',
'if': 'defined(CONFIG_SPICE_PROTOCOL)' },
'vc': 'ChardevVC',
'ringbuf': 'ChardevRingbuf',
# next one is just for compatibility
Expand Down
1 change: 1 addition & 0 deletions ui/meson.build
Expand Up @@ -14,6 +14,7 @@ softmmu_ss.add(files(
'qemu-pixman.c',
))
softmmu_ss.add([spice_headers, files('spice-module.c')])
softmmu_ss.add(when: spice_protocol, if_true: files('vdagent.c'))

softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('input-linux.c'))
softmmu_ss.add(when: cocoa, if_true: files('cocoa.m'))
Expand Down
8 changes: 8 additions & 0 deletions ui/trace-events
Expand Up @@ -124,3 +124,11 @@ xkeymap_extension(const char *name) "extension '%s'"
xkeymap_vendor(const char *name) "vendor '%s'"
xkeymap_keycodes(const char *name) "keycodes '%s'"
xkeymap_keymap(const char *name) "keymap '%s'"

# vdagent.c
vdagent_open(void) ""
vdagent_close(void) ""
vdagent_send(const char *name) "msg %s"
vdagent_recv_chunk(uint32_t size) "size %d"
vdagent_recv_msg(const char *name, uint32_t size) "msg %s, size %d"
vdagent_peer_cap(const char *name) "cap %s"

0 comments on commit de74a22

Please sign in to comment.