From patchwork Sat May 30 07:54:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 49252 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 42B5922B40 for ; Sat, 30 May 2015 07:57:33 +0000 (UTC) Received: by lani11 with SMTP id i11sf26117923lan.3 for ; Sat, 30 May 2015 00:57:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:content-type:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=WrmrH42+Sc6X57V6N6aB6oOnTSvFb8oJvr9TgQGmv8w=; b=HL6jO7xkjCJSlMdkXwBuPCu+rXLw3cfd/YKwtrzYknxUdN7TFEi+lW3h+v8QIW+ILI 2hsj8gjPbafwW/x1wQQ9fk+HdM7NscSD6MUFHYanEo5lBTuYcKWzSdRtihWes3IHKNlN vmn/sk8kLnjr6vSXW6sD0ymz+UZkLqtd4jUkJm5vUqvbV/Tx+W50Z4AgS+/nmLhB6Hgj GI5+xOuuGKCTwW7EBWYOVAwwKSZdkqC5bIpCEF2nwCxHHjXZuGJ/reuWoORfSOwpTOhk cAzQIUMtF5permgCMEyFuEkKGIxlbdYiC6P2JyNU7nfjEWZf78VMX96IBNCNZKib4sK9 L5XQ== X-Gm-Message-State: ALoCoQkHsLrsWOFwwfV8/gCd8SYlmaXpLSLhHziJdjviAZCfxM1sAYhpFMKd+tXV1QQRZqcZBbx/ X-Received: by 10.113.11.3 with SMTP id ee3mr11050143lbd.9.1432972652181; Sat, 30 May 2015 00:57:32 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.36 with SMTP id t4ls463958lal.99.gmail; Sat, 30 May 2015 00:57:31 -0700 (PDT) X-Received: by 10.112.93.230 with SMTP id cx6mr6176528lbb.65.1432972651928; Sat, 30 May 2015 00:57:31 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id le1si6744730lac.158.2015.05.30.00.57.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 May 2015 00:57:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by labko7 with SMTP id ko7so66920168lab.2 for ; Sat, 30 May 2015 00:57:31 -0700 (PDT) X-Received: by 10.112.220.7 with SMTP id ps7mr11614348lbc.72.1432972651493; Sat, 30 May 2015 00:57:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp887292lbb; Sat, 30 May 2015 00:57:30 -0700 (PDT) X-Received: by 10.55.53.72 with SMTP id c69mr23726380qka.67.1432972648911; Sat, 30 May 2015 00:57:28 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f194si5029763qhe.112.2015.05.30.00.57.28 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 30 May 2015 00:57:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:38636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yybe4-0000LU-5P for patch@linaro.org; Sat, 30 May 2015 03:57:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yybc5-0005FO-6Z for qemu-devel@nongnu.org; Sat, 30 May 2015 03:55:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yybc3-00088e-Ul for qemu-devel@nongnu.org; Sat, 30 May 2015 03:55:25 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:38789) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yybby-00087a-JT; Sat, 30 May 2015 03:55:19 -0400 Received: from 172.24.2.119 (EHLO szxeml431-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id COS15542; Sat, 30 May 2015 15:55:06 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml431-hub.china.huawei.com (10.82.67.208) with Microsoft SMTP Server id 14.3.158.1; Sat, 30 May 2015 15:54:58 +0800 From: Shannon Zhao To: Date: Sat, 30 May 2015 15:54:32 +0800 Message-ID: <1432972477-13504-3-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1432972477-13504-1-git-send-email-zhaoshenglong@huawei.com> References: <1432972477-13504-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 58.251.152.64 Cc: qemu-trivial@nongnu.org, peter.maydell@linaro.org, mjt@tls.msk.ru, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH v2 2/7] hw/mips/mips_jazz.c: Store irq array in MachineState to fix memory leak X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Shannon Zhao Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/mips/mips_jazz.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 2c153e0..259458b 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -135,7 +135,7 @@ static void mips_jazz_init(MachineState *machine, MIPSCPU *cpu; CPUClass *cc; CPUMIPSState *env; - qemu_irq *rc4030, *i8259; + qemu_irq *i8259; rc4030_dma *dmas; void* rc4030_opaque; MemoryRegion *isa_mem = g_new(MemoryRegion, 1); @@ -218,7 +218,7 @@ static void mips_jazz_init(MachineState *machine, cpu_mips_clock_init(env); /* Chipset */ - rc4030_opaque = rc4030_init(env->irq[6], env->irq[3], &rc4030, &dmas, + rc4030_opaque = rc4030_init(env->irq[6], env->irq[3], &machine->irqs, &dmas, address_space); memory_region_init_io(dma_dummy, NULL, &dma_dummy_ops, NULL, "dummy_dma", 0x1000); memory_region_add_subregion(address_space, 0x8000d000, dma_dummy); @@ -246,7 +246,7 @@ static void mips_jazz_init(MachineState *machine, sysbus = SYS_BUS_DEVICE(dev); sysbus_mmio_map(sysbus, 0, 0x60080000); sysbus_mmio_map(sysbus, 1, 0x40000000); - sysbus_connect_irq(sysbus, 0, rc4030[3]); + sysbus_connect_irq(sysbus, 0, machine->irqs[3]); { /* Simple ROM, so user doesn't have to provide one */ MemoryRegion *rom_mr = g_new(MemoryRegion, 1); @@ -272,8 +272,8 @@ static void mips_jazz_init(MachineState *machine, if (!nd->model) nd->model = g_strdup("dp83932"); if (strcmp(nd->model, "dp83932") == 0) { - dp83932_init(nd, 0x80001000, 2, get_system_memory(), rc4030[4], - rc4030_opaque, rc4030_dma_memory_rw); + dp83932_init(nd, 0x80001000, 2, get_system_memory(), + machine->irqs[4], rc4030_opaque, rc4030_dma_memory_rw); break; } else if (is_help_option(nd->model)) { fprintf(stderr, "qemu: Supported NICs: dp83932\n"); @@ -287,7 +287,7 @@ static void mips_jazz_init(MachineState *machine, /* SCSI adapter */ esp_init(0x80002000, 0, rc4030_dma_read, rc4030_dma_write, dmas[0], - rc4030[5], &esp_reset, &dma_enable); + machine->irqs[5], &esp_reset, &dma_enable); /* Floppy */ if (drive_get_max_bus(IF_FLOPPY) >= MAX_FD) { @@ -297,7 +297,7 @@ static void mips_jazz_init(MachineState *machine, for (n = 0; n < MAX_FD; n++) { fds[n] = drive_get(IF_FLOPPY, 0, n); } - fdctrl_init_sysbus(rc4030[1], 0, 0x80003000, fds); + fdctrl_init_sysbus(machine->irqs[1], 0, 0x80003000, fds); /* Real time clock */ rtc_init(isa_bus, 1980, NULL); @@ -305,25 +305,25 @@ static void mips_jazz_init(MachineState *machine, memory_region_add_subregion(address_space, 0x80004000, rtc); /* Keyboard (i8042) */ - i8042_mm_init(rc4030[6], rc4030[7], i8042, 0x1000, 0x1); + i8042_mm_init(machine->irqs[6], machine->irqs[7], i8042, 0x1000, 0x1); memory_region_add_subregion(address_space, 0x80005000, i8042); /* Serial ports */ if (serial_hds[0]) { - serial_mm_init(address_space, 0x80006000, 0, rc4030[8], 8000000/16, - serial_hds[0], DEVICE_NATIVE_ENDIAN); + serial_mm_init(address_space, 0x80006000, 0, machine->irqs[8], + 8000000/16, serial_hds[0], DEVICE_NATIVE_ENDIAN); } if (serial_hds[1]) { - serial_mm_init(address_space, 0x80007000, 0, rc4030[9], 8000000/16, - serial_hds[1], DEVICE_NATIVE_ENDIAN); + serial_mm_init(address_space, 0x80007000, 0, machine->irqs[9], + 8000000/16, serial_hds[1], DEVICE_NATIVE_ENDIAN); } /* Parallel port */ if (parallel_hds[0]) - parallel_mm_init(address_space, 0x80008000, 0, rc4030[0], + parallel_mm_init(address_space, 0x80008000, 0, machine->irqs[0], parallel_hds[0]); - /* FIXME: missing Jazz sound at 0x8000c000, rc4030[2] */ + /* FIXME: missing Jazz sound at 0x8000c000, machine->irqs[2] */ /* NVRAM */ dev = qdev_create(NULL, "ds1225y");