Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LNYT5-0002hZ-04 for qemu-devel@nongnu.org; Thu, 15 Jan 2009 15:05:31 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LNYT2-0002fS-B5 for qemu-devel@nongnu.org; Thu, 15 Jan 2009 15:05:29 -0500 Received: from [199.232.76.173] (port=48136 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNYT2-0002fK-2W for qemu-devel@nongnu.org; Thu, 15 Jan 2009 15:05:28 -0500 Received: from savannah.gnu.org ([199.232.41.3]:51047 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LNYT1-000181-CD for qemu-devel@nongnu.org; Thu, 15 Jan 2009 15:05:27 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LNYT0-00020L-Pq for qemu-devel@nongnu.org; Thu, 15 Jan 2009 20:05:26 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LNYT0-00020H-Ft for qemu-devel@nongnu.org; Thu, 15 Jan 2009 20:05:26 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Thu, 15 Jan 2009 20:05:26 +0000 Subject: [Qemu-devel] [6315] add virtio-console support (Christian Ehrhardt) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6315 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6315 Author: aliguori Date: 2009-01-15 20:05:25 +0000 (Thu, 15 Jan 2009) Log Message: ----------- add virtio-console support (Christian Ehrhardt) This patch adds the virtio console to qemu. This console can be found after the serial and parallel outputs as another virtual console. In the -nographic case it is redirected to the null output by default. Signed-off-by: Christian Ehrhardt Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/Makefile.target trunk/sysemu.h trunk/vl.c Modified: trunk/Makefile.target =================================================================== --- trunk/Makefile.target 2009-01-15 18:57:25 UTC (rev 6314) +++ trunk/Makefile.target 2009-01-15 20:05:25 UTC (rev 6315) @@ -554,7 +554,7 @@ OBJS=vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o # virtio has to be here due to weird dependency between PCI and virtio-net. # need to fix this properly -OBJS+=virtio.o virtio-blk.o virtio-balloon.o virtio-net.o +OBJS+=virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o OBJS+=fw_cfg.o ifdef CONFIG_KVM OBJS+=kvm.o kvm-all.o Modified: trunk/sysemu.h =================================================================== --- trunk/sysemu.h 2009-01-15 18:57:25 UTC (rev 6314) +++ trunk/sysemu.h 2009-01-15 20:05:25 UTC (rev 6315) @@ -158,6 +158,12 @@ extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; +/* virtio consoles */ + +#define MAX_VIRTIO_CONSOLES 1 + +extern CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES]; + #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) #ifdef NEED_CPU_H Modified: trunk/vl.c =================================================================== --- trunk/vl.c 2009-01-15 18:57:25 UTC (rev 6314) +++ trunk/vl.c 2009-01-15 20:05:25 UTC (rev 6315) @@ -209,6 +209,7 @@ int no_quit = 0; CharDriverState *serial_hds[MAX_SERIAL_PORTS]; CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; +CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES]; #ifdef TARGET_I386 int win2k_install_hack = 0; #endif @@ -4502,6 +4503,8 @@ int serial_device_index; const char *parallel_devices[MAX_PARALLEL_PORTS]; int parallel_device_index; + const char *virtio_consoles[MAX_VIRTIO_CONSOLES]; + int virtio_console_index; const char *loadvm = NULL; QEMUMachine *machine; const char *cpu_model; @@ -4575,6 +4578,11 @@ parallel_devices[i] = NULL; parallel_device_index = 0; + virtio_consoles[0] = "vc:80Cx24C"; + for(i = 1; i < MAX_VIRTIO_CONSOLES; i++) + virtio_consoles[i] = NULL; + virtio_console_index = 0; + usb_devices_index = 0; nb_net_clients = 0; @@ -5170,6 +5178,8 @@ parallel_devices[0] = "null"; if (strncmp(monitor_device, "vc", 2) == 0) monitor_device = "stdio"; + if (virtio_console_index == 0) + virtio_consoles[0] = "null"; } #ifndef _WIN32 @@ -5464,6 +5474,22 @@ } } + for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) { + const char *devname = virtio_consoles[i]; + if (devname && strcmp(devname, "none")) { + char label[32]; + snprintf(label, sizeof(label), "virtcon%d", i); + virtcon_hds[i] = qemu_chr_open(label, devname); + if (!virtcon_hds[i]) { + fprintf(stderr, "qemu: could not open virtio console '%s'\n", + devname); + exit(1); + } + if (strstart(devname, "vc", 0)) + qemu_chr_printf(virtcon_hds[i], "virtio console%d\r\n", i); + } + } + if (kvm_enabled()) { int ret;