summaryrefslogtreecommitdiffstats
path: root/qemu-char.c
Commit message (Collapse)AuthorAgeFilesLines
* char: Fix return type of qemu_chr_fe_add_watch()Kevin Wolf2013-03-191-2/+2
| | | | | | | | | | | | | | qemu_chr_fe_add_watch() can return negative errors, therefore it must not have an unsigned return type. For consistency with other qemu_chr_fe_* functions, this uses a standard C int instead of glib types. In situations where qemu_chr_fe_add_watch() is falsely assumed to have succeeded, the serial ports would go into a state where it never becomes ready for transmitting more data; this is fixed by this patch. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char.c: fix waiting for telnet connection messageIgor Mitsyanko2013-03-131-1/+1
| | | | | | | | | | | | Current colon position in "waiting for telnet connection" message template produces messages like: QEMU waiting for connection on: telnet::127.0.0.16666,server After moving a colon to the right, we will get a correct messages like: QEMU waiting for connection on: telnet:127.0.0.1:6666,server Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* chardev: add udp support to qapiGerd Hoffmann2013-03-131-18/+26
| | | | | | This patch adds 'udp' support to qapi. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* chardev: add memory (ringbuf) support to qapiGerd Hoffmann2013-03-131-7/+23
| | | | | | | This patch adds 'memory' support to qapi and also switches over the memory chardev initialization to the new qapi code path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* chardev: add vc support to qapiGerd Hoffmann2013-03-131-0/+3
| | | | | | | This patch adds 'vc' support to qapi and also switches over the vc chardev initialization to the new qapi code path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* chardev: add spice support to qapiGerd Hoffmann2013-03-131-0/+8
| | | | | | This patch adds 'spicevmc' and 'spiceport' support to qapi and also switches over the spice chardev initialization to the new qapi code path.
* chardev: add pipe support to qapiGerd Hoffmann2013-03-131-9/+22
| | | | | | | This patch adds 'pipe' support to qapi and also switches over the pipe chardev initialization to the new qapi code path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* chardev: add console support to qapiGerd Hoffmann2013-03-131-2/+7
| | | | | | | This patch adds 'console' support to qapi and also switches over the console chardev initialization to the new qapi code path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* chardev: switch pty init to qapiGerd Hoffmann2013-03-131-25/+10
| | | | | | | | | | This patch switches over the pty chardev initialization to the new qapi code path. Bonus: Taking QemuOpts out of the loop allows some nice cleanups along the way. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* chardev: switch parallel init to qapiGerd Hoffmann2013-03-131-20/+17
| | | | | | | This patch switches over the parallel chardev initialization to the new qapi code path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* chardev: switch serial/tty init to qapiGerd Hoffmann2013-03-131-20/+17
| | | | | | | This patch switches over the serial chardev initialization to the new qapi code path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* chardev: add stdio support to qapiGerd Hoffmann2013-03-131-6/+20
| | | | | | | This patch adds 'stdio' support to qapi and also switches over the stdio chardev initialization to the new qapi code path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* chardev: switch file init to qapiGerd Hoffmann2013-03-131-28/+15
| | | | | | | This patch switches over the 'file' chardev initialization to the new qapi code path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* chardev: add braille support to qapiGerd Hoffmann2013-03-131-0/+5
| | | | | | | This patch adds 'braille' support to qapi and also switches over the braille chardev initialization to the new qapi code path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* chardev: add msmouse support to qapiGerd Hoffmann2013-03-131-0/+3
| | | | | | | This patch adds 'msmouse' support to qapi and also switches over the msmouse chardev initialization to the new qapi code path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* chardev: switch null init to qapiGerd Hoffmann2013-03-131-3/+3
| | | | | | | This patch switches over the 'null' chardev initialization to the new qapi code path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* chardev: add mux chardev support to qapiGerd Hoffmann2013-03-131-3/+32
| | | | | This adds mux chardev support to the qapi and also makes the qapi-based chardev creation path handle the "mux=on" option correctly.
* chardev: add support for qapi-based chardev initializationGerd Hoffmann2013-03-131-0/+43
| | | | | | | | | | This patch add support for a new way to initialize chardev devices. Instead of calling a initialization function with a QemuOpts we will now create a (qapi) ChardevBackend, optionally call a function to fill ChardevBackend from QemuOpts, then go create the chardev using the new qapi code path which is also used by chardev-add. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Add a TPM Passthrough backend driver implementationStefan Berger2013-03-121-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is based of off version 9 of Stefan Berger's patch series "QEMU Trusted Platform Module (TPM) integration" and adds a new backend driver for it. This patch adds a passthrough backend driver for passing commands sent to the emulated TPM device directly to a TPM device opened on the host machine. Thus it is possible to use a hardware TPM device in a system running on QEMU, providing the ability to access a TPM in a special state (e.g. after a Trusted Boot). This functionality is being used in the acTvSM Trusted Virtualization Platform which is available on [1]. Usage example: qemu-system-x86_64 -tpmdev passthrough,id=tpm0,path=/dev/tpm0 \ -device tpm-tis,tpmdev=tpm0 \ -cdrom test.iso -boot d Some notes about the host TPM: The TPM needs to be enabled and activated. If that's not the case one has to go through the BIOS/UEFI and enable and activate that TPM for TPM commands to work as expected. It may be necessary to boot the kernel using tpm_tis.force=1 in the boot command line or 'modprobe tpm_tis force=1' in case of using it as a module. Regards, Andreas Niederl, Stefan Berger [1] http://trustedjava.sourceforge.net/ Signed-off-by: Andreas Niederl <andreas.niederl@iaik.tugraz.at> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Corey Bryant <coreyb@linux.vnet.ibm.com> Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com> Message-id: 1361987275-26289-6-git-send-email-stefanb@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: fix win32 buildBlue Swirl2013-03-101-2/+4
| | | | | | | | | | 96c6384776d631839a9c8fe02bf135f9ba22586c did not adjust Win32 #ifdeffery properly, breaking build in later commits. Fix. Signed-off-by: Blue Swirl <blauwirbel@gmail.com> Tested-by: Igor Mitsyanko <i.mitsyanko@gmail.com> Message-id: 0ba5565b1ed44380c57d4a5fab86e9549f581ebf.1362822910.git.blauwirbel@gmail.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: move text console init to console.cAnthony Liguori2013-03-081-1/+0
| | | | | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 17cefde0a8d7807294bab95e93c3328a20d3f2ed.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: move msmouse registeration to msmouse.cAnthony Liguori2013-03-081-2/+1
| | | | | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: b47d1153b0d7669743c9a6bb98ce30f4cf7f876b.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: move baum registration to baum.cAnthony Liguori2013-03-081-4/+0
| | | | | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 1b24baa1ec3a174d5cad31e079d829904b53077b.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: move spice registration to spice-qemu-char.cAnthony Liguori2013-03-081-6/+0
| | | | | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 49a8d12eeb117e5530b2fab02af7681b54f9245c.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: make char drivers dynamically registerableAnthony Liguori2013-03-081-44/+66
| | | | | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 0ff4f5f2b8b7afdb85a0c241403ad73f472f0b81.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: remove use of QEMUTimer in favor of glib idle functionAnthony Liguori2013-03-081-7/+5
| | | | | | | | | qemu-char is now independent of the QEMU main loop. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 3cda0bbcfb94912df8a767983a52bb71a4a3231d.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: use a glib timeout instead of qemu-timerAnthony Liguori2013-03-081-23/+45
| | | | | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 05a883ce5a98275b976bf0124610599859c2b7da.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* char: add gio watch fn for tcp backendsAmit Shah2013-03-081-0/+7
| | | | | | Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: b50e668c4f4146a654c5d4412440eb9e589f2c02.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: add pty watchAnthony Liguori2013-03-081-0/+7
| | | | | | | | | This lets ptys support adding front end watchs. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 23380f37b22d407ba0b9e080f6ea0d66b279f2d2.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: add watch supportAnthony Liguori2013-03-081-1/+31
| | | | | | | | | | This allows a front-end to request for a callback when the backend is writable again. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 96f93c0f741064604bbb6389ce962191120af8b7.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: tcp: make use GIOChannelAnthony Liguori2013-03-081-18/+42
| | | | | | | | | | I didn't bother switching to g_io_channel_read/write because we need to use sendmsg on Unix. No problem though since we're using an unbuffered channel. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 002f726576dfb51bca4854aa257b74d77c1cd4e8.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: convert UDP to GIOChannelAnthony Liguori2013-03-081-11/+57
| | | | | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 775a2bd666a3d1fa008656bf97191b7573c6ffb5.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: convert pty to GIOChannelAnthony Liguori2013-03-081-17/+27
| | | | | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 339eebf3c59a450b0354056e9ac4b41f67230831.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: convert fd_chr to use a GIOChannelAnthony Liguori2013-03-081-41/+62
| | | | | | | | | This uses the newly introduced IOWatchPoll source. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 0cb5d14510ee835a0ebc23676d10a2cce9280da5.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* char: add IOWatchPoll supportAnthony Liguori2013-03-081-0/+140
| | | | | | | | | | | | | This is a special GSource that supports CharDriverState style poll callbacks. For reviewability and bisectability, this code is #if 0'd out in this patch to avoid unused warnings since all of the functions are static. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: 9b59ac17b9d0bb3972a73fed04d415f07b391936.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: remove dead/confusing logic with nb_stdio_clientsAnthony Liguori2013-03-081-106/+30
| | | | | | | | | | | | | This code is very old dating back to 2007. What is puzzling is that STDIO_MAX_CLIENTS was always #define to 1 meaning that all of the code to deal with more than one client was unreachable. Just remove the whole mess of it. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: d276bccdbf4e7463020c5f539f61ae3bfbc88d1d.1362505276.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* move socket_set_nodelay to osdep.cMORITA Kazutaka2013-03-041-6/+0
| | | | | Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* console: allow VCs to be overridden by UIAnthony Liguori2013-02-211-1/+1
| | | | | | | | We want to expose VCs using a VteTerminal widget. We need access to provide our own CharDriverState in order to do this. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1361367806-4599-3-git-send-email-aliguori@us.ibm.com
* qapi: Flatten away ChardevPortMarkus Armbruster2013-02-131-35/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | Simplifies the schema and the code. QMP command { "execute" : "chardev-add", "arguments" : { "id" : "ser0", "backend" : { "type" : "port", "data" : { "type": "serial", "device":"/dev/ttyS0"} } } } becomes { "execute" : "chardev-add", "arguments" : { "id" : "ser0", "backend" : { "type" : "serial", "data" : { "device":"/dev/ttyS0"} } } } Bonus: nicer error messages. "unknown chardev port (1)" becomes "character device backend type 'parallel' not supported". Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-id: 1360767256-610-3-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* error: Strip trailing '\n' from error string arguments (again)Markus Armbruster2013-02-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 6daf194d and be62a2eb got rid of a bunch, but they keep coming back. Tracked down with this Coccinelle semantic patch: @r@ expression err, eno, cls, fmt; position p; @@ ( error_report(fmt, ...)@p | error_set(err, cls, fmt, ...)@p | error_set_errno(err, eno, cls, fmt, ...)@p | error_setg(err, fmt, ...)@p | error_setg_errno(err, eno, fmt, ...)@p ) @script:python@ fmt << r.fmt; p << r.p; @@ if "\\n" in str(fmt): print "%s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt) Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1360354939-10994-4-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: Support suffixed ringbuf size arguments like "size=64K"Markus Armbruster2013-02-061-4/+3
| | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: Saner naming of memchar stuff & doc fixesMarkus Armbruster2013-02-061-29/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | New device, has never been released, so we can still improve things without worrying about compatibility. Naming is a mess. The code calls the device driver CirMemCharDriver, the public API calls it "memory", "memchardev", or "memchar", and the special commands are named like "memchar-FOO". "memory" is a particularly unfortunate choice, because there's another character device driver called MemoryDriver. Moreover, the device's distinctive property is that it's a ring buffer, not that's in memory. Therefore: * Rename CirMemCharDriver to RingBufCharDriver, and call the thing a "ringbuf" in the API. * Rename QMP and HMP commands from memchar-FOO to ringbuf-FOO. * Rename device parameter from maxcapacity to size (simple words are good for you). * Clearly mark the parameter as optional in documentation. * Fix error reporting so that chardev-add reports to current monitor, not stderr. * Replace cirmem in C identifiers by ringbuf. * Rework documentation. Document the impact of our crappy UTF-8 handling on reading. * QMP examples that even work. I could split this up into multiple commits, but they'd change the same documentation lines multiple times. Not worth it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: General chardev "memory" code cleanupMarkus Armbruster2013-02-061-19/+12
| | | | | | | | | | | | | | | | | | Inline trivial cirmem_chr_is_empty() into its only caller. Rename qemu_chr_cirmem_count() to cirmem_count(). Fast ring buffer index wraparound. Without this, there's no point in restricting size to a power two. qemu_is_chr(chr, "memory") returns *zero* when chr is a memory character device, which isn't what I'd expect. Replace it by the saner and more obviously correct chr_is_cirmem(). Also avoids encouraging testing for specific character devices elsewhere. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: Drop undocumented chardev "memory" compatibility syntaxMarkus Armbruster2013-02-061-5/+0
| | | | | | | | | This is a new device, so there's no compatibility to maintain, and its use case isn't common enough to justify shorthand syntax. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: Fix chardev "memory" not to drop IAC charactersMarkus Armbruster2013-02-061-5/+0
| | | | | | | | Undocumented misfeature, get rid of it while we can. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qmp: Drop wasteful zero-initialization in qmp_memchar_read()Markus Armbruster2013-02-061-1/+2
| | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qmp: Drop superfluous special case "empty" in qmp_memchar_read()Markus Armbruster2013-02-061-4/+0
| | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qmp: Plug memory leaks in memchar-write, memchar-readMarkus Armbruster2013-02-061-0/+5
| | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qmp: Clean up type usage in qmp_memchar_write(), qmp_memchar_read()Markus Armbruster2013-02-061-3/+3
| | | | | | | | | Const-correctness, consistently use standard C types instead of mixing them with GLib types. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qmp: Use generic errors in memchar-read, memchar-writeMarkus Armbruster2013-02-061-2/+2
| | | | | | | | | New errors should be generic unless there's a real use case for rich errors. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud