From patchwork Tue Jan 19 08:36:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 366149 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp546084jam; Tue, 19 Jan 2021 00:41:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0xbiv6VE8mRivauPk8Nr1/RBap1IxICFKs8e4NkD4y08//6mzIjw2mY7Vlor2DukeIpQD X-Received: by 2002:a5b:98e:: with SMTP id c14mr4532455ybq.17.1611045708400; Tue, 19 Jan 2021 00:41:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611045708; cv=none; d=google.com; s=arc-20160816; b=Vq+EVD3SVpRNy01uSDyjhKYvWYykXUKMhBtQZ+dGTLx/kYNAzoUhOZxOye8jUwzwoO /Gk95xvdWylptEB3Zuk2vfslMESsefLUHiM+DaRUHTcxtN+aShZdpqo4xmjrMhDcPyVH tfUQ8H5zKPgmAdVRdr46l2vxci5zbrUuh4Gy5BgDXAPfxwOz6zFP2HZsiWO5mrKsjkhC lCtKL7nQ1qCj/quNkgnbLCqkp8IA05W1/Gi8KK9yUws6C8MnWadn8cH6kPNQm17pkRVW Yoq9Qcob443kuXOQUa9g85vN40U11r7QF72B3gY9Mm05njv58/O1FXjIpp6zbVInLGs3 XVxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=glVtI5cyV9govITmJ39bqSL+NJwToQB6R6WAWUrnoKU=; b=poRCA+8V5sncaenq8hD1h0958jxJMLeurxpqizkyM5BG9Q91PYUHNzyvJ79fhiTSxS 4a90QYRrEKGZ8aU7v3Dgi91w4pJ/AgY90H4v47OnAeFBYtj16QzrwEMSxgdCN7gwKZAc tr6ykXamWv8J/HrStTHAElbK1FSoPe6yGixZ/TXBD515xH4sPERkt9aeHpd4VZC3KPd6 S+bJY8n9iTXA2trpGuxVY4Riqs64x5cxzwFgDnKX81rvsCqGrrb3y3LHCyfZZOBo/Dau WYwNgoXyo0fcu4KIzj40kx2wpgTBgF4WsrLwtj+QeujIR2nDFjrbOTAJhiDUoS3ii+hb yOlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x13si4828650ybk.369.2021.01.19.00.41.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Jan 2021 00:41:48 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:42774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1maB-0006q6-SC for patch@linaro.org; Tue, 19 Jan 2021 03:41:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1mVY-0008Il-9e for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:37:00 -0500 Received: from mail-wm1-f44.google.com ([209.85.128.44]:56298) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1mVW-0003Uf-Nh for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:37:00 -0500 Received: by mail-wm1-f44.google.com with SMTP id c124so15681756wma.5 for ; Tue, 19 Jan 2021 00:36:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=glVtI5cyV9govITmJ39bqSL+NJwToQB6R6WAWUrnoKU=; b=O/4SKCx6oISAQU5AIioQSoLyrRjhCCFUv7oycTMKq4hYxulr7NxnSOVxq/dD7+8ezG 7+XcoqF5BMj3W0FuR08Vi8gP8m/6eqZQQrI0SvDiOdn+XhA/JKZb2GHstHyvxnKNkw/m M3LqgfaTz1yePnGM1r7q6NW8JUPZ24mFwpdyOh4mSXp/hyIIy596O+eEVi4o0t+SUuj1 XZmIQ5EmiEGS/0Q+SFRov3e1eIsrHLPeMQIoMpfk+2b0E+qA/Q/+i7/5EUymx/DzrpOu xri69q1BFaTMoesaOxu71w7Yfwis1uJcZ7XdHTgXUNhIF4ruk5j1bJlV/2nvt6c5umRt TA/g== X-Gm-Message-State: AOAM530M8C0u2NTR19f1klvzqfkKO/4DvtTCO5V1wxR75MFHX1xBx4n4 3saMmLfWXTy9+zSPsqrcGoMIe3VSuJs= X-Received: by 2002:a05:600c:210b:: with SMTP id u11mr3033958wml.16.1611045417368; Tue, 19 Jan 2021 00:36:57 -0800 (PST) Received: from localhost.localdomain (pd9e83aed.dip0.t-ipconnect.de. [217.232.58.237]) by smtp.gmail.com with ESMTPSA id z14sm540833wrm.5.2021.01.19.00.36.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 00:36:57 -0800 (PST) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 07/11] hw/m68k/next-cube: Make next_irq GPIO inputs to NEXT_PC device Date: Tue, 19 Jan 2021 09:36:13 +0100 Message-Id: <20210119083617.6337-8-huth@tuxfamily.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210119083617.6337-1-huth@tuxfamily.org> References: <20210119083617.6337-1-huth@tuxfamily.org> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.128.44; envelope-from=th.huth@gmail.com; helo=mail-wm1-f44.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" From: Peter Maydell Make the next_irq function be GPIO inputs to the NEXT_PC device, rather than a freestanding set of qemu_irq lines. This fixes a minor Coverity issue where it correctly points out the trivial memory leak of the memory allocated in the call to qemu_allocate_irqs(). Fixes: CID 1421962 Signed-off-by: Peter Maydell Message-Id: <20210115201206.17347-8-peter.maydell@linaro.org> Signed-off-by: Thomas Huth --- hw/m68k/next-cube.c | 21 ++++----------------- include/hw/m68k/next-cube.h | 3 ++- 2 files changed, 6 insertions(+), 18 deletions(-) -- 2.29.2 diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 9b9b051231..7dcd39aab9 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -735,10 +735,6 @@ static const MemoryRegionOps dma_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -/* - * TODO: set the shift numbers as values in the enum, so the first switch - * will not be needed - */ static void next_irq(void *opaque, int number, int level) { NeXTPC *s = NEXT_PC(opaque); @@ -839,19 +835,8 @@ static void next_irq(void *opaque, int number, int level) } } -static void next_serial_irq(void *opaque, int n, int level) -{ - /* DPRINTF("SCC IRQ NUM %i\n",n); */ - if (n) { - next_irq(opaque, NEXT_SCC_DMA_I, level); - } else { - next_irq(opaque, NEXT_SCC_I, level); - } -} - static void next_escc_init(DeviceState *pcdev) { - qemu_irq *ser_irq = qemu_allocate_irqs(next_serial_irq, pcdev, 2); DeviceState *dev; SysBusDevice *s; @@ -867,8 +852,8 @@ static void next_escc_init(DeviceState *pcdev) s = SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); - sysbus_connect_irq(s, 0, ser_irq[0]); - sysbus_connect_irq(s, 1, ser_irq[1]); + sysbus_connect_irq(s, 0, qdev_get_gpio_in(pcdev, NEXT_SCC_I)); + sysbus_connect_irq(s, 1, qdev_get_gpio_in(pcdev, NEXT_SCC_DMA_I)); sysbus_mmio_map(s, 0, 0x2118000); } @@ -887,6 +872,8 @@ static void next_pc_realize(DeviceState *dev, Error **errp) NeXTPC *s = NEXT_PC(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); + qdev_init_gpio_in(dev, next_irq, NEXT_NUM_IRQS); + memory_region_init_io(&s->mmiomem, OBJECT(s), &mmio_ops, s, "next.mmio", 0xD0000); memory_region_init_io(&s->scrmem, OBJECT(s), &scr_ops, s, diff --git a/include/hw/m68k/next-cube.h b/include/hw/m68k/next-cube.h index 5a56c354b8..d38c52d540 100644 --- a/include/hw/m68k/next-cube.h +++ b/include/hw/m68k/next-cube.h @@ -39,7 +39,8 @@ enum next_irqs { NEXT_ENRX_DMA_I, NEXT_SCSI_DMA_I, NEXT_SCC_DMA_I, - NEXT_SND_I + NEXT_SND_I, + NEXT_NUM_IRQS }; #endif /* NEXT_CUBE_H */