public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de•ibm.com>
To: Rusty Russell <rusty@rustcorp•com.au>
Cc: Stephen Rothwell <sfr@canb•auug.org.au>,
	linux-next@vger•kernel.org, Mike Travis <travis@sgi•com>
Subject: Re: linux-next: rr tree build failure
Date: Tue, 25 Nov 2008 13:36:26 +0100	[thread overview]
Message-ID: <200811251336.26864.borntraeger@de.ibm.com> (raw)
In-Reply-To: <200811252217.37125.rusty@rustcorp.com.au>

Am Dienstag, 25. November 2008 schrieb Rusty Russell:
> > Also, the x86_64 allmodconfig build failed like this:
> >
> > ERROR: "hvc_resize" [drivers/char/virtio_console.ko] undefined!
> >
> > hvc_resize is currently not exported to modules.
> >
> > I have dropped the rr tree again.
> 
> OK, I've dropped Christian's patch for the moment until he fixes this.  I'm 
> travelling to Sydney for the day so I won't get a chance to fix this if it 
> breaks tomorrow :(

Ok. Sorry about that. allmodconfig on s390 and i386 select VIRTIO_CONSOLE as 
(y) and not as (m), therefore my tests did not trigger this problem. I will 
try to get an x86_64 box to test on in the future.

This version of the patch adds an EXPORT_SYMBOL_GPL. Feel free to add it 
whenever it fits your schedule. 

[PATCH 1/2]: virtio_console: support console resizing

From: Christian Borntraeger <borntraeger@de•ibm.com>

this patch uses the new hvc callback hvc_resize to set the window site 
which allows to change the tty size of hvc_console via a hvc_resize 
function.

I have added a new feature bit VIRTIO_CONSOLE_F_SIZE. The driver will 
change the window size on tty open and via the config_changed callback
of the transport. Currently lguest and kvm_s390 have not implemented this
callback, but the callback can be implemented at a later point in time.

Signed-off-by: Christian Borntraeger <borntraeger@de•ibm.com>
---
 drivers/char/hvc_console.c     |    1 +
 drivers/char/virtio_console.c  |   30 +++++++++++++++++++++++++++++-
 include/linux/virtio_console.h |   11 +++++++++++
 3 files changed, 41 insertions(+), 1 deletion(-)

Index: kvm/drivers/char/hvc_console.c
===================================================================
--- kvm.orig/drivers/char/hvc_console.c
+++ kvm/drivers/char/hvc_console.c
@@ -694,6 +694,7 @@ void hvc_resize(struct hvc_struct *hp, s
 		schedule_work(&hp->tty_resize);
 	}
 }
+EXPORT_SYMBOL_GPL(hvc_resize);
 
 /*
  * This kthread is either polling or interrupt driven.  This is determined by
Index: kvm/drivers/char/virtio_console.c
===================================================================
--- kvm.orig/drivers/char/virtio_console.c
+++ kvm/drivers/char/virtio_console.c
@@ -138,12 +138,33 @@ int __init virtio_cons_early_init(int (*
 }
 
 /*
+ * virtio console configuration. This supports:
+ * - console resize
+ */
+static void virtcons_apply_config(struct virtio_device *dev)
+{
+	struct winsize ws;
+
+	if (virtio_has_feature(dev, VIRTIO_CONSOLE_F_SIZE)) {
+		dev->config->get(dev,
+				 offsetof(struct virtio_console_config, cols),
+				 &ws.ws_col, sizeof(u16));
+		dev->config->get(dev,
+				 offsetof(struct virtio_console_config, rows),
+				 &ws.ws_row, sizeof(u16));
+		hvc_resize(hvc, ws);
+	}
+}
+
+/*
  * we support only one console, the hvc struct is a global var
- * There is no need to do anything
+ * We set the configuration at this point, since we now have a tty
  */
 static int notifier_add_vio(struct hvc_struct *hp, int data)
 {
 	hp->irq_requested = 1;
+	virtcons_apply_config(vdev);
+
 	return 0;
 }
 
@@ -234,11 +255,18 @@ static struct virtio_device_id id_table[
 	{ 0 },
 };
 
+static unsigned int features[] = {
+	VIRTIO_CONSOLE_F_SIZE,
+};
+
 static struct virtio_driver virtio_console = {
+	.feature_table = features,
+	.feature_table_size = ARRAY_SIZE(features),
 	.driver.name =	KBUILD_MODNAME,
 	.driver.owner =	THIS_MODULE,
 	.id_table =	id_table,
 	.probe =	virtcons_probe,
+	.config_changed = virtcons_apply_config,
 };
 
 static int __init init(void)
Index: kvm/include/linux/virtio_console.h
===================================================================
--- kvm.orig/include/linux/virtio_console.h
+++ kvm/include/linux/virtio_console.h
@@ -7,6 +7,17 @@
 /* The ID for virtio console */
 #define VIRTIO_ID_CONSOLE	3
 
+/* Feature bits */
+#define VIRTIO_CONSOLE_F_SIZE	0	/* Does host provide console size? */
+
+struct virtio_console_config {
+	/* colums of the screens */
+	__u16 cols;
+	/* rows of the screens */
+	__u16 rows;
+} __attribute__((packed));
+
+
 #ifdef __KERNEL__
 int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int));
 #endif /* __KERNEL__ */

  reply	other threads:[~2008-11-25 12:36 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-25  6:45 linux-next: rr tree build failure Stephen Rothwell
2008-11-25 11:47 ` Rusty Russell
2008-11-25 12:36   ` Christian Borntraeger [this message]
2008-11-27  8:11     ` Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2009-12-11  1:26 Stephen Rothwell
2009-12-14  4:35 ` Stephen Rothwell
2009-12-15  3:52   ` Rusty Russell
2009-12-15  4:36     ` Stephen Rothwell
2009-12-17 22:05     ` Stephen Rothwell
2009-11-12  8:03 Stephen Rothwell
2009-11-12  9:02 ` Benjamin Herrenschmidt
2009-11-12 10:50   ` Stephen Rothwell
2009-11-12  7:48 Stephen Rothwell
2009-11-11  3:01 Stephen Rothwell
2009-11-11  8:33 ` Rusty Russell
2009-09-09  3:47 Stephen Rothwell
2009-09-09 14:32 ` Siarhei Liakh
2009-09-11  3:00 ` Siarhei Liakh
2009-09-15  3:27 ` Stephen Rothwell
2009-09-22  5:15   ` Rusty Russell
2009-08-03  3:32 Stephen Rothwell
2009-08-03 17:55 ` Bjorn Helgaas
2009-08-03 20:22 ` Bjorn Helgaas
2009-08-03 23:18   ` Rusty Russell
2009-08-10  3:55     ` Stephen Rothwell
2009-08-10  3:56       ` Stephen Rothwell
2009-06-23  6:14 Stephen Rothwell
2009-06-24  3:24 ` Rusty Russell
2009-06-24  6:31   ` Stephen Rothwell
2009-06-15  6:40 Stephen Rothwell
2009-06-15  7:26 ` Stephen Rothwell
2009-06-15  8:52   ` David Miller
2009-06-15 10:39 ` Rusty Russell
2009-06-11  9:07 Stephen Rothwell
2009-06-11 13:08 ` Rusty Russell
2009-06-09 10:12 Stephen Rothwell
2009-06-10  7:26 ` Rusty Russell
2009-06-10  8:11   ` Stephen Rothwell
2009-03-17  2:45 Stephen Rothwell
2009-03-05  8:33 Stephen Rothwell
2009-03-06  5:23 ` Rusty Russell
2009-01-07  3:04 Stephen Rothwell
2009-01-06  3:41 Stephen Rothwell
2008-12-29  8:12 Stephen Rothwell
2008-12-29 15:23 ` Mike Travis
2008-12-29 21:01 ` Rusty Russell
2008-11-24  3:31 Stephen Rothwell
2008-11-24 17:07 ` Rusty Russell
2008-11-21  3:19 Stephen Rothwell
2008-11-21 10:58 ` Rusty Russell
2008-11-21 18:34   ` Greg KH
2008-11-20  3:50 Stephen Rothwell
2008-10-23  4:52 Stephen Rothwell
2008-10-23 13:31 ` Rusty Russell
2008-10-23  4:51 Stephen Rothwell
2008-10-23 13:02 ` Rusty Russell
2008-06-26  6:50 Stephen Rothwell
2008-06-26  7:49 ` Christian Borntraeger
2008-06-27  3:15   ` Rusty Russell
2008-06-25  6:58 Stephen Rothwell
2008-06-25  7:35 ` Christian Borntraeger
2008-06-25  8:30   ` Rusty Russell
2008-06-25  9:08     ` Christian Borntraeger
2008-06-25  6:44 Stephen Rothwell

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=200811251336.26864.borntraeger@de.ibm.com \
    --to=borntraeger@de$(echo .)ibm.com \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=rusty@rustcorp$(echo .)com.au \
    --cc=sfr@canb$(echo .)auug.org.au \
    --cc=travis@sgi$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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