diff options
author | David Daney <david.daney@cavium.com> | 2014-05-28 23:52:13 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-06-02 12:34:20 +0200 |
commit | 18280edafef1b8ffc920743eddaf6cf6612b1509 (patch) | |
tree | 42136302ac56fb113d16de3128becd1fc6aed7a6 /arch/mips/paravirt/serial.c | |
parent | 90dfdc7ceb577c0d7b7635def3c62039a091e50d (diff) | |
download | blackbird-obmc-linux-18280edafef1b8ffc920743eddaf6cf6612b1509.tar.gz blackbird-obmc-linux-18280edafef1b8ffc920743eddaf6cf6612b1509.zip |
MIPS: Add code for new system 'paravirt'
For para-virtualized guests running under KVM or other equivalent
hypervisor.
Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7004/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/paravirt/serial.c')
-rw-r--r-- | arch/mips/paravirt/serial.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/arch/mips/paravirt/serial.c b/arch/mips/paravirt/serial.c new file mode 100644 index 000000000000..02b665c02272 --- /dev/null +++ b/arch/mips/paravirt/serial.c @@ -0,0 +1,40 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2013 Cavium, Inc. + */ + +#include <linux/kernel.h> +#include <linux/virtio_console.h> +#include <linux/kvm_para.h> + +/* + * Emit one character to the boot console. + */ +int prom_putchar(char c) +{ + kvm_hypercall3(KVM_HC_MIPS_CONSOLE_OUTPUT, 0 /* port 0 */, + (unsigned long)&c, 1 /* len == 1 */); + + return 1; +} + +#ifdef CONFIG_VIRTIO_CONSOLE +static int paravirt_put_chars(u32 vtermno, const char *buf, int count) +{ + kvm_hypercall3(KVM_HC_MIPS_CONSOLE_OUTPUT, vtermno, + (unsigned long)buf, count); + + return count; +} + +static int __init paravirt_cons_init(void) +{ + virtio_cons_early_init(paravirt_put_chars); + return 0; +} +core_initcall(paravirt_cons_init); + +#endif |