From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFeLf-0005Q3-8s for qemu-devel@nongnu.org; Thu, 05 Apr 2012 00:31:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SFeLa-00028y-Kq for qemu-devel@nongnu.org; Thu, 05 Apr 2012 00:31:00 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:63807) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFeLa-00028k-Df for qemu-devel@nongnu.org; Thu, 05 Apr 2012 00:30:58 -0400 Received: from euspt1 (mailout1.w1.samsung.com [210.118.77.11]) by mailout1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTP id <0M1Z00MPSOI5EQ@mailout1.w1.samsung.com> for qemu-devel@nongnu.org; Thu, 05 Apr 2012 05:30:05 +0100 (BST) Received: from [106.109.9.191] by spt1.w1.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0M1Z00JIROJGMD@spt1.w1.samsung.com> for qemu-devel@nongnu.org; Thu, 05 Apr 2012 05:30:53 +0100 (BST) Date: Thu, 05 Apr 2012 08:30:51 +0400 From: Evgeny Voevodin In-reply-to: <1333553462-12633-9-git-send-email-peter.maydell@linaro.org> Message-id: <4F7D1FFB.6040405@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT References: <1333553462-12633-1-git-send-email-peter.maydell@linaro.org> <1333553462-12633-9-git-send-email-peter.maydell@linaro.org> Subject: Re: [Qemu-devel] [PATCH 08/13] hw/exynos4210_gic.c: Convert to using sysbus GIC List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Dmitry Solodkiy , patches@linaro.org, qemu-devel@nongnu.org, Paul Brook On 04.04.2012 19:30, Peter Maydell wrote: > Convert the Exynos GIC code to use the standalone sysbus > GIC device. > > Signed-off-by: Peter Maydell > --- > hw/exynos4210_gic.c | 32 ++++++++++++++++++++++++-------- > 1 files changed, 24 insertions(+), 8 deletions(-) > > diff --git a/hw/exynos4210_gic.c b/hw/exynos4210_gic.c > index a05dab2..e1b215e 100644 > --- a/hw/exynos4210_gic.c > +++ b/hw/exynos4210_gic.c > @@ -262,28 +262,44 @@ uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit) > > /********* GIC part *********/ > > -#define LEGACY_INCLUDED_GIC > -#include "arm_gic.c" > - > typedef struct { > - gic_state gic; > + SysBusDevice busdev; > MemoryRegion cpu_container; > MemoryRegion dist_container; > MemoryRegion cpu_alias[EXYNOS4210_NCPUS]; > MemoryRegion dist_alias[EXYNOS4210_NCPUS]; > uint32_t num_cpu; > + DeviceState *gic; > } Exynos4210GicState; > > +static void exynos4210_gic_set_irq(void *opaque, int irq, int level) > +{ > + Exynos4210GicState *s = (Exynos4210GicState *)opaque; > + qemu_set_irq(qdev_get_gpio_in(s->gic, irq), level); > +} > + > static int exynos4210_gic_init(SysBusDevice *dev) > { > - Exynos4210GicState *s = FROM_SYSBUSGIC(Exynos4210GicState, dev); > + Exynos4210GicState *s = FROM_SYSBUS(Exynos4210GicState, dev); > uint32_t i; > const char cpu_prefix[] = "exynos4210-gic-alias_cpu"; > const char dist_prefix[] = "exynos4210-gic-alias_dist"; > char cpu_alias_name[sizeof(cpu_prefix) + 3]; > char dist_alias_name[sizeof(cpu_prefix) + 3]; > + SysBusDevice *busdev; > + > + s->gic = qdev_create(NULL, "arm_gic"); > + qdev_prop_set_uint32(s->gic, "num-cpu", s->num_cpu); > + qdev_prop_set_uint32(s->gic, "num-irq", EXYNOS4210_GIC_NIRQ); > + qdev_init_nofail(s->gic); > + busdev = sysbus_from_qdev(s->gic); > + > + /* Pass through outbound IRQ lines from the GIC */ > + sysbus_pass_irq(dev, busdev); > > - gic_init(&s->gic, s->num_cpu, EXYNOS4210_GIC_NIRQ); > + /* Pass through inbound GPIO lines to the GIC */ > + qdev_init_gpio_in(&s->busdev.qdev, exynos4210_gic_set_irq, > + EXYNOS4210_GIC_NIRQ - 32); > > memory_region_init(&s->cpu_container, "exynos4210-cpu-container", > EXYNOS4210_EXT_GIC_CPU_REGION_SIZE); > @@ -295,7 +311,7 @@ static int exynos4210_gic_init(SysBusDevice *dev) > sprintf(cpu_alias_name, "%s%x", cpu_prefix, i); > memory_region_init_alias(&s->cpu_alias[i], > cpu_alias_name, > -&s->gic.cpuiomem[0], > + sysbus_mmio_get_region(busdev, 1), > 0, > EXYNOS4210_GIC_CPU_REGION_SIZE); > memory_region_add_subregion(&s->cpu_container, > @@ -305,7 +321,7 @@ static int exynos4210_gic_init(SysBusDevice *dev) > sprintf(dist_alias_name, "%s%x", dist_prefix, i); > memory_region_init_alias(&s->dist_alias[i], > dist_alias_name, > -&s->gic.iomem, > + sysbus_mmio_get_region(busdev, 0), > 0, > EXYNOS4210_GIC_DIST_REGION_SIZE); > memory_region_add_subregion(&s->dist_container, Reviewed-by: Evgeny Voevodin -- Kind regards, Evgeny Voevodin, Leading Software Engineer, ASWG, Moscow R&D center, Samsung Electronics e-mail: e.voevodin@samsung.com