Skip to content

Commit

Permalink
virtio-console: Automatically use virtio-serial-bus for the older -vi…
Browse files Browse the repository at this point in the history
…rtioconsole invocation

These hunks got dropped off mysteriously during the rebasing of my
virtio-serial series. Thanks go to Markus for noticing it.

Without these fixes, -virtioconsole doesn't actually have any effect.

Signed-off-by: Amit Shah <[email protected]>
Reported-by: Markus Armbruster <[email protected]>
Signed-off-by: Anthony Liguori <[email protected]>
  • Loading branch information
amit3s authored and Anthony Liguori committed Jan 26, 2010
1 parent 4c36a2f commit 392ecf5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion roms/seabios
15 changes: 13 additions & 2 deletions vl.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,9 @@ static struct {
{ .driver = "isa-parallel", .flag = &default_parallel },
{ .driver = "isa-fdc", .flag = &default_floppy },
{ .driver = "ide-drive", .flag = &default_cdrom },
{ .driver = "virtio-console-pci", .flag = &default_virtcon },
{ .driver = "virtio-console-s390", .flag = &default_virtcon },
{ .driver = "virtio-serial-pci", .flag = &default_virtcon },
{ .driver = "virtio-serial-s390", .flag = &default_virtcon },
{ .driver = "virtio-serial", .flag = &default_virtcon },
{ .driver = "VGA", .flag = &default_vga },
{ .driver = "cirrus-vga", .flag = &default_vga },
{ .driver = "vmware-svga", .flag = &default_vga },
Expand Down Expand Up @@ -4629,20 +4630,30 @@ static int virtcon_parse(const char *devname)
{
static int index = 0;
char label[32];
QemuOpts *bus_opts, *dev_opts;

if (strcmp(devname, "none") == 0)
return 0;
if (index == MAX_VIRTIO_CONSOLES) {
fprintf(stderr, "qemu: too many virtio consoles\n");
exit(1);
}

bus_opts = qemu_opts_create(&qemu_device_opts, NULL, 0);
qemu_opt_set(bus_opts, "driver", "virtio-serial");

dev_opts = qemu_opts_create(&qemu_device_opts, NULL, 0);
qemu_opt_set(dev_opts, "driver", "virtconsole");

snprintf(label, sizeof(label), "virtcon%d", index);
virtcon_hds[index] = qemu_chr_open(label, devname, NULL);
if (!virtcon_hds[index]) {
fprintf(stderr, "qemu: could not open virtio console '%s': %s\n",
devname, strerror(errno));
return -1;
}
qemu_opt_set(dev_opts, "chardev", label);

index++;
return 0;
}
Expand Down

0 comments on commit 392ecf5

Please sign in to comment.