From fc51703a5925fc25be101b1d245b7bd347664772 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Fri, 5 Oct 2012 11:15:17 +1000 Subject: [PATCH] kvm tools: Fix powerpc build errors caused by recent changes Several caused by commit 8074303 "remove global kvm object", ioport__setup_arch(), term_getc_iov() & term_getc() in the spapr_hvcons.c code, and kvm_cpu__reboot() in rtas_power_off(). Commit 221b584 "move active_console into struct kvm_config" added checks in h_put_term_char() & h_get_term_char() of kvm->cfg.active_console but needs to be vcpu->kvm->cfg.active_console. That commit also missed updates to term_putc() & term_getc() in spapr_rtas.c, and I'm guessing that we need similar checks of active_console in rtas_put_term_char() & rtas_get_term_char(). Signed-off-by: Michael Ellerman Signed-off-by: Pekka Enberg --- tools/kvm/powerpc/ioport.c | 2 +- tools/kvm/powerpc/spapr_hvcons.c | 6 +++--- tools/kvm/powerpc/spapr_rtas.c | 14 +++++++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/tools/kvm/powerpc/ioport.c b/tools/kvm/powerpc/ioport.c index a8e4dc319e8d..264fb7e2d57d 100644 --- a/tools/kvm/powerpc/ioport.c +++ b/tools/kvm/powerpc/ioport.c @@ -12,7 +12,7 @@ #include -void ioport__setup_arch(void) +void ioport__setup_arch(struct kvm *kvm) { /* PPC has no legacy ioports to set up */ } diff --git a/tools/kvm/powerpc/spapr_hvcons.c b/tools/kvm/powerpc/spapr_hvcons.c index 1fe4bdb13566..0bdf75ba3689 100644 --- a/tools/kvm/powerpc/spapr_hvcons.c +++ b/tools/kvm/powerpc/spapr_hvcons.c @@ -50,7 +50,7 @@ static unsigned long h_put_term_char(struct kvm_cpu *vcpu, unsigned long opcode, do { int ret; - if (kvm->cfg.active_console == CONSOLE_HV) + if (vcpu->kvm->cfg.active_console == CONSOLE_HV) ret = term_putc_iov(&iov, 1, 0); else ret = 0; @@ -74,14 +74,14 @@ static unsigned long h_get_term_char(struct kvm_cpu *vcpu, unsigned long opcode, union hv_chario data; struct iovec iov; - if (kvm->cfg.active_console != CONSOLE_HV) + if (vcpu->kvm->cfg.active_console != CONSOLE_HV) return H_SUCCESS; if (term_readable(0)) { iov.iov_base = data.buf; iov.iov_len = 16; - *len = term_getc_iov(&iov, 1, 0); + *len = term_getc_iov(vcpu->kvm, &iov, 1, 0); *char0_7 = be64_to_cpu(data.a.char0_7); *char8_15 = be64_to_cpu(data.a.char8_15); } else { diff --git a/tools/kvm/powerpc/spapr_rtas.c b/tools/kvm/powerpc/spapr_rtas.c index 14a3462c5e03..c81d82b3857c 100644 --- a/tools/kvm/powerpc/spapr_rtas.c +++ b/tools/kvm/powerpc/spapr_rtas.c @@ -41,7 +41,7 @@ static void rtas_display_character(struct kvm_cpu *vcpu, uint32_t nret, target_ulong rets) { char c = rtas_ld(vcpu->kvm, args, 0); - term_putc(CONSOLE_HV, &c, 1, 0); + term_putc(&c, 1, 0); rtas_st(vcpu->kvm, rets, 0, 0); } @@ -52,7 +52,10 @@ static void rtas_put_term_char(struct kvm_cpu *vcpu, uint32_t nret, target_ulong rets) { char c = rtas_ld(vcpu->kvm, args, 0); - term_putc(CONSOLE_HV, &c, 1, 0); + + if (vcpu->kvm->cfg.active_console == CONSOLE_HV) + term_putc(&c, 1, 0); + rtas_st(vcpu->kvm, rets, 0, 0); } @@ -62,8 +65,9 @@ static void rtas_get_term_char(struct kvm_cpu *vcpu, uint32_t nret, target_ulong rets) { int c; - if (term_readable(CONSOLE_HV, 0) && - (c = term_getc(CONSOLE_HV, 0)) >= 0) { + + if (vcpu->kvm->cfg.active_console == CONSOLE_HV && term_readable(0) && + (c = term_getc(vcpu->kvm, 0)) >= 0) { rtas_st(vcpu->kvm, rets, 0, 0); rtas_st(vcpu->kvm, rets, 1, c); } else { @@ -115,7 +119,7 @@ static void rtas_power_off(struct kvm_cpu *vcpu, rtas_st(vcpu->kvm, rets, 0, -3); return; } - kvm_cpu__reboot(); + kvm_cpu__reboot(vcpu->kvm); } static void rtas_query_cpu_stopped_state(struct kvm_cpu *vcpu, -- 2.39.5