From: Amit Shah <amit.shah@redhat.com>
To: qemu-devel@nongnu.org
Cc: Amit Shah <amit.shah@redhat.com>
Subject: [Qemu-devel] [PATCH 4/6] virtio-console-port: Add a new device on the virtio-console-bus for generic host-guest communication
Date: Tue, 29 Sep 2009 17:34:46 +0530 [thread overview]
Message-ID: <1254225888-17093-5-git-send-email-amit.shah@redhat.com> (raw)
In-Reply-To: <1254225888-17093-4-git-send-email-amit.shah@redhat.com>
This is a new device that uses the virtio-console bus.
Sample uses for such a device can be obtaining info from the
guest like the file systems used, apps installed, etc. for
offline usage and logged-in users, clipboard copy-paste, etc.
for online usage.
For requirements, use-cases and some history see
http://www.linux-kvm.org/page/VMchannel_Requirements
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
Makefile.target | 2 +-
hw/virtio-console-port.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 1 deletions(-)
create mode 100644 hw/virtio-console-port.c
diff --git a/Makefile.target b/Makefile.target
index 22a2644..918275a 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -173,7 +173,7 @@ obj-y = vl.o monitor.o pci.o isa_mmio.o machine.o \
gdbstub.o gdbstub-xml.o
# virtio has to be here due to weird dependency between PCI and virtio-net.
# need to fix this properly
-obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o virtio-console-bus.o virtio-pci.o
+obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o virtio-console-port.o virtio-console-bus.o virtio-pci.o
obj-$(CONFIG_KVM) += kvm.o kvm-all.o
LIBS+=-lz
diff --git a/hw/virtio-console-port.c b/hw/virtio-console-port.c
new file mode 100644
index 0000000..f8c0bbc
--- /dev/null
+++ b/hw/virtio-console-port.c
@@ -0,0 +1,54 @@
+/*
+ * Virtio Serial Port
+ *
+ * Copyright Red Hat, Inc. 2009
+ *
+ * Authors:
+ * Amit Shah <amit.shah@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#include "hw.h"
+#include "qemu-char.h"
+#include "virtio-console.h"
+
+typedef struct VirtIOConsole
+{
+ VirtConPort port;
+} VirtIOConsole;
+
+static size_t flush_buf(VirtConPort *port, const uint8_t *buf, size_t len)
+{
+ return qemu_chr_write(port->chr, buf, len);
+}
+
+static int vcon_port_initfn(VirtConDevice *dev)
+{
+ VirtConPort *port = DO_UPCAST(VirtConPort, dev, &dev->qdev);
+
+ port->info = dev->info;
+
+ return 0;
+}
+
+static VirtConPortInfo virtcon_port_info = {
+ .qdev.name = "virtconport",
+ .qdev.size = sizeof(VirtConPort),
+ .init = vcon_port_initfn,
+ .have_data = flush_buf,
+ .qdev.props = (Property[]) {
+ DEFINE_PROP_CHR("chardev", VirtConPort, chr),
+ DEFINE_PROP_STRING("name", VirtConPort, name),
+ DEFINE_PROP_INT32("flush_buffers", VirtConPort, flush_buffers, 0),
+ DEFINE_PROP_END_OF_LIST(),
+ },
+};
+
+static void virtcon_port_register(void)
+{
+ virtcon_port_qdev_register(&virtcon_port_info);
+}
+device_init(virtcon_port_register)
--
1.6.2.5
next prev parent reply other threads:[~2009-09-29 12:05 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-29 12:04 [Qemu-devel] virtio-console-bus, multiport, virtio-console-port Amit Shah
2009-09-29 12:04 ` [Qemu-devel] [PATCH 1/6] char: Emit 'OPENED' events on char device open Amit Shah
2009-09-29 12:04 ` [Qemu-devel] [PATCH 2/6] qdev: add string property Amit Shah
2009-09-29 12:04 ` [Qemu-devel] [PATCH 3/6] virtio-console: Add a virtio-console bus, support for multiple ports Amit Shah
2009-09-29 12:04 ` Amit Shah [this message]
2009-09-29 12:04 ` [Qemu-devel] [PATCH 5/6] vnc: add a is_vnc_active() helper Amit Shah
2009-09-29 12:04 ` [Qemu-devel] [PATCH 6/6] vnc: Add a virtio-console-bus device to send / receive guest clipboard Amit Shah
2009-09-29 18:13 ` Gerd Hoffmann
2009-09-30 4:50 ` Amit Shah
2009-09-29 18:08 ` [Qemu-devel] [PATCH 4/6] virtio-console-port: Add a new device on the virtio-console-bus for generic host-guest communication Gerd Hoffmann
2009-09-30 8:09 ` Nathan Baum
2009-09-29 18:04 ` [Qemu-devel] [PATCH 3/6] virtio-console: Add a virtio-console bus, support for multiple ports Gerd Hoffmann
2009-09-30 4:47 ` Amit Shah
2009-09-30 8:59 ` Gerd Hoffmann
2009-09-30 15:55 ` Amit Shah
2009-09-30 18:39 ` Gerd Hoffmann
2009-10-01 4:54 ` Amit Shah
2009-10-01 8:38 ` Gerd Hoffmann
2009-10-01 8:56 ` Amit Shah
2009-10-01 10:48 ` Amit Shah
2009-10-01 12:15 ` Gerd Hoffmann
2009-10-07 9:25 ` Amit Shah
2009-10-07 9:51 ` Gerd Hoffmann
2009-10-07 10:06 ` Amit Shah
2009-10-07 11:33 ` Gerd Hoffmann
2009-10-07 11:42 ` Amit Shah
2009-10-07 13:06 ` Gerd Hoffmann
2009-10-07 13:53 ` Amit Shah
2009-10-07 14:03 ` Gerd Hoffmann
2009-10-07 14:00 ` Anthony Liguori
2009-09-30 21:13 ` [Qemu-devel] [PATCH 1/6] char: Emit 'OPENED' events on char device open Anthony Liguori
2009-10-01 4:56 ` Amit Shah
2009-10-01 6:02 ` Amit Shah
2009-10-01 12:54 ` Anthony Liguori
2009-10-01 13:43 ` Gerd Hoffmann
2009-10-01 13:48 ` Anthony Liguori
2009-10-01 15:18 ` Gerd Hoffmann
2009-09-29 14:53 ` [Qemu-devel] virtio-console-bus, multiport, virtio-console-port Amit Shah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1254225888-17093-5-git-send-email-amit.shah@redhat.com \
--to=amit.shah@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).