aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2008-06-20 09:24:18 -0400
committerRusty Russell <rusty@rustcorp.com.au>2008-07-24 22:06:07 -0400
commitfaeba830b086bc9e58748869054e994cb09693cd (patch)
tree5d2f2beb6b3ae012c7eedaa48bc1845cb156945f
parent7721c494a28e06543a3d6aa412957aa783a4a531 (diff)
s390: use virtio_console for KVM on s390
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> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/kernel/setup.c4
-rw-r--r--drivers/s390/kvm/kvm_virtio.c20
-rw-r--r--include/asm-s390/kvm_virtio.h10
4 files changed, 34 insertions, 1 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index eb530b4128ba..2ed88122be93 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -565,6 +565,7 @@ bool "s390 guest support (EXPERIMENTAL)"
565 depends on 64BIT && EXPERIMENTAL 565 depends on 64BIT && EXPERIMENTAL
566 select VIRTIO 566 select VIRTIO
567 select VIRTIO_RING 567 select VIRTIO_RING
568 select VIRTIO_CONSOLE
568 help 569 help
569 Select this option if you want to run the kernel under s390 linux 570 Select this option if you want to run the kernel under s390 linux
570endmenu 571endmenu
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index b358e18273b0..62122bad1e33 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -54,6 +54,7 @@
54#include <asm/sections.h> 54#include <asm/sections.h>
55#include <asm/ebcdic.h> 55#include <asm/ebcdic.h>
56#include <asm/compat.h> 56#include <asm/compat.h>
57#include <asm/kvm_virtio.h>
57 58
58long psw_kernel_bits = (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY | 59long psw_kernel_bits = (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY |
59 PSW_MASK_MCHECK | PSW_DEFAULT_KEY); 60 PSW_MASK_MCHECK | PSW_DEFAULT_KEY);
@@ -766,7 +767,8 @@ setup_arch(char **cmdline_p)
766 printk("We are running under VM (64 bit mode)\n"); 767 printk("We are running under VM (64 bit mode)\n");
767 else if (MACHINE_IS_KVM) { 768 else if (MACHINE_IS_KVM) {
768 printk("We are running under KVM (64 bit mode)\n"); 769 printk("We are running under KVM (64 bit mode)\n");
769 add_preferred_console("ttyS", 1, NULL); 770 add_preferred_console("hvc", 0, NULL);
771 s390_virtio_console_init();
770 } else 772 } else
771 printk("We are running native (64 bit mode)\n"); 773 printk("We are running native (64 bit mode)\n");
772#endif /* CONFIG_64BIT */ 774#endif /* CONFIG_64BIT */
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 5ab34340919b..d41f234bb2c2 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -15,6 +15,7 @@
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/virtio.h> 16#include <linux/virtio.h>
17#include <linux/virtio_config.h> 17#include <linux/virtio_config.h>
18#include <linux/virtio_console.h>
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19#include <linux/virtio_ring.h> 20#include <linux/virtio_ring.h>
20#include <linux/pfn.h> 21#include <linux/pfn.h>
@@ -333,6 +334,25 @@ static int __init kvm_devices_init(void)
333 return 0; 334 return 0;
334} 335}
335 336
337/* code for early console output with virtio_console */
338static __init int early_put_chars(u32 vtermno, const char *buf, int count)
339{
340 char scratch[17];
341 unsigned int len = count;
342
343 if (len > sizeof(scratch) - 1)
344 len = sizeof(scratch) - 1;
345 scratch[len] = '\0';
346 memcpy(scratch, buf, len);
347 kvm_hypercall1(KVM_S390_VIRTIO_NOTIFY, __pa(scratch));
348 return len;
349}
350
351void s390_virtio_console_init(void)
352{
353 virtio_cons_early_init(early_put_chars);
354}
355
336/* 356/*
337 * We do this after core stuff, but before the drivers. 357 * We do this after core stuff, but before the drivers.
338 */ 358 */
diff --git a/include/asm-s390/kvm_virtio.h b/include/asm-s390/kvm_virtio.h
index 5c871a990c29..146100224def 100644
--- a/include/asm-s390/kvm_virtio.h
+++ b/include/asm-s390/kvm_virtio.h
@@ -50,4 +50,14 @@ struct kvm_vqconfig {
50#define KVM_S390_VIRTIO_RESET 1 50#define KVM_S390_VIRTIO_RESET 1
51#define KVM_S390_VIRTIO_SET_STATUS 2 51#define KVM_S390_VIRTIO_SET_STATUS 2
52 52
53#ifdef __KERNEL__
54/* early virtio console setup */
55#ifdef CONFIG_VIRTIO_CONSOLE
56extern void s390_virtio_console_init(void);
57#else
58static inline void s390_virtio_console_init(void)
59{
60}
61#endif /* CONFIG_VIRTIO_CONSOLE */
62#endif /* __KERNEL__ */
53#endif 63#endif