* [Qemu-devel] [PATCH 0/2] convert device initialization functions
@ 2016-05-17 10:18 Wei Jiangang
2016-05-17 10:18 ` [Qemu-devel] [PATCH 1/2] hw/pci-bridge: Convert pxb initialization functions to Error Wei Jiangang
` (5 more replies)
0 siblings, 6 replies; 11+ messages in thread
From: Wei Jiangang @ 2016-05-17 10:18 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, armbru, marcel, Wei Jiangang
The first had been reviewed.
The second had been posted last month, but no feedback.
They're similar, so resend them together.
Wei Jiangang (2):
hw/pci-bridge: Convert pxb initialization functions to Error
apb: convert init to realize
hw/pci-bridge/pci_expander_bridge.c | 52 ++++++++++++++++++-------------------
hw/pci-host/apb.c | 5 ++--
2 files changed, 27 insertions(+), 30 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 1/2] hw/pci-bridge: Convert pxb initialization functions to Error
2016-05-17 10:18 [Qemu-devel] [PATCH 0/2] convert device initialization functions Wei Jiangang
@ 2016-05-17 10:18 ` Wei Jiangang
2016-05-17 10:18 ` [Qemu-devel] [PATCH 2/2] apb: convert init to realize Wei Jiangang
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Wei Jiangang @ 2016-05-17 10:18 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, armbru, marcel, Wei Jiangang, Cao jin
Firstly, convert pxb_dev_init_common() to Error and rename
it to pxb_dev_realize_common().
Actually, pxb_register_bus() is converted as well.
And then,
convert pxb_dev_initfn() and pxb_pcie_dev_initfn() to Error,
rename them to pxb_dev_realize() and pxb_pcie_dev_realize()
respectively.
Signed-off-by: Wei Jiangang <weijg.fnst@cn.fujitsu.com>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/pci-bridge/pci_expander_bridge.c | 52 ++++++++++++++++++-------------------
1 file changed, 25 insertions(+), 27 deletions(-)
diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
index ba320bd..cbea9c1 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
+#include "qapi/error.h"
#include "hw/pci/pci.h"
#include "hw/pci/pci_bus.h"
#include "hw/pci/pci_host.h"
@@ -160,30 +161,25 @@ static const TypeInfo pxb_host_info = {
};
/*
- * Registers the PXB bus as a child of the i440fx root bus.
- *
- * Returns 0 on successs, -1 if i440fx host was not
- * found or the bus number is already in use.
+ * Registers the PXB bus as a child of pci host root bus.
*/
-static int pxb_register_bus(PCIDevice *dev, PCIBus *pxb_bus)
+static void pxb_register_bus(PCIDevice *dev, PCIBus *pxb_bus, Error **errp)
{
PCIBus *bus = dev->bus;
int pxb_bus_num = pci_bus_num(pxb_bus);
if (bus->parent_dev) {
- error_report("PXB devices can be attached only to root bus.");
- return -1;
+ error_setg(errp, "PXB devices can be attached only to root bus");
+ return;
}
QLIST_FOREACH(bus, &bus->child, sibling) {
if (pci_bus_num(bus) == pxb_bus_num) {
- error_report("Bus %d is already in use.", pxb_bus_num);
- return -1;
+ error_setg(errp, "Bus %d is already in use", pxb_bus_num);
+ return;
}
}
QLIST_INSERT_HEAD(&dev->bus->child, pxb_bus, sibling);
-
- return 0;
}
static int pxb_map_irq_fn(PCIDevice *pci_dev, int pin)
@@ -213,17 +209,18 @@ static gint pxb_compare(gconstpointer a, gconstpointer b)
0;
}
-static int pxb_dev_init_common(PCIDevice *dev, bool pcie)
+static void pxb_dev_realize_common(PCIDevice *dev, bool pcie, Error **errp)
{
PXBDev *pxb = convert_to_pxb(dev);
DeviceState *ds, *bds = NULL;
PCIBus *bus;
const char *dev_name = NULL;
+ Error *local_err = NULL;
if (pxb->numa_node != NUMA_NODE_UNASSIGNED &&
pxb->numa_node >= nb_numa_nodes) {
- error_report("Illegal numa node %d.", pxb->numa_node);
- return -EINVAL;
+ error_setg(errp, "Illegal numa node %d", pxb->numa_node);
+ return;
}
if (dev->qdev.id && *dev->qdev.id) {
@@ -248,7 +245,9 @@ static int pxb_dev_init_common(PCIDevice *dev, bool pcie)
PCI_HOST_BRIDGE(ds)->bus = bus;
- if (pxb_register_bus(dev, bus)) {
+ pxb_register_bus(dev, bus, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
goto err_register_bus;
}
@@ -262,23 +261,22 @@ static int pxb_dev_init_common(PCIDevice *dev, bool pcie)
pci_config_set_class(dev->config, PCI_CLASS_BRIDGE_HOST);
pxb_dev_list = g_list_insert_sorted(pxb_dev_list, pxb, pxb_compare);
- return 0;
+ return;
err_register_bus:
object_unref(OBJECT(bds));
object_unparent(OBJECT(bus));
object_unref(OBJECT(ds));
- return -EINVAL;
}
-static int pxb_dev_initfn(PCIDevice *dev)
+static void pxb_dev_realize(PCIDevice *dev, Error **errp)
{
if (pci_bus_is_express(dev->bus)) {
- error_report("pxb devices cannot reside on a PCIe bus!");
- return -EINVAL;
+ error_setg(errp, "pxb devices cannot reside on a PCIe bus");
+ return;
}
- return pxb_dev_init_common(dev, false);
+ pxb_dev_realize_common(dev, false, errp);
}
static void pxb_dev_exitfn(PCIDevice *pci_dev)
@@ -300,7 +298,7 @@ static void pxb_dev_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
- k->init = pxb_dev_initfn;
+ k->realize = pxb_dev_realize;
k->exit = pxb_dev_exitfn;
k->vendor_id = PCI_VENDOR_ID_REDHAT;
k->device_id = PCI_DEVICE_ID_REDHAT_PXB;
@@ -318,14 +316,14 @@ static const TypeInfo pxb_dev_info = {
.class_init = pxb_dev_class_init,
};
-static int pxb_pcie_dev_initfn(PCIDevice *dev)
+static void pxb_pcie_dev_realize(PCIDevice *dev, Error **errp)
{
if (!pci_bus_is_express(dev->bus)) {
- error_report("pxb-pcie devices cannot reside on a PCI bus!");
- return -EINVAL;
+ error_setg(errp, "pxb-pcie devices cannot reside on a PCI bus");
+ return;
}
- return pxb_dev_init_common(dev, true);
+ pxb_dev_realize_common(dev, true, errp);
}
static void pxb_pcie_dev_class_init(ObjectClass *klass, void *data)
@@ -333,7 +331,7 @@ static void pxb_pcie_dev_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
- k->init = pxb_pcie_dev_initfn;
+ k->realize = pxb_pcie_dev_realize;
k->exit = pxb_dev_exitfn;
k->vendor_id = PCI_VENDOR_ID_REDHAT;
k->device_id = PCI_DEVICE_ID_REDHAT_PXB_PCIE;
--
1.9.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 2/2] apb: convert init to realize
2016-05-17 10:18 [Qemu-devel] [PATCH 0/2] convert device initialization functions Wei Jiangang
2016-05-17 10:18 ` [Qemu-devel] [PATCH 1/2] hw/pci-bridge: Convert pxb initialization functions to Error Wei Jiangang
@ 2016-05-17 10:18 ` Wei Jiangang
2016-05-31 13:18 ` Markus Armbruster
2016-05-18 1:55 ` [Qemu-devel] [PATCH 0/2] convert device initialization functions Wei, Jiangang
` (3 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Wei Jiangang @ 2016-05-17 10:18 UTC (permalink / raw)
To: qemu-devel; +Cc: mst, armbru, marcel, Wei Jiangang
Convert a device model where initialization obviously can't fail,
make it implement realize() rather than init().
Signed-off-by: Wei Jiangang <weijg.fnst@cn.fujitsu.com>
---
hw/pci-host/apb.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
index aaef7bb..b29789c 100644
--- a/hw/pci-host/apb.c
+++ b/hw/pci-host/apb.c
@@ -633,7 +633,7 @@ static void pci_apb_set_irq(void *opaque, int irq_num, int level)
}
}
-static int apb_pci_bridge_initfn(PCIDevice *dev)
+static void apb_pci_bridge_realize(PCIDevice *dev, Error **errp)
{
pci_bridge_initfn(dev, TYPE_PCI_BUS);
@@ -651,7 +651,6 @@ static int apb_pci_bridge_initfn(PCIDevice *dev)
pci_set_word(dev->config + PCI_STATUS,
PCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ |
PCI_STATUS_DEVSEL_MEDIUM);
- return 0;
}
PCIBus *pci_apb_init(hwaddr special_base,
@@ -843,7 +842,7 @@ static void pbm_pci_bridge_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
- k->init = apb_pci_bridge_initfn;
+ k->realize = apb_pci_bridge_realize;
k->exit = pci_bridge_exitfn;
k->vendor_id = PCI_VENDOR_ID_SUN;
k->device_id = PCI_DEVICE_ID_SUN_SIMBA;
--
1.9.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] convert device initialization functions
2016-05-17 10:18 [Qemu-devel] [PATCH 0/2] convert device initialization functions Wei Jiangang
2016-05-17 10:18 ` [Qemu-devel] [PATCH 1/2] hw/pci-bridge: Convert pxb initialization functions to Error Wei Jiangang
2016-05-17 10:18 ` [Qemu-devel] [PATCH 2/2] apb: convert init to realize Wei Jiangang
@ 2016-05-18 1:55 ` Wei, Jiangang
2016-05-30 9:52 ` Wei, Jiangang
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Wei, Jiangang @ 2016-05-18 1:55 UTC (permalink / raw)
To: qemu-devel; +Cc: marcel, armbru, mst
received hint that Message to <*@redhat.com> was undeliverable.
ping to confirm my message had been sent successfully.
On Tue, 2016-05-17 at 18:18 +0800, Wei Jiangang wrote:
> The first had been reviewed.
> The second had been posted last month, but no feedback.
> They're similar, so resend them together.
>
> Wei Jiangang (2):
> hw/pci-bridge: Convert pxb initialization functions to Error
> apb: convert init to realize
>
> hw/pci-bridge/pci_expander_bridge.c | 52 ++++++++++++++++++-------------------
> hw/pci-host/apb.c | 5 ++--
> 2 files changed, 27 insertions(+), 30 deletions(-)
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] convert device initialization functions
2016-05-17 10:18 [Qemu-devel] [PATCH 0/2] convert device initialization functions Wei Jiangang
` (2 preceding siblings ...)
2016-05-18 1:55 ` [Qemu-devel] [PATCH 0/2] convert device initialization functions Wei, Jiangang
@ 2016-05-30 9:52 ` Wei, Jiangang
2016-06-30 3:36 ` Wei, Jiangang
2016-07-28 20:49 ` [Qemu-devel] " Michael S. Tsirkin
5 siblings, 0 replies; 11+ messages in thread
From: Wei, Jiangang @ 2016-05-30 9:52 UTC (permalink / raw)
To: qemu-devel; +Cc: marcel, armbru, mst
Ping ....
Any comments?
Thanks in advance.
On Tue, 2016-05-17 at 18:18 +0800, Wei Jiangang wrote:
> The first had been reviewed.
> The second had been posted last month, but no feedback.
> They're similar, so resend them together.
>
> Wei Jiangang (2):
> hw/pci-bridge: Convert pxb initialization functions to Error
> apb: convert init to realize
>
> hw/pci-bridge/pci_expander_bridge.c | 52 ++++++++++++++++++-------------------
> hw/pci-host/apb.c | 5 ++--
> 2 files changed, 27 insertions(+), 30 deletions(-)
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] apb: convert init to realize
2016-05-17 10:18 ` [Qemu-devel] [PATCH 2/2] apb: convert init to realize Wei Jiangang
@ 2016-05-31 13:18 ` Markus Armbruster
0 siblings, 0 replies; 11+ messages in thread
From: Markus Armbruster @ 2016-05-31 13:18 UTC (permalink / raw)
To: Wei Jiangang; +Cc: qemu-devel, marcel, mst
Wei Jiangang <weijg.fnst@cn.fujitsu.com> writes:
> Convert a device model where initialization obviously can't fail,
> make it implement realize() rather than init().
>
> Signed-off-by: Wei Jiangang <weijg.fnst@cn.fujitsu.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] convert device initialization functions
2016-05-17 10:18 [Qemu-devel] [PATCH 0/2] convert device initialization functions Wei Jiangang
` (3 preceding siblings ...)
2016-05-30 9:52 ` Wei, Jiangang
@ 2016-06-30 3:36 ` Wei, Jiangang
2016-07-07 1:39 ` Wei, Jiangang
2016-07-28 20:49 ` [Qemu-devel] " Michael S. Tsirkin
5 siblings, 1 reply; 11+ messages in thread
From: Wei, Jiangang @ 2016-06-30 3:36 UTC (permalink / raw)
To: qemu-devel; +Cc: marcel, armbru, mst
Ping
These two patches seem to be forgotten ...
On Tue, 2016-05-17 at 18:18 +0800, Wei Jiangang wrote:
> The first had been reviewed.
> The second had been posted last month, but no feedback.
> They're similar, so resend them together.
>
> Wei Jiangang (2):
> hw/pci-bridge: Convert pxb initialization functions to Error
> apb: convert init to realize
>
> hw/pci-bridge/pci_expander_bridge.c | 52 ++++++++++++++++++-------------------
> hw/pci-host/apb.c | 5 ++--
> 2 files changed, 27 insertions(+), 30 deletions(-)
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] convert device initialization functions
2016-06-30 3:36 ` Wei, Jiangang
@ 2016-07-07 1:39 ` Wei, Jiangang
2016-07-13 7:14 ` Wei, Jiangang
0 siblings, 1 reply; 11+ messages in thread
From: Wei, Jiangang @ 2016-07-07 1:39 UTC (permalink / raw)
To: qemu-devel; +Cc: marcel, armbru, mst
Ping again ...
May I ask for some attention for these two patches?
Thanks
wei
On Thu, 2016-06-30 at 03:36 +0000, Wei, Jiangang wrote:
> Ping
> These two patches seem to be forgotten ...
>
> On Tue, 2016-05-17 at 18:18 +0800, Wei Jiangang wrote:
> > The first had been reviewed.
> > The second had been posted last month, but no feedback.
> > They're similar, so resend them together.
> >
> > Wei Jiangang (2):
> > hw/pci-bridge: Convert pxb initialization functions to Error
> > apb: convert init to realize
> >
> > hw/pci-bridge/pci_expander_bridge.c | 52 ++++++++++++++++++-------------------
> > hw/pci-host/apb.c | 5 ++--
> > 2 files changed, 27 insertions(+), 30 deletions(-)
> >
>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] convert device initialization functions
2016-07-07 1:39 ` Wei, Jiangang
@ 2016-07-13 7:14 ` Wei, Jiangang
2016-07-28 10:18 ` [Qemu-devel] [Qemu-trivial] " Marcel Apfelbaum
0 siblings, 1 reply; 11+ messages in thread
From: Wei, Jiangang @ 2016-07-13 7:14 UTC (permalink / raw)
To: qemu-devel; +Cc: marcel, armbru, mst, qemu-trivial
cc qemu-trivial
The following patches had been reviewed one month ago,
But so far, It haven't been merged.
May I trouble any maintainer give me some feedback?
hw/pci-bridge: Convert pxb initialization functions to Error
apb: convert init to realize
Thanks,
wei
On Thu, 2016-07-07 at 01:39 +0000, Wei, Jiangang wrote:
> Ping again ...
> May I ask for some attention for these two patches?
>
> Thanks
> wei
> On Thu, 2016-06-30 at 03:36 +0000, Wei, Jiangang wrote:
> > Ping
> > These two patches seem to be forgotten ...
> >
> > On Tue, 2016-05-17 at 18:18 +0800, Wei Jiangang wrote:
> > > The first had been reviewed.
> > > The second had been posted last month, but no feedback.
> > > They're similar, so resend them together.
> > >
> > > Wei Jiangang (2):
> > > hw/pci-bridge: Convert pxb initialization functions to Error
> > > apb: convert init to realize
> > >
> > > hw/pci-bridge/pci_expander_bridge.c | 52 ++++++++++++++++++-------------------
> > > hw/pci-host/apb.c | 5 ++--
> > > 2 files changed, 27 insertions(+), 30 deletions(-)
> > >
> >
> >
> >
>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH 0/2] convert device initialization functions
2016-07-13 7:14 ` Wei, Jiangang
@ 2016-07-28 10:18 ` Marcel Apfelbaum
0 siblings, 0 replies; 11+ messages in thread
From: Marcel Apfelbaum @ 2016-07-28 10:18 UTC (permalink / raw)
To: Wei, Jiangang, qemu-devel; +Cc: marcel, qemu-trivial, armbru, mst
On 07/13/2016 10:14 AM, Wei, Jiangang wrote:
> cc qemu-trivial
>
> The following patches had been reviewed one month ago,
> But so far, It haven't been merged.
> May I trouble any maintainer give me some feedback?
>
> hw/pci-bridge: Convert pxb initialization functions to Error
> apb: convert init to realize
>
> Thanks,
> wei
> On Thu, 2016-07-07 at 01:39 +0000, Wei, Jiangang wrote:
>> Ping again ...
>> May I ask for some attention for these two patches?
>>
Hi Wei,
We are very sorry we didn't take your patches yet, we are now in hard freeze,
I am not sure we can have them for 2.7 .
We are going to make sure they get in for 2.8, no further action is requested
from your side.
Thanks,
Marcel
>> Thanks
>> wei
>> On Thu, 2016-06-30 at 03:36 +0000, Wei, Jiangang wrote:
>>> Ping
>>> These two patches seem to be forgotten ...
>>>
>>> On Tue, 2016-05-17 at 18:18 +0800, Wei Jiangang wrote:
>>>> The first had been reviewed.
>>>> The second had been posted last month, but no feedback.
>>>> They're similar, so resend them together.
>>>>
>>>> Wei Jiangang (2):
>>>> hw/pci-bridge: Convert pxb initialization functions to Error
>>>> apb: convert init to realize
>>>>
>>>> hw/pci-bridge/pci_expander_bridge.c | 52 ++++++++++++++++++-------------------
>>>> hw/pci-host/apb.c | 5 ++--
>>>> 2 files changed, 27 insertions(+), 30 deletions(-)
>>>>
>>>
>>>
>>>
>>
>>
>>
>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PATCH 0/2] convert device initialization functions
2016-05-17 10:18 [Qemu-devel] [PATCH 0/2] convert device initialization functions Wei Jiangang
` (4 preceding siblings ...)
2016-06-30 3:36 ` Wei, Jiangang
@ 2016-07-28 20:49 ` Michael S. Tsirkin
5 siblings, 0 replies; 11+ messages in thread
From: Michael S. Tsirkin @ 2016-07-28 20:49 UTC (permalink / raw)
To: Wei Jiangang; +Cc: qemu-devel, armbru, marcel
On Tue, May 17, 2016 at 06:18:45PM +0800, Wei Jiangang wrote:
> The first had been reviewed.
> The second had been posted last month, but no feedback.
> They're similar, so resend them together.
>
> Wei Jiangang (2):
> hw/pci-bridge: Convert pxb initialization functions to Error
> apb: convert init to realize
I still expect to merge these in the next pull - sorry about
the delay.
> hw/pci-bridge/pci_expander_bridge.c | 52 ++++++++++++++++++-------------------
> hw/pci-host/apb.c | 5 ++--
> 2 files changed, 27 insertions(+), 30 deletions(-)
>
> --
> 1.9.3
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2016-07-28 20:49 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-17 10:18 [Qemu-devel] [PATCH 0/2] convert device initialization functions Wei Jiangang
2016-05-17 10:18 ` [Qemu-devel] [PATCH 1/2] hw/pci-bridge: Convert pxb initialization functions to Error Wei Jiangang
2016-05-17 10:18 ` [Qemu-devel] [PATCH 2/2] apb: convert init to realize Wei Jiangang
2016-05-31 13:18 ` Markus Armbruster
2016-05-18 1:55 ` [Qemu-devel] [PATCH 0/2] convert device initialization functions Wei, Jiangang
2016-05-30 9:52 ` Wei, Jiangang
2016-06-30 3:36 ` Wei, Jiangang
2016-07-07 1:39 ` Wei, Jiangang
2016-07-13 7:14 ` Wei, Jiangang
2016-07-28 10:18 ` [Qemu-devel] [Qemu-trivial] " Marcel Apfelbaum
2016-07-28 20:49 ` [Qemu-devel] " Michael S. Tsirkin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.