From: Amit Shah <amit.shah@redhat.com>
To: Jamie Lokier <jamie@shareable.org>
Cc: "Richard W.M. Jones" <rjones@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio-serial: PCI device for simple host <-> guest communication
Date: Thu, 11 Jun 2009 10:01:30 +0530 [thread overview]
Message-ID: <20090611043130.GB22914@amit-x200.pnq.redhat.com> (raw)
In-Reply-To: <20090610180027.GF7416@shareable.org>
On (Wed) Jun 10 2009 [19:00:27], Jamie Lokier wrote:
> Amit Shah wrote:
> > > Plus, having a virtio serial device and a virtio console seems
> > > unfortunate to me. Anyway we can unify the two? Maybe make virtio
> > > serial support hvc with a feature flag or something instead of ttyS?
> >
> > Yes, it's possible. I'll look into that once I reach a point where
> > virtio-serial is ready to be merged. I'll also have to look at making
> > sure existing guest kernels work with the new, unified device.
>
> One of the most useful things about a serial port is that it's so easy
> for basic OS components like debuggers and bootloaders and BIOSes to
> use it, with very little code, and without having to do very complex
> things like initialise and enumerate PCI buses etc., and without
> interference by an OS so they are useful for things like kernel
> debugging and reliable debugging output.
>
> For this reason, virtually every real machine has a simple serial
> port, even if it isn't exposed on an external connector.
>
> Are virtio-serial/virtio-console very simple to drive from guest code,
> without PCI enumeration, or do they require complex initialisation and
> OS cooperation?
OK, great question. I'll post my Linux driver that'll answer your
question precisely, but this is what a guest userspace app will have to
do to use it:
fd = open("/dev/vmser0", O_RDWR);
if (fd == -1) {
perror("open");
return -errno;
}
ret = read(fd, buf, 100);
if (ret < 0) {
perror("read");
}
ret = ioctl(fd, VIRTIO_SERIAL_IOCTL_GET_PORT_NAME, &port_name);
if (ret) perror("ioctl");
printf("string is %s\n", port_name.name);
So the guest driver exposes a simple char device to userspace.
The driver itself hooks up with the virtio code which abstracts away all
the pci stuff. It just has to manage the rings and the queues.
Amit
next prev parent reply other threads:[~2009-06-11 4:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-09 16:42 [Qemu-devel] [RFC] virtio-serial device Amit Shah
2009-06-09 16:42 ` [Qemu-devel] [PATCH] pci: add define for communication class devices Amit Shah
2009-06-09 16:42 ` [Qemu-devel] [PATCH] qdev: add virtserial char drv init hacks Amit Shah
2009-06-09 16:42 ` [Qemu-devel] [PATCH] virtio-serial: PCI device for simple host <-> guest communication Amit Shah
2009-06-09 17:15 ` [Qemu-devel] " Jan Kiszka
2009-06-09 18:15 ` Richard W.M. Jones
2009-06-09 19:19 ` Jan Kiszka
2009-06-09 18:17 ` [Qemu-devel] " Richard W.M. Jones
2009-06-09 18:47 ` Stuart Brady
2009-06-09 18:56 ` Anthony Liguori
2009-06-09 23:40 ` Paul Brook
2009-06-10 10:31 ` Amit Shah
2009-06-10 18:00 ` Jamie Lokier
2009-06-11 4:31 ` Amit Shah [this message]
2009-06-12 1:56 ` Jamie Lokier
2009-06-11 13:51 ` Amit Shah
2009-06-11 16:07 ` Blue Swirl
2009-06-11 16:21 ` Amit Shah
2009-06-10 10:28 ` 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=20090611043130.GB22914@amit-x200.pnq.redhat.com \
--to=amit.shah@redhat.com \
--cc=jamie@shareable.org \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
/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).