From patchwork Fri Oct 5 01:15:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 1550761 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7936740D2D for ; Fri, 5 Oct 2012 01:15:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755107Ab2JEBPU (ORCPT ); Thu, 4 Oct 2012 21:15:20 -0400 Received: from ozlabs.org ([203.10.76.45]:33649 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753953Ab2JEBPS (ORCPT ); Thu, 4 Oct 2012 21:15:18 -0400 Received: by ozlabs.org (Postfix, from userid 1034) id A8D402C0329; Fri, 5 Oct 2012 11:15:17 +1000 (EST) From: Michael Ellerman To: Cc: , levinsasha928@gmail.com, , Subject: [PATCH 1/3] kvm tools: Fix powerpc build errors caused by recent changes Date: Fri, 5 Oct 2012 11:15:17 +1000 Message-Id: <1349399719-9317-1-git-send-email-michael@ellerman.id.au> X-Mailer: git-send-email 1.7.9.5 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- 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 a8e4dc3..264fb7e 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 1fe4bdb..0bdf75b 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 14a3462..c81d82b 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,