]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
s390: use virtio_console for KVM on s390
authorChristian Borntraeger <borntraeger@de.ibm.com>
Fri, 20 Jun 2008 13:24:18 +0000 (15:24 +0200)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 25 Jul 2008 02:06:07 +0000 (12:06 +1000)
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>
arch/s390/Kconfig
arch/s390/kernel/setup.c
drivers/s390/kvm/kvm_virtio.c
include/asm-s390/kvm_virtio.h

index eb530b4128ba9353a9fa6d397102b0e52de77cd7..2ed88122be9319ea735da3b7b7a6cfd8e6700f67 100644 (file)
@@ -565,6 +565,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 b358e18273b07f2e1e31315e77835fd84f880bfc..62122bad1e3316f2112ae66c22e51859c7214b52 100644 (file)
@@ -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);
@@ -766,7 +767,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 5ab34340919be3a417caf1ad5bfd50ff91f1054d..d41f234bb2c28445361f3027cd39bb2542c93b81 100644 (file)
@@ -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>
@@ -333,6 +334,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 5c871a990c2933f03029934440195b939d0e3dce..146100224defc9ffbf30280b724f67a2d7cdbc54 100644 (file)
@@ -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