From: Alexander Graf <agraf@suse.de>
To: "qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>
Cc: Blue Swirl <blauwirbel@gmail.com>,
Aurelien Jarno <aurelien@aurel32.net>,
David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH 04/10] pseries: Remove hcalls callback
Date: Tue, 3 Jan 2012 16:08:16 +0100 [thread overview]
Message-ID: <1325603302-12412-5-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1325603302-12412-1-git-send-email-agraf@suse.de>
From: David Gibson <david@gibson.dropbear.id.au>
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 <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
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);
--
1.6.0.2
next prev parent reply other threads:[~2012-01-03 14:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-03 15:08 [Qemu-devel] [PULL 00/10] ppc patch queue 2012-01-03 Alexander Graf
2012-01-03 15:08 ` [Qemu-devel] [PATCH 01/10] PPC: monitor: add ability to dump SLB entries Alexander Graf
2012-01-03 15:08 ` [Qemu-devel] [PATCH 02/10] console: Fix segfault on screendump without VGA adapter Alexander Graf
2012-01-03 15:08 ` [Qemu-devel] [PATCH 03/10] kvm-ppc: halt secondary cpus when guest reset Alexander Graf
2012-01-03 15:08 ` Alexander Graf [this message]
2012-01-03 15:08 ` [Qemu-devel] [PATCH 05/10] pseries: FDT NUMA extensions to support multi-node guests Alexander Graf
2012-01-03 15:08 ` [Qemu-devel] [PATCH 06/10] pseries: Emit device tree nodes in reg order Alexander Graf
2012-01-03 15:08 ` [Qemu-devel] [PATCH 07/10] pseries: Add a routine to find a stable "default" vty and use it Alexander Graf
2012-01-03 15:08 ` [Qemu-devel] [PATCH 08/10] pseries: Populate "/chosen/linux, stdout-path" in the FDT Alexander Graf
2012-01-03 15:08 ` [Qemu-devel] [PATCH 09/10] pseries: Check for duplicate addresses on the spapr-vio bus Alexander Graf
2012-01-03 15:08 ` [Qemu-devel] [PATCH 10/10] PPC: Add description for the Freescale e500mc core Alexander Graf
2012-01-07 21:04 ` [Qemu-devel] [PULL 00/10] ppc patch queue 2012-01-03 Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1325603302-12412-5-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=aurelien@aurel32.net \
--cc=blauwirbel@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).