From faeba830b086bc9e58748869054e994cb09693cd Mon Sep 17 00:00:00 2001 From: Christian Borntraeger Date: Fri, 20 Jun 2008 15:24:18 +0200 Subject: 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 Signed-off-by: Rusty Russell --- drivers/s390/kvm/kvm_virtio.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'drivers/s390/kvm/kvm_virtio.c') 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 @@ #include #include #include +#include #include #include #include @@ -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. */ -- cgit v1.2.3-59-g8ed1b