qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Amit Shah <amit.shah@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 2/5] virtio-console: Add support for multiple ports for generic guest-host communication
Date: Fri, 11 Sep 2009 11:17:23 -0500	[thread overview]
Message-ID: <4AAA7813.1030904@codemonkey.ws> (raw)
In-Reply-To: <1252684353-25067-3-git-send-email-amit.shah@redhat.com>

Amit Shah wrote:
> This interface extends the virtio-console device to handle
> multiple ports that present a char device from which bits can
> be sent and read.
>
> 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.
>
> Each port is to be assigned a unique function, for example, the
> first 4 ports may be reserved for libvirt usage, the next 4 for
> generic streaming data and so on. This port-function mapping
> isn't finalised yet.
>
>   

I thought the consensus was that we wanted strings to identify ports 
such that a scheme like reverse fqdn could be used?

> diff --git a/hw/pc.c b/hw/pc.c
> index d96d756..d5d2542 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -1422,11 +1422,17 @@ static void pc_init1(ram_addr_t ram_size,
>      }
>  
>      /* Add virtio console devices */
> -    if (pci_enabled) {
> -        for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
> -            if (virtcon_hds[i]) {
> -                pci_create_simple(pci_bus, -1, "virtio-console-pci");
> -            }
> +    if (pci_enabled && virtcon_nr_ports) {
> +        void *dev;
> +
> +        dev = pci_create_simple(pci_bus, -1, "virtio-console-pci");
> +        if (!dev) {
> +            fprintf(stderr, "qemu: could not create virtio console pci device\n");
> +            exit(1);
> +        }
> +
> +        for (i = 0; i < virtcon_nr_ports; i++) {
> +                virtio_console_new_port(dev, virtcon_idx[i]);
>          }
>      }
>  }
>   

If a user does:

qemu -M pc-0.11.0 -virtiocon vc -virtiocon vc

This patch will break that guest.  I think the best solution to this is 
to properly integrate with qdev and the new chardev infrastructure.  
virtio-console-pci-0.11 should have the old semantics, 
virtio-console-pci-0.12 should be a bus.

>  #include "hw.h"
> +#include "monitor.h"
> +#include "pci.h"
>   

We don't want to add PCI dependency to virtio console.  It isn't always 
used on platforms with PCI.

> +static VirtIOConsole *virtio_console;
> +static struct virtio_console_config virtcon_config;
> +static VirtIOConsolePort virtcon_ports[MAX_VIRTIO_CONSOLE_PORTS]
>   

Introducing statics like this indicates something isn't right.  Again, I 
think a proper qdev bus conversion would take care of that.

> +/* This function gets called from vl.c during initial options
> + * parsing as well as from the monitor to parse the options.
> + * So it's a good idea to not print out anything and just
> + * return values which can become meaningful.
> + */
> +int init_virtio_console_port(int port, const char *opts)
> +{
> +    char dev[256];
> +    const char *prot;
> +    const char *idx;
> +    uint32_t port_nr;
> +    int j, k;
> +
> +    memset(dev, 0, sizeof(dev));
> +    prot = strstr(opts, ",protocol=");
> +    idx  = strstr(opts, ",port=");
>   

Need to integrate with QemuOpts.

> +
> +    register_savevm("virtio-console", -1, 2, virtio_console_save, virtio_console_load, s);
>   

Should integrate with VMState.

Regards,

Anthony Liguori

  parent reply	other threads:[~2009-09-11 16:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-11 15:52 [Qemu-devel] Multiple ports for virtio-console Amit Shah
2009-09-11 15:52 ` [Qemu-devel] [PATCH 1/5] char: Emit 'OPENED' events on char device open Amit Shah
2009-09-11 15:52   ` [Qemu-devel] [PATCH 2/5] virtio-console: Add support for multiple ports for generic guest-host communication Amit Shah
2009-09-11 15:52     ` [Qemu-devel] [PATCH 3/5] virtio-console: Add a in-qemu api for open/read/write/close ports Amit Shah
2009-09-11 15:52       ` [Qemu-devel] [PATCH 4/5] vnc: add a is_vnc_active() helper Amit Shah
2009-09-11 15:52         ` [Qemu-devel] [PATCH 5/5] vnc: Send / receive guest clipboard if virtio-console connected to clipboard port Amit Shah
2009-09-11 16:17     ` Anthony Liguori [this message]
2009-09-11 16:34       ` [Qemu-devel] Re: [PATCH 2/5] virtio-console: Add support for multiple ports for generic guest-host communication Amit Shah
2009-09-11 16:38         ` Anthony Liguori
2009-09-11 17:30           ` Amit Shah
2009-09-11 17:34             ` Anthony Liguori
2009-09-14  7:48           ` Amit Shah
2009-09-14  7:55             ` Amit Shah
2009-09-14 12:55               ` Anthony Liguori
2009-09-14 12:58                 ` 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=4AAA7813.1030904@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=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).