From patchwork Tue Jan 3 00:51:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 133933 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0F4E7B6FA4 for ; Tue, 3 Jan 2012 11:53:02 +1100 (EST) Received: from localhost ([::1]:51360 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhscX-0000w4-S9 for incoming@patchwork.ozlabs.org; Mon, 02 Jan 2012 19:52:53 -0500 Received: from eggs.gnu.org ([140.186.70.92]:51514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhscG-0000gs-Fw for qemu-devel@nongnu.org; Mon, 02 Jan 2012 19:52:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RhscC-0008GI-VT for qemu-devel@nongnu.org; Mon, 02 Jan 2012 19:52:36 -0500 Received: from e8.ny.us.ibm.com ([32.97.182.138]:45443) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhscC-0008GD-QY for qemu-devel@nongnu.org; Mon, 02 Jan 2012 19:52:32 -0500 Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 2 Jan 2012 19:52:32 -0500 Received: from d01relay07.pok.ibm.com (9.56.227.147) by e8.ny.us.ibm.com (192.168.1.108) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 2 Jan 2012 19:52:29 -0500 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q030qSji3506368 for ; Mon, 2 Jan 2012 19:52:28 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q030qS6r001273 for ; Mon, 2 Jan 2012 22:52:28 -0200 Received: from titi.austin.rr.com (sig-9-65-105-201.mts.ibm.com [9.65.105.201]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q030qLpT000958; Mon, 2 Jan 2012 22:52:27 -0200 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Mon, 2 Jan 2012 18:51:54 -0600 Message-Id: <1325551939-24749-6-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1325551939-24749-1-git-send-email-aliguori@us.ibm.com> References: <1325551939-24749-1-git-send-email-aliguori@us.ibm.com> x-cbid: 12010300-9360-0000-0000-00000209AF00 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.182.138 Cc: Paolo Bonzini , Anthony Liguori , David Gibson , Markus Armbruster , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH 05/30] pseries: Remove hcalls callback 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 From: David Gibson For forgotten historical reasons, PAPR hypercalls for specific virtual IO devices (oh which there are quite a number) are registered via a callback in the VIOsPAPRDeviceInfo structure. This is kind of ugly, so this patch instead registers hypercalls from device_init() functions for each device type. This works just as well, and is cleaner. Signed-off-by: David Gibson Signed-off-by: Anthony Liguori --- hw/spapr_llan.c | 17 ++++++----------- hw/spapr_vio.c | 13 ------------- hw/spapr_vio.h | 1 - hw/spapr_vty.c | 9 ++------- 4 files changed, 8 insertions(+), 32 deletions(-) diff --git a/hw/spapr_llan.c b/hw/spapr_llan.c index abe1297..45674c4 100644 --- a/hw/spapr_llan.c +++ b/hw/spapr_llan.c @@ -474,16 +474,6 @@ static target_ulong h_multicast_ctrl(CPUState *env, sPAPREnvironment *spapr, return H_SUCCESS; } -static void vlan_hcalls(VIOsPAPRBus *bus) -{ - spapr_register_hypercall(H_REGISTER_LOGICAL_LAN, h_register_logical_lan); - spapr_register_hypercall(H_FREE_LOGICAL_LAN, h_free_logical_lan); - spapr_register_hypercall(H_SEND_LOGICAL_LAN, h_send_logical_lan); - spapr_register_hypercall(H_ADD_LOGICAL_LAN_BUFFER, - h_add_logical_lan_buffer); - spapr_register_hypercall(H_MULTICAST_CTRL, h_multicast_ctrl); -} - static VIOsPAPRDeviceInfo spapr_vlan = { .init = spapr_vlan_init, .devnode = spapr_vlan_devnode, @@ -491,7 +481,6 @@ static VIOsPAPRDeviceInfo spapr_vlan = { .dt_type = "network", .dt_compatible = "IBM,l-lan", .signal_mask = 0x1, - .hcalls = vlan_hcalls, .qdev.name = "spapr-vlan", .qdev.size = sizeof(VIOsPAPRVLANDevice), .qdev.props = (Property[]) { @@ -504,5 +493,11 @@ static VIOsPAPRDeviceInfo spapr_vlan = { static void spapr_vlan_register(void) { spapr_vio_bus_register_withprop(&spapr_vlan); + spapr_register_hypercall(H_REGISTER_LOGICAL_LAN, h_register_logical_lan); + spapr_register_hypercall(H_FREE_LOGICAL_LAN, h_free_logical_lan); + spapr_register_hypercall(H_SEND_LOGICAL_LAN, h_send_logical_lan); + spapr_register_hypercall(H_ADD_LOGICAL_LAN_BUFFER, + h_add_logical_lan_buffer); + spapr_register_hypercall(H_MULTICAST_CTRL, h_multicast_ctrl); } device_init(spapr_vlan_register); diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c index 2dcc036..5a35541 100644 --- a/hw/spapr_vio.c +++ b/hw/spapr_vio.c @@ -684,7 +684,6 @@ VIOsPAPRBus *spapr_vio_bus_init(void) VIOsPAPRBus *bus; BusState *qbus; DeviceState *dev; - DeviceInfo *qinfo; /* Create bridge device */ dev = qdev_create(NULL, "spapr-vio-bridge"); @@ -711,18 +710,6 @@ VIOsPAPRBus *spapr_vio_bus_init(void) spapr_rtas_register("ibm,set-tce-bypass", rtas_set_tce_bypass); spapr_rtas_register("quiesce", rtas_quiesce); - for (qinfo = device_info_list; qinfo; qinfo = qinfo->next) { - VIOsPAPRDeviceInfo *info = (VIOsPAPRDeviceInfo *)qinfo; - - if (qinfo->bus_info != &spapr_vio_bus_info) { - continue; - } - - if (info->hcalls) { - info->hcalls(bus); - } - } - return bus; } diff --git a/hw/spapr_vio.h b/hw/spapr_vio.h index a325a5f..2430d45 100644 --- a/hw/spapr_vio.h +++ b/hw/spapr_vio.h @@ -75,7 +75,6 @@ typedef struct { const char *dt_name, *dt_type, *dt_compatible; target_ulong signal_mask; int (*init)(VIOsPAPRDevice *dev); - void (*hcalls)(VIOsPAPRBus *bus); int (*devnode)(VIOsPAPRDevice *dev, void *fdt, int node_off); } VIOsPAPRDeviceInfo; diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c index f23cc36..e217314 100644 --- a/hw/spapr_vty.c +++ b/hw/spapr_vty.c @@ -135,18 +135,11 @@ void spapr_vty_create(VIOsPAPRBus *bus, uint32_t reg, CharDriverState *chardev) qdev_init_nofail(dev); } -static void vty_hcalls(VIOsPAPRBus *bus) -{ - spapr_register_hypercall(H_PUT_TERM_CHAR, h_put_term_char); - spapr_register_hypercall(H_GET_TERM_CHAR, h_get_term_char); -} - static VIOsPAPRDeviceInfo spapr_vty = { .init = spapr_vty_init, .dt_name = "vty", .dt_type = "serial", .dt_compatible = "hvterm1", - .hcalls = vty_hcalls, .qdev.name = "spapr-vty", .qdev.size = sizeof(VIOsPAPRVTYDevice), .qdev.props = (Property[]) { @@ -182,5 +175,7 @@ static VIOsPAPRDevice *vty_lookup(sPAPREnvironment *spapr, target_ulong reg) static void spapr_vty_register(void) { spapr_vio_bus_register_withprop(&spapr_vty); + spapr_register_hypercall(H_PUT_TERM_CHAR, h_put_term_char); + spapr_register_hypercall(H_GET_TERM_CHAR, h_get_term_char); } device_init(spapr_vty_register);