From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "xiaoqiang zhao" <zxq_yx_007@163.com>,
"Andreas Färber" <afaerber@suse.de>,
"Anthony Liguori" <aliguori@amazon.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PULL v2 20/24] apic: QOM'ify APIC
Date: Tue, 24 Dec 2013 18:04:31 +0100 [thread overview]
Message-ID: <1387904675-7962-21-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1387904675-7962-1-git-send-email-afaerber@suse.de>
From: xiaoqiang zhao <zxq_yx_007@163.com>
Convert 'init' function to QOM's 'realize' for apic, kvm/apic and
xen/xen_apic.
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/i386/kvm/apic.c | 6 ++++--
hw/intc/apic.c | 6 ++++--
hw/intc/apic_common.c | 2 +-
hw/xen/xen_apic.c | 6 ++++--
include/hw/i386/apic_internal.h | 2 +-
5 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/hw/i386/kvm/apic.c b/hw/i386/kvm/apic.c
index 84f6056..e873b50 100644
--- a/hw/i386/kvm/apic.c
+++ b/hw/i386/kvm/apic.c
@@ -171,8 +171,10 @@ static const MemoryRegionOps kvm_apic_io_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static void kvm_apic_init(APICCommonState *s)
+static void kvm_apic_realize(DeviceState *dev, Error **errp)
{
+ APICCommonState *s = APIC_COMMON(dev);
+
memory_region_init_io(&s->io_memory, NULL, &kvm_apic_io_ops, s, "kvm-apic-msi",
APIC_SPACE_SIZE);
@@ -185,7 +187,7 @@ static void kvm_apic_class_init(ObjectClass *klass, void *data)
{
APICCommonClass *k = APIC_COMMON_CLASS(klass);
- k->init = kvm_apic_init;
+ k->realize = kvm_apic_realize;
k->set_base = kvm_apic_set_base;
k->set_tpr = kvm_apic_set_tpr;
k->get_tpr = kvm_apic_get_tpr;
diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index b542628..3d3deb6 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -871,8 +871,10 @@ static const MemoryRegionOps apic_io_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static void apic_init(APICCommonState *s)
+static void apic_realize(DeviceState *dev, Error **errp)
{
+ APICCommonState *s = APIC_COMMON(dev);
+
memory_region_init_io(&s->io_memory, OBJECT(s), &apic_io_ops, s, "apic-msi",
APIC_SPACE_SIZE);
@@ -886,7 +888,7 @@ static void apic_class_init(ObjectClass *klass, void *data)
{
APICCommonClass *k = APIC_COMMON_CLASS(klass);
- k->init = apic_init;
+ k->realize = apic_realize;
k->set_base = apic_set_base;
k->set_tpr = apic_set_tpr;
k->get_tpr = apic_get_tpr;
diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
index de5e190..2842655 100644
--- a/hw/intc/apic_common.c
+++ b/hw/intc/apic_common.c
@@ -298,7 +298,7 @@ static int apic_init_common(ICCDevice *dev)
s->idx = apic_no++;
info = APIC_COMMON_GET_CLASS(s);
- info->init(s);
+ info->realize(DEVICE(dev), NULL);
if (!mmio_registered) {
ICCBus *b = ICC_BUS(qdev_get_parent_bus(DEVICE(dev)));
memory_region_add_subregion(b->apic_address_space, 0, &s->io_memory);
diff --git a/hw/xen/xen_apic.c b/hw/xen/xen_apic.c
index 9f91e0f..63bb7f7 100644
--- a/hw/xen/xen_apic.c
+++ b/hw/xen/xen_apic.c
@@ -36,8 +36,10 @@ static const MemoryRegionOps xen_apic_io_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static void xen_apic_init(APICCommonState *s)
+static void xen_apic_realize(DeviceState *dev, Error **errp)
{
+ APICCommonState *s = APIC_COMMON(dev);
+
memory_region_init_io(&s->io_memory, OBJECT(s), &xen_apic_io_ops, s,
"xen-apic-msi", APIC_SPACE_SIZE);
@@ -72,7 +74,7 @@ static void xen_apic_class_init(ObjectClass *klass, void *data)
{
APICCommonClass *k = APIC_COMMON_CLASS(klass);
- k->init = xen_apic_init;
+ k->realize = xen_apic_realize;
k->set_base = xen_apic_set_base;
k->set_tpr = xen_apic_set_tpr;
k->get_tpr = xen_apic_get_tpr;
diff --git a/include/hw/i386/apic_internal.h b/include/hw/i386/apic_internal.h
index 1b0a7fb..70542a6 100644
--- a/include/hw/i386/apic_internal.h
+++ b/include/hw/i386/apic_internal.h
@@ -80,7 +80,7 @@ typedef struct APICCommonClass
{
ICCDeviceClass parent_class;
- void (*init)(APICCommonState *s);
+ DeviceRealize realize;
void (*set_base)(APICCommonState *s, uint64_t val);
void (*set_tpr)(APICCommonState *s, uint8_t val);
uint8_t (*get_tpr)(APICCommonState *s);
--
1.8.4
next prev parent reply other threads:[~2013-12-24 17:04 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-24 17:04 [Qemu-devel] [PULL v2 00/24] QOM devices patch queue 2013-12-24 Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 01/24] qdev: Replace no_user by cannot_instantiate_with_device_add_yet Andreas Färber
2013-12-24 19:43 ` Michael S. Tsirkin
2014-01-07 10:28 ` Markus Armbruster
2014-01-07 11:56 ` Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 02/24] sysbus: Set cannot_instantiate_with_device_add_yet Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 03/24] cpu: Document why cannot_instantiate_with_device_add_yet Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 04/24] apic: " Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 05/24] pci-host: Consistently set cannot_instantiate_with_device_add_yet Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 06/24] ich9: Document why cannot_instantiate_with_device_add_yet Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 07/24] piix3 piix4: Clean up use of cannot_instantiate_with_device_add_yet Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 08/24] vt82c686: " Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 09/24] isa: " Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 10/24] qdev: Do not let the user try to device_add when it cannot work Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 11/24] qdev-monitor: Avoid device_add crashing on non-device driver name Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 12/24] hw: cannot_instantiate_with_device_add_yet due to pointer props Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 13/24] qdev: Document that pointer properties kill device_add Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 14/24] qom: Split out object and class caches Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 15/24] qom: Do not register interface "types" in the type table and fix names Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 16/24] tests: Test QOM interface casting Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 17/24] qom: Detect bad reentrance during object_class_foreach() Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 18/24] qdev: Drop misleading qbus_free() function Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 19/24] apic: Cleanup for QOM'ification Andreas Färber
2013-12-24 17:04 ` Andreas Färber [this message]
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 21/24] icc_bus: QOM'ify ICC Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 22/24] ioapic: Cleanup for QOM'ification Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 23/24] ioapic: QOM'ify ioapic Andreas Färber
2013-12-24 17:04 ` [Qemu-devel] [PULL v2 24/24] qdev-monitor: Improve error message for -device nonexistant Andreas Färber
2014-02-04 15:56 ` [Qemu-devel] [PULL v2 00/24] QOM devices patch queue 2013-12-24 Andreas Färber
2014-02-04 16:13 ` Michael S. Tsirkin
2014-02-04 17:40 ` Michael S. Tsirkin
2014-02-04 18:07 ` Michael S. Tsirkin
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=1387904675-7962-21-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=aliguori@amazon.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zxq_yx_007@163.com \
/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).