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 3/3] s390: use virtio_console for KVM on s390
Date: Tue, 3 Jun 2008 14:46:45 +0200 [thread overview]
Message-ID: <200806031446.45759.borntraeger@de.ibm.com> (raw)
In-Reply-To: <200806031444.21945.borntraeger@de.ibm.com>
This patch enables virtio_console as the default console on kvm for
s390. We currently use the same notify hack as lguest for early
console output. I will try to address this for lguest and s390 later.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
arch/s390/Kconfig | 1 +
arch/s390/kernel/setup.c | 4 +++-
drivers/s390/kvm/kvm_virtio.c | 20 ++++++++++++++++++++
include/asm-s390/kvm_virtio.h | 10 ++++++++++
4 files changed, 34 insertions(+), 1 deletion(-)
Index: kvm/arch/s390/Kconfig
===================================================================
--- kvm.orig/arch/s390/Kconfig
+++ kvm/arch/s390/Kconfig
@@ -540,6 +540,7 @@ bool "s390 guest support (EXPERIMENTAL)"
depends on 64BIT && EXPERIMENTAL
select VIRTIO
select VIRTIO_RING
+ select VIRTIO_CONSOLE
help
Select this option if you want to run the kernel under s390 linux
endmenu
Index: kvm/arch/s390/kernel/setup.c
===================================================================
--- kvm.orig/arch/s390/kernel/setup.c
+++ kvm/arch/s390/kernel/setup.c
@@ -54,6 +54,7 @@
#include <asm/sections.h>
#include <asm/ebcdic.h>
#include <asm/compat.h>
+#include <asm/kvm_virtio.h>
long psw_kernel_bits = (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY |
PSW_MASK_MCHECK | PSW_DEFAULT_KEY);
@@ -799,7 +800,8 @@ setup_arch(char **cmdline_p)
printk("We are running under VM (64 bit mode)\n");
else if (MACHINE_IS_KVM) {
printk("We are running under KVM (64 bit mode)\n");
- add_preferred_console("ttyS", 1, NULL);
+ add_preferred_console("hvc", 0, NULL);
+ s390_virtio_console_init();
} else
printk("We are running native (64 bit mode)\n");
#endif /* CONFIG_64BIT */
Index: kvm/drivers/s390/kvm/kvm_virtio.c
===================================================================
--- kvm.orig/drivers/s390/kvm/kvm_virtio.c
+++ kvm/drivers/s390/kvm/kvm_virtio.c
@@ -15,6 +15,7 @@
#include <linux/err.h>
#include <linux/virtio.h>
#include <linux/virtio_config.h>
+#include <linux/virtio_console.h>
#include <linux/interrupt.h>
#include <linux/virtio_ring.h>
#include <linux/pfn.h>
@@ -338,6 +339,25 @@ static int __init kvm_devices_init(void)
return 0;
}
+/* code for early console output with virtio_console */
+static __init int early_put_chars(u32 vtermno, const char *buf, int count)
+{
+ char scratch[17];
+ unsigned int len = count;
+
+ if (len > sizeof(scratch) - 1)
+ len = sizeof(scratch) - 1;
+ scratch[len] = '\0';
+ memcpy(scratch, buf, len);
+ kvm_hypercall1(KVM_S390_VIRTIO_NOTIFY, __pa(scratch));
+ return len;
+}
+
+void s390_virtio_console_init(void)
+{
+ virtio_cons_early_init(early_put_chars);
+}
+
/*
* We do this after core stuff, but before the drivers.
*/
Index: kvm/include/asm-s390/kvm_virtio.h
===================================================================
--- kvm.orig/include/asm-s390/kvm_virtio.h
+++ kvm/include/asm-s390/kvm_virtio.h
@@ -50,4 +50,14 @@ struct kvm_vqconfig {
#define KVM_S390_VIRTIO_RESET 1
#define KVM_S390_VIRTIO_SET_STATUS 2
+#ifdef __KERNEL__
+/* early virtio console setup */
+#ifdef CONFIG_VIRTIO_CONSOLE
+extern void s390_virtio_console_init(void);
+#else
+static inline void s390_virtio_console_init(void)
+{
+}
+#endif /* CONFIG_VIRTIO_CONSOLE */
+#endif /* __KERNEL__ */
#endif
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 ` [RFC 2/3] virtio_console: use virtqueue notification for hvc_console Christian Borntraeger
2008-06-03 17:24 ` Arnd Bergmann
2008-06-03 12:46 ` Christian Borntraeger [this message]
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.45759.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).