From patchwork Wed Jun 19 20:40:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 252656 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6DE6F2C00A0 for ; Thu, 20 Jun 2013 06:43:04 +1000 (EST) Received: from localhost ([::1]:48111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpPDa-0002DP-Ht for incoming@patchwork.ozlabs.org; Wed, 19 Jun 2013 16:43:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpPC9-0000as-O7 for qemu-devel@nongnu.org; Wed, 19 Jun 2013 16:41:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UpPC8-0004qS-Fj for qemu-devel@nongnu.org; Wed, 19 Jun 2013 16:41:33 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:42793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpPC8-0004qK-2G for qemu-devel@nongnu.org; Wed, 19 Jun 2013 16:41:32 -0400 Received: from /spool/local by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 19 Jun 2013 14:41:31 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 19 Jun 2013 14:41:29 -0600 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id B21623E40042; Wed, 19 Jun 2013 14:41:09 -0600 (MDT) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5JKf8Ak162464; Wed, 19 Jun 2013 14:41:15 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5JKf5gr023701; Wed, 19 Jun 2013 14:41:05 -0600 Received: from titi.austin.rr.com ([9.49.221.0]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r5JKeaBg020317; Wed, 19 Jun 2013 14:41:01 -0600 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2013 15:40:31 -0500 Message-Id: <1371674435-14973-9-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1371674435-14973-1-git-send-email-aliguori@us.ibm.com> References: <1371674435-14973-1-git-send-email-aliguori@us.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13061920-7606-0000-0000-00000CA173D1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 32.97.110.154 Cc: Anthony Liguori , Alexey Kardashevskiy , Alex Graf , qemu-ppc@nongnu.org, Paul Mackerras , Andreas Faerber Subject: [Qemu-devel] [PATCH 08/12] spapr-rtas: use hypercall interface and remove special vty interfaces X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Anthony Liguori --- hw/char/spapr_vty.c | 36 ++++++++++++++++++------------------ hw/ppc/spapr_rtas.c | 18 ++++++++++-------- include/hw/ppc/spapr_vio.h | 2 -- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c index ecc2bb5..4bac79e 100644 --- a/hw/char/spapr_vty.c +++ b/hw/char/spapr_vty.c @@ -63,7 +63,7 @@ static int vty_getchars(VIOsPAPRDevice *sdev, uint8_t *buf, int max) return n; } -void vty_putchars(VIOsPAPRDevice *sdev, uint8_t *buf, int len) +static void vty_putchars(VIOsPAPRDevice *sdev, uint8_t *buf, int len) { VIOsPAPRVTYDevice *dev = VIO_SPAPR_VTY_DEVICE(sdev); @@ -86,6 +86,23 @@ static int spapr_vty_init(VIOsPAPRDevice *sdev) return 0; } +static VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg) +{ + VIOsPAPRDevice *sdev; + + sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); + if (!sdev && reg == 0) { + /* Hack for kernel early debug, which always specifies reg==0. + * We search all VIO devices, and grab the vty with the lowest + * reg. This attempts to mimic existing PowerVM behaviour + * (early debug does work there, despite having no vty with + * reg==0. */ + return spapr_vty_get_default(spapr->vio_bus); + } + + return sdev; +} + /* Forward declaration */ static target_ulong h_put_term_char(PowerPCCPU *cpu, sPAPREnvironment *spapr, target_ulong opcode, target_ulong *args) @@ -211,23 +228,6 @@ VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus) return selected; } -VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg) -{ - VIOsPAPRDevice *sdev; - - sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); - if (!sdev && reg == 0) { - /* Hack for kernel early debug, which always specifies reg==0. - * We search all VIO devices, and grab the vty with the lowest - * reg. This attempts to mimic existing PowerVM behaviour - * (early debug does work there, despite having no vty with - * reg==0. */ - return spapr_vty_get_default(spapr->vio_bus); - } - - return sdev; -} - static void spapr_vty_register_types(void) { spapr_register_hypercall(H_PUT_TERM_CHAR, h_put_term_char); diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index 5887e04..019aed5 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -44,14 +44,16 @@ static void rtas_display_character(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t nret, target_ulong rets) { uint8_t c = rtas_ld(args, 0); - VIOsPAPRDevice *sdev = vty_lookup(spapr, 0); - - if (!sdev) { - rtas_st(rets, 0, -1); - } else { - vty_putchars(sdev, &c, sizeof(c)); - rtas_st(rets, 0, 0); - } + target_ulong hargs[4] = { + 0, /* reg=0 */ + 1, /* len=1 */ + (uint64_t)c << 56, /* data */ + 0 /* data */ + }; + target_ulong ret; + + ret = spapr_hypercall(cpu, H_PUT_TERM_CHAR, hargs); + rtas_st(rets, 0, ret); } static void rtas_get_time_of_day(PowerPCCPU *cpu, sPAPREnvironment *spapr, diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h index f98ec0a..817f5ff 100644 --- a/include/hw/ppc/spapr_vio.h +++ b/include/hw/ppc/spapr_vio.h @@ -123,8 +123,6 @@ static inline int spapr_vio_dma_set(VIOsPAPRDevice *dev, uint64_t taddr, int spapr_vio_send_crq(VIOsPAPRDevice *dev, uint8_t *crq); -VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg); -void vty_putchars(VIOsPAPRDevice *sdev, uint8_t *buf, int len); void spapr_vty_create(VIOsPAPRBus *bus, CharDriverState *chardev); void spapr_vlan_create(VIOsPAPRBus *bus, NICInfo *nd); void spapr_vscsi_create(VIOsPAPRBus *bus);