From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLUUK-0006EQ-9t for qemu-devel@nongnu.org; Tue, 09 Oct 2012 03:44:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLUUJ-0001OK-1X for qemu-devel@nongnu.org; Tue, 09 Oct 2012 03:44:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLUUI-0001Nj-PD for qemu-devel@nongnu.org; Tue, 09 Oct 2012 03:44:22 -0400 Message-ID: <5073D5CD.7010803@redhat.com> Date: Tue, 09 Oct 2012 09:44:13 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <28ca4d302b2bed59ddd066631d1a1b5585e8511e.1349749915.git.jbaron@redhat.com> In-Reply-To: <28ca4d302b2bed59ddd066631d1a1b5585e8511e.1349749915.git.jbaron@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 06/21] pc: Move ioapic_init() from pc_piix.c to pc.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Baron Cc: aliguori@us.ibm.com, juzhang@redhat.com, mst@redhat.com, jan.kiszka@siemens.com, qemu-devel@nongnu.org, agraf@suse.de, blauwirbel@gmail.com, yamahata@valinux.co.jp, alex.williamson@redhat.com, kevin@koconnor.net, avi@redhat.com, mkletzan@redhat.com, lcapitulino@redhat.com, afaerber@suse.de, armbru@redhat.com, kraxel@redhat.com Il 09/10/2012 05:30, Jason Baron ha scritto: > From: Jason Baron > > Move ioapic_init from pc_piix.c to pc.c, to make it a common function. > Rename ioapic_init -> ioapic_init_gsi. > > Signed-off-by: Jason Baron Reviewed-by: Paolo Bonzini > --- > hw/pc.c | 24 ++++++++++++++++++++++++ > hw/pc.h | 2 ++ > hw/pc_piix.c | 25 +------------------------ > 3 files changed, 27 insertions(+), 24 deletions(-) > > diff --git a/hw/pc.c b/hw/pc.c > index fef39ba..f5fbd0c 100644 > --- a/hw/pc.c > +++ b/hw/pc.c > @@ -1148,3 +1148,27 @@ void pc_pci_device_init(PCIBus *pci_bus) > pci_create_simple(pci_bus, -1, "lsi53c895a"); > } > } > + > +void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name) > +{ > + DeviceState *dev; > + SysBusDevice *d; > + unsigned int i; > + > + if (kvm_irqchip_in_kernel()) { > + dev = qdev_create(NULL, "kvm-ioapic"); > + } else { > + dev = qdev_create(NULL, "ioapic"); > + } > + if (parent_name) { > + object_property_add_child(object_resolve_path(parent_name, NULL), > + "ioapic", OBJECT(dev), NULL); > + } > + qdev_init_nofail(dev); > + d = sysbus_from_qdev(dev); > + sysbus_mmio_map(d, 0, 0xfec00000); > + > + for (i = 0; i < IOAPIC_NUM_PINS; i++) { > + gsi_state->ioapic_irq[i] = qdev_get_gpio_in(dev, i); > + } > +} > diff --git a/hw/pc.h b/hw/pc.h > index d0feb20..c78923c 100644 > --- a/hw/pc.h > +++ b/hw/pc.h > @@ -131,6 +131,8 @@ void pc_pci_device_init(PCIBus *pci_bus); > typedef void (*cpu_set_smm_t)(int smm, void *arg); > void cpu_smm_register(cpu_set_smm_t callback, void *arg); > > +void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); > + > /* acpi.c */ > extern int acpi_enabled; > extern char *acpi_tables; > diff --git a/hw/pc_piix.c b/hw/pc_piix.c > index 87ca60b..668dccf 100644 > --- a/hw/pc_piix.c > +++ b/hw/pc_piix.c > @@ -94,29 +94,6 @@ static void kvm_piix3_gsi_handler(void *opaque, int n, int level) > } > } > > -static void ioapic_init(GSIState *gsi_state) > -{ > - DeviceState *dev; > - SysBusDevice *d; > - unsigned int i; > - > - if (kvm_irqchip_in_kernel()) { > - dev = qdev_create(NULL, "kvm-ioapic"); > - } else { > - dev = qdev_create(NULL, "ioapic"); > - } > - /* FIXME: this should be under the piix3. */ > - object_property_add_child(object_resolve_path("i440fx", NULL), > - "ioapic", OBJECT(dev), NULL); > - qdev_init_nofail(dev); > - d = sysbus_from_qdev(dev); > - sysbus_mmio_map(d, 0, 0xfec00000); > - > - for (i = 0; i < IOAPIC_NUM_PINS; i++) { > - gsi_state->ioapic_irq[i] = qdev_get_gpio_in(dev, i); > - } > -} > - > /* PC hardware initialisation */ > static void pc_init1(MemoryRegion *system_memory, > MemoryRegion *system_io, > @@ -220,7 +197,7 @@ static void pc_init1(MemoryRegion *system_memory, > gsi_state->i8259_irq[i] = i8259[i]; > } > if (pci_enabled) { > - ioapic_init(gsi_state); > + ioapic_init_gsi(gsi_state, "i440fx"); > } > > pc_register_ferr_irq(gsi[13]); >