From: Marc Zyngier <marc.zyng...@arm.com>

Kvmtool suppresses any output to a console that has not been elected
as *the* console.

While this makes sense on the input side (we want the input to be sent
to one console driver only), it seems to be the wrong thing to do on
the output side, as it effectively prevents the guest from switching
from one console to another (think earlyprintk using 8250 to virtio
console).

After all, the guest *does* poke this device and outputs something
there.

Just remove the kvm->cfg.active_console test from the output paths.

Signed-off-by: Marc Zyngier <marc.zyng...@arm.com>
Signed-off-by: Will Deacon <will.dea...@arm.com>
---
 tools/kvm/hw/serial.c            | 3 +--
 tools/kvm/powerpc/spapr_hvcons.c | 5 +----
 tools/kvm/powerpc/spapr_rtas.c   | 3 +--
 tools/kvm/virtio/console.c       | 5 +----
 4 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/tools/kvm/hw/serial.c b/tools/kvm/hw/serial.c
index 53b684a..18bf569 100644
--- a/tools/kvm/hw/serial.c
+++ b/tools/kvm/hw/serial.c
@@ -100,8 +100,7 @@ static void serial8250_flush_tx(struct kvm *kvm, struct 
serial8250_device *dev)
        dev->lsr |= UART_LSR_TEMT | UART_LSR_THRE;
 
        if (dev->txcnt) {
-               if (kvm->cfg.active_console == CONSOLE_8250)
-                       term_putc(dev->txbuf, dev->txcnt, dev->id);
+               term_putc(dev->txbuf, dev->txcnt, dev->id);
                dev->txcnt = 0;
        }
 }
diff --git a/tools/kvm/powerpc/spapr_hvcons.c b/tools/kvm/powerpc/spapr_hvcons.c
index 0bdf75b..605367b 100644
--- a/tools/kvm/powerpc/spapr_hvcons.c
+++ b/tools/kvm/powerpc/spapr_hvcons.c
@@ -50,10 +50,7 @@ static unsigned long h_put_term_char(struct kvm_cpu *vcpu, 
unsigned long opcode,
        do {
                int ret;
 
-               if (vcpu->kvm->cfg.active_console == CONSOLE_HV)
-                       ret = term_putc_iov(&iov, 1, 0);
-               else
-                       ret = 0;
+               ret = term_putc_iov(&iov, 1, 0);
                if (ret < 0) {
                        die("term_putc_iov error %d!\n", errno);
                }
diff --git a/tools/kvm/powerpc/spapr_rtas.c b/tools/kvm/powerpc/spapr_rtas.c
index c81d82b..f3c8fa3 100644
--- a/tools/kvm/powerpc/spapr_rtas.c
+++ b/tools/kvm/powerpc/spapr_rtas.c
@@ -53,8 +53,7 @@ static void rtas_put_term_char(struct kvm_cpu *vcpu,
 {
        char c = rtas_ld(vcpu->kvm, args, 0);
 
-       if (vcpu->kvm->cfg.active_console == CONSOLE_HV)
-               term_putc(&c, 1, 0);
+       term_putc(&c, 1, 0);
 
        rtas_st(vcpu->kvm, rets, 0, 0);
 }
diff --git a/tools/kvm/virtio/console.c b/tools/kvm/virtio/console.c
index b18d3a9..1f88a4b 100644
--- a/tools/kvm/virtio/console.c
+++ b/tools/kvm/virtio/console.c
@@ -102,10 +102,7 @@ static void virtio_console_handle_callback(struct kvm 
*kvm, void *param)
 
        while (virt_queue__available(vq)) {
                head = virt_queue__get_iov(vq, iov, &out, &in, kvm);
-               if (kvm->cfg.active_console == CONSOLE_VIRTIO)
-                       len = term_putc_iov(iov, out, 0);
-               else
-                       len = 0;
+               len = term_putc_iov(iov, out, 0);
                virt_queue__set_used_elem(vq, head, len);
        }
 
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to