From: Wanpeng Li <liwanp@linux.vnet.ibm.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Ram Pai <pair@us.ibm.com>, "Michael S. Tsirkin" <mst@redhat.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
qemu-devel@nongnu.org, Liu Ping Fan <kernelfans@gmail.com>,
Blue Swirl <blauwirbel@gmail.com>,
Stefan Weil <weil@mail.berlios.de>, Avi Kivity <avi@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Wanpeng Li <liwanp@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 08/10] convert VMMOUSE as piix3 proper QOM child
Date: Thu, 8 Nov 2012 13:36:37 +0800 [thread overview]
Message-ID: <1352352999-2561-9-git-send-email-liwanp@linux.vnet.ibm.com> (raw)
In-Reply-To: <1352352999-2561-1-git-send-email-liwanp@linux.vnet.ibm.com>
convert VMMOUSE as piix3 proper QOM child.
VMMOUSE creation for the PIIX3 is done by calling object_init() with
qdev_init() being called for each child device in the PIIX3 ::init
function.
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
---
hw/pc.c | 15 ++-------------
hw/piix3.c | 10 ++++++++++
hw/piix3.h | 16 ++++++++++++++++
hw/vmmouse.c | 14 --------------
4 files changed, 28 insertions(+), 27 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 99cd314..9798c24 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -926,12 +926,10 @@ static void cpu_request_exit(void *opaque, int irq, int level)
}
static void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
- ISADevice **floppy,
- bool no_vmport)
+ ISADevice **floppy)
{
int i;
DriveInfo *fd[MAX_FD];
- ISADevice *vmmouse;
qemu_irq *cpu_exit_irq;
register_ioport_write(0x80, 1, 1, ioport80_write, NULL);
@@ -950,15 +948,6 @@ static void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
}
}
- if (!no_vmport) {
- vmmouse = isa_try_create(isa_bus, "vmmouse");
- } else {
- vmmouse = NULL;
- }
- if (vmmouse) {
- qdev_init_nofail(&vmmouse->qdev);
- }
-
cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);
DMA_init(0, cpu_exit_irq);
@@ -1174,7 +1163,7 @@ static void pc_init1(MemoryRegion *system_memory,
}
/* init basic PC hardware */
- pc_basic_device_init(isa_bus, gsi, &floppy, xen_enabled());
+ pc_basic_device_init(isa_bus, gsi, &floppy);
for (i = 0; i < nb_nics; i++) {
NICInfo *nd = &nd_table[i];
diff --git a/hw/piix3.c b/hw/piix3.c
index 27c8f50..2922fd4 100644
--- a/hw/piix3.c
+++ b/hw/piix3.c
@@ -271,8 +271,15 @@ static int piix3_realize(PCIDevice *dev)
/* Realize the VMPORT */
if (!xen_enabled()) {
+ /* Realize the VMPORT */
qdev_set_parent_bus(DEVICE(&s->vmport), BUS(s->bus));
qdev_init_nofail(DEVICE(&s->vmport));
+
+ /* Realize the VMMOUSE */
+ qdev_set_parent_bus(DEVICE(&s->vmmouse), BUS(s->bus));
+ qdev_prop_set_ptr(DEVICE(&s->vmmouse),
+ "ps2_mouse", ISA_DEVICE(&s->i8042));
+ qdev_init_nofail(DEVICE(&s->vmmouse));
}
return 0;
@@ -318,6 +325,9 @@ static void piix3_initfn(Object *obj)
object_initialize(&s->vmport, TYPE_VMPORT);
object_property_add_child(obj, "vmport", OBJECT(&s->vmport), NULL);
}
+
+ object_initialize(&s->vmmouse, TYPE_VMMOUSE);
+ object_property_add_child(obj, "vmmouse", OBJECT(&s->vmmouse), NULL);
}
static void piix3_class_init(ObjectClass *klass, void *data)
diff --git a/hw/piix3.h b/hw/piix3.h
index 477e39e..29ae820 100644
--- a/hw/piix3.h
+++ b/hw/piix3.h
@@ -36,6 +36,7 @@
#include "i8254_internal.h"
#include "pcspk.h"
#include "ps2.h"
+#include "console.h"
#define PIIX_NUM_PIC_IRQS 16 /* i8259 * 2 */
#define PIIX_NUM_PIRQS 4ULL /* PIRQ[A-D] */
@@ -57,6 +58,20 @@ typedef struct KVMPITState {
#define TYPE_VMPORT "vmport"
#define VMPORT_ENTRIES 0x2c
+#define TYPE_VMMOUSE "vmmouse"
+#define VMMOUSE_QUEUE_SIZE 1024
+
+typedef struct _VMMouseState {
+ ISADevice dev;
+ uint32_t queue[VMMOUSE_QUEUE_SIZE];
+ int32_t queue_size;
+ uint16_t nb_queue;
+ uint16_t status;
+ uint8_t absolute;
+ QEMUPutMouseEntry *entry;
+ void *ps2_mouse;
+} VMMouseState;
+
typedef struct _VMPortState {
ISADevice dev;
MemoryRegion io;
@@ -121,6 +136,7 @@ typedef struct PIIX3State {
KVMPITState kvm_pit;
} pit;
VMPortState vmport;
+ VMMouseState vmmouse;
#endif
PCSpkState pcspk;
Port92State port92;
diff --git a/hw/vmmouse.c b/hw/vmmouse.c
index 6338efa..022e493 100644
--- a/hw/vmmouse.c
+++ b/hw/vmmouse.c
@@ -41,8 +41,6 @@
#define VMMOUSE_REQUEST_RELATIVE 0x4c455252
#define VMMOUSE_REQUEST_ABSOLUTE 0x53424152
-#define VMMOUSE_QUEUE_SIZE 1024
-
#define VMMOUSE_VERSION 0x3442554a
#ifdef DEBUG_VMMOUSE
@@ -51,18 +49,6 @@
#define DPRINTF(fmt, ...) do { } while (0)
#endif
-typedef struct _VMMouseState
-{
- ISADevice dev;
- uint32_t queue[VMMOUSE_QUEUE_SIZE];
- int32_t queue_size;
- uint16_t nb_queue;
- uint16_t status;
- uint8_t absolute;
- QEMUPutMouseEntry *entry;
- void *ps2_mouse;
-} VMMouseState;
-
static uint32_t vmmouse_get_status(VMMouseState *s)
{
DPRINTF("vmmouse_get_status()\n");
--
1.7.7.6
next prev parent reply other threads:[~2012-11-08 5:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-08 5:36 [Qemu-devel] [PATCH 00/10] piix3: create all child devices as proper QOM children Wanpeng Li
2012-11-08 5:36 ` [Qemu-devel] [PATCH 01/10] convert RTC as piix3 proper QOM child Wanpeng Li
2012-11-08 5:36 ` [Qemu-devel] [PATCH 02/10] convert HPET " Wanpeng Li
2012-11-08 5:36 ` [Qemu-devel] [PATCH 03/10] convert PIT " Wanpeng Li
2012-11-08 5:36 ` [Qemu-devel] [PATCH 04/10] convert PCSPK " Wanpeng Li
2012-11-08 5:36 ` [Qemu-devel] [PATCH 05/10] convert PORT92 " Wanpeng Li
2012-11-08 5:36 ` [Qemu-devel] [PATCH 06/10] convert i8042 " Wanpeng Li
2012-11-08 5:36 ` [Qemu-devel] [PATCH 07/10] convert VMPORT " Wanpeng Li
2012-11-08 5:36 ` Wanpeng Li [this message]
2012-11-08 5:36 ` [Qemu-devel] [PATCH 09/10] convert IDE " Wanpeng Li
2012-11-08 5:36 ` [Qemu-devel] [PATCH 10/10] convert IOAPIC " Wanpeng Li
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=1352352999-2561-9-git-send-email-liwanp@linux.vnet.ibm.com \
--to=liwanp@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=jan.kiszka@siemens.com \
--cc=kernelfans@gmail.com \
--cc=mst@redhat.com \
--cc=pair@us.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=weil@mail.berlios.de \
/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).