From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Linux PPC devel <linuxppc-dev@ozlabs.org>
Cc: Virtualization Mailing List <virtualization@lists.osdl.org>,
Jeremy Fitzhardinge <jeremy@goop.org>,
Rusty Russell <rusty@rustcorp.com.au>,
LKML <linux-kernel@vger.kernel.org>
Subject: [RFC 2/3] virtio_console: use virtqueue notification for hvc_console
Date: Tue, 3 Jun 2008 14:46:15 +0200 [thread overview]
Message-ID: <200806031446.15330.borntraeger@de.ibm.com> (raw)
In-Reply-To: <200806031444.21945.borntraeger@de.ibm.com>
This patch exploits the new notifier callbacks of the hvc_console. We can
use the virtio callbacks instead of the polling code.
I also added a small Kconfig change that allows the user to specify the
virtio console in menuconfig.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
drivers/char/Kconfig | 6 +++++-
drivers/char/virtio_console.c | 27 +++++++++++++++++++++++++--
2 files changed, 30 insertions(+), 3 deletions(-)
Index: kvm/drivers/char/Kconfig
===================================================================
--- kvm.orig/drivers/char/Kconfig
+++ kvm/drivers/char/Kconfig
@@ -637,8 +637,12 @@ config HVC_XEN
Xen virtual console device driver
config VIRTIO_CONSOLE
- bool
+ bool "Virtio console"
+ depends on VIRTIO
select HVC_DRIVER
+ help
+ Virtio console for use with lguest and other hypervisors.
+
config HVCS
tristate "IBM Hypervisor Virtual Console Server support"
Index: kvm/drivers/char/virtio_console.c
===================================================================
--- kvm.orig/drivers/char/virtio_console.c
+++ kvm/drivers/char/virtio_console.c
@@ -46,6 +46,9 @@ static char *in, *inbuf;
/* The operations for our console. */
static struct hv_ops virtio_cons;
+/* The hvc device */
+struct hvc_struct *hvc;
+
/*D:310 The put_chars() callback is pretty straightforward.
*
* We turn the characters into a scatter-gather list, add it to the output
@@ -134,6 +137,25 @@ int __init virtio_cons_early_init(int (*
return hvc_instantiate(0, 0, &virtio_cons);
}
+/*
+ * we support only one console, the hvc struct is a global var
+ * There is no need to do anything
+ */
+static int notifier_add_vio(struct hvc_struct *hp, int data)
+{
+ return 0;
+}
+
+static void notifier_del_vio(struct hvc_struct *hp, int data)
+{
+}
+
+static void hvc_handle_input(struct virtqueue *vq)
+{
+ if (hvc_poll(hvc))
+ hvc_kick();
+}
+
/*D:370 Once we're further in boot, we get probed like any other virtio
device.
* At this stage we set up the output virtqueue.
*
@@ -144,7 +166,6 @@ int __init virtio_cons_early_init(int (*
static int __devinit virtcons_probe(struct virtio_device *dev)
{
int err;
- struct hvc_struct *hvc;
vdev = dev;
@@ -158,7 +179,7 @@ static int __devinit virtcons_probe(stru
/* Find the input queue. */
/* FIXME: This is why we want to wean off hvc: we do nothing
* when input comes in. */
- in_vq = vdev->config->find_vq(vdev, 0, NULL);
+ in_vq = vdev->config->find_vq(vdev, 0, hvc_handle_input);
if (IS_ERR(in_vq)) {
err = PTR_ERR(in_vq);
goto free;
@@ -173,6 +194,8 @@ static int __devinit virtcons_probe(stru
/* Start using the new console output. */
virtio_cons.get_chars = get_chars;
virtio_cons.put_chars = put_chars;
+ virtio_cons.notifier_add = notifier_add_vio;
+ virtio_cons.notifier_del = notifier_del_vio;
/* The first argument of hvc_alloc() is the virtual console number, so
* we use zero. The second argument is the interrupt number; we
next prev parent reply other threads:[~2008-06-03 12:47 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-03 12:44 [RFC 0/3]: hvc_console rework for platform without hard irqs Christian Borntraeger
2008-06-03 12:45 ` [RFC 1/3] hvc_console: rework setup to replace irq functions with callbacks Christian Borntraeger
2008-06-04 0:13 ` Rusty Russell
2008-06-04 11:15 ` Christian Borntraeger
2008-10-13 5:16 ` Benjamin Herrenschmidt
2008-10-13 7:51 ` Christian Borntraeger
2008-10-13 8:36 ` Benjamin Herrenschmidt
2008-10-13 8:47 ` Christian Borntraeger
2008-10-13 9:52 ` Benjamin Herrenschmidt
2008-10-14 0:38 ` Benjamin Herrenschmidt
2008-10-14 6:42 ` Christian Borntraeger
2008-10-14 8:18 ` Benjamin Herrenschmidt
2008-06-03 12:46 ` Christian Borntraeger [this message]
2008-06-03 17:24 ` [RFC 2/3] virtio_console: use virtqueue notification for hvc_console Arnd Bergmann
2008-06-03 12:46 ` [RFC 3/3] s390: use virtio_console for KVM on s390 Christian Borntraeger
2008-06-03 12:49 ` [RFC 1/3] hvc_console: rework setup to replace irq functions with callbacks (not word wrapped) Christian Borntraeger
2008-06-03 17:30 ` Arnd Bergmann
2008-06-04 8:00 ` Christian Borntraeger
2008-06-04 9:06 ` Benjamin Herrenschmidt
2008-06-20 13:24 ` [RFC 1/3 v2] hvc_console: rework setup to replace irq functions with callbacks Christian Borntraeger
2008-06-27 5:27 ` Rusty Russell
2008-06-20 13:24 ` [RFC 2/3 v2] virtio_console: use virtqueue notification for hvc_console Christian Borntraeger
2008-06-20 13:24 ` [RFC 3/3 v2] s390: use virtio_console for KVM on s390 Christian Borntraeger
2008-06-23 3:04 ` Rusty Russell
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=200806031446.15330.borntraeger@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.osdl.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).