From patchwork Wed May 31 22:33:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 687319 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp36641wru; Wed, 31 May 2023 15:35:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6HVO/LsDzua5PiiR3JRexijqohIvD7RK4UkxKdW/dxOQAYbsk6875ulyMtJkQDyslBTFow X-Received: by 2002:ad4:5d46:0:b0:621:363c:ea9f with SMTP id jk6-20020ad45d46000000b00621363cea9fmr10838150qvb.19.1685572516049; Wed, 31 May 2023 15:35:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685572516; cv=none; d=google.com; s=arc-20160816; b=e1ZOqkmN1A+vn9uSuQ/OwTzjC3WnhE7JEu49ICW2+MLjGerxMX2+uNuz7CceXcE7G8 tKFyF8xn8+asluXBqStzZC4PfV7GJMCDBAvWdQulA+AEzmxXbymfmNhxAXOg9sh9RWTb JIr2Y15JifCAmG6XAIGvr2AFPfZz9Ei69/x+BmJXOpyY+OXGb7Ugx0XKxlzzRgd31jjg nu0sxRqbzSzPSJGJ1wNa0EDklgE9qVDIVxYVjg3iYaLt6RRgG/VhGuVisFsmEeo/V2Wy wFecsMRDnIKHdKtsX3YbZAdc9id3gizQN9rgZeM3qfgEl630ACsPPstJEk2dtOJl48pn 4tag== 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:cc:to :from:dkim-signature; bh=huoGF1vYpA+J+Saxjh1v1lIbOm2BUrExA4kLN7TpUYc=; b=yGPAwGX/8EU0ckd6OS2O3ayDUYH5m+mUQGOWZAjSJvuC17ACbOyye0QiDvM7ihhuek bcgWJY/Z4QKIcgEIj3sEjj8v/5SgEHXcARXt3ANpqrf6Q+0k6jsuayqhmCeaXQHcCYB0 pqCven/X1xtN4cusyBSZ6hIHGFQtrczwbf0n+VPCVbkH8GNz2qaF4MtHskOH+AFaende kauswT7M36mC9iYvT7sILF0IGemMo/9V26aImVxD89L7bl/OY4Q/nsxt1KqaISz2YStW uHtUSeD7avAmKQOtY+blrJg1ONKxT2wUFoP7S8tZ30heE088qtYKtN6AouX0NMZuAFeM LjzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="XZ/ae1B+"; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id kc28-20020a056214411c00b0056e9871bbc0si555405qvb.23.2023.05.31.15.35.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 May 2023 15:35:16 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b="XZ/ae1B+"; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q4UOM-0002yC-Iy; Wed, 31 May 2023 18:34:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q4UOL-0002sc-KT for qemu-devel@nongnu.org; Wed, 31 May 2023 18:34:05 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q4UOH-000541-D5 for qemu-devel@nongnu.org; Wed, 31 May 2023 18:34:04 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f60e730bf2so1773465e9.1 for ; Wed, 31 May 2023 15:34:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685572440; x=1688164440; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=huoGF1vYpA+J+Saxjh1v1lIbOm2BUrExA4kLN7TpUYc=; b=XZ/ae1B+AbGLfAiYT+qvhpC/hTbBlAdYbyxYK/eCFXw+MZswDkKYkq7h8JRPg4MLqq nODQkjZA6MWrJXbqtmKLuZ3W5hULG8Q9a9PVg0g+/8cB4Dor5CDrhDx9RuNfzDAZWraW deMLKuOjI4GOzUBJ7zuPBfZeoDwHqIRwc4VQrHmYzWpilCO0QlQ91HjsaZtHMAtASpDh MNsO2KNHEjNqbLXsIBSmM9eC6TMKRvRP4iF678pDHMvkgBeBvE27fVKeO0zoSnWdDXmH +CP+I5F55TOQSBaPRg2ZC8uFuToGmDVup7LOjGOOH5Wwv3Rn9DpLDNcdqtMCTkMbNSZ4 caiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685572440; x=1688164440; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=huoGF1vYpA+J+Saxjh1v1lIbOm2BUrExA4kLN7TpUYc=; b=YqqvSAgRw+MnPn8Dm16RC1D6FNHPr86DSna76Q9EEkSoMcUwNpHTCv0QgULZ+qtIco /9keToLiAzPaBaZskBrHTEd0jQufgBBxmOi3x29kfe7yQ9YaGmBc4eI60UwJvvR/FF4I ZxnzqSgjd58zlRevykMnmsbeJwqrxl09EFGcLbwjDYHu4NcA+09ANXBmJky/XGRW4dz9 XPFvj3eu3iJPjvGAvydgC8bG50RkxNinV3Cz2ZwsDgu4iSzRi777+UY97+PGEVWQd2gN FnfItp/JVlh64wYZbKt7GnPosf9Gyw6dEPGSJyuL00gQ7HgRE8og6IkkhVS0UFFJppxq Au9Q== X-Gm-Message-State: AC+VfDxVMtmb3q73z8rxrwvAReTMlLibDZqXzhhhulJJHTqVbaIJNdJ0 2yoH2CS2ou7MPAkzVldC720eF1Ft7WA38TEIdRM= X-Received: by 2002:a05:600c:114f:b0:3f5:ce4:6c3f with SMTP id z15-20020a05600c114f00b003f50ce46c3fmr611316wmz.7.1685572439802; Wed, 31 May 2023 15:33:59 -0700 (PDT) Received: from localhost.localdomain ([176.176.146.12]) by smtp.gmail.com with ESMTPSA id b9-20020adfe309000000b003079986fd71sm8325422wrj.88.2023.05.31.15.33.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 31 May 2023 15:33:59 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , Markus Armbruster , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Mark Cave-Ayland , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 3/7] hw/sysbus: Introduce sysbus_init_irqs() Date: Thu, 1 Jun 2023 00:33:37 +0200 Message-Id: <20230531223341.34827-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230531223341.34827-1-philmd@linaro.org> References: <20230531223341.34827-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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 The SysBus API currently only provides a method to initialize a single IRQ: sysbus_init_irq(). When we want to initialize multiple SysBus IRQs, we have to call this function multiple times. In order to allow further simplifications, introduce the sysbus_init_irqs() method. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/hw/sysbus.h | 1 + hw/core/sysbus.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index 3564b7b6a2..bc174b2dc3 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -70,6 +70,7 @@ typedef void FindSysbusDeviceFunc(SysBusDevice *sbdev, void *opaque); void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory); MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n); void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p); +void sysbus_init_irqs(SysBusDevice *dev, qemu_irq *p, unsigned count); void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target); void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size); diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 35f902b582..a1b4c362c9 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -175,10 +175,15 @@ void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr, sysbus_mmio_map_common(dev, n, addr, true, priority); } +void sysbus_init_irqs(SysBusDevice *dev, qemu_irq *p, unsigned count) +{ + qdev_init_gpio_out_named(DEVICE(dev), p, SYSBUS_DEVICE_GPIO_IRQ, count); +} + /* Request an IRQ source. The actual IRQ object may be populated later. */ void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p) { - qdev_init_gpio_out_named(DEVICE(dev), p, SYSBUS_DEVICE_GPIO_IRQ, 1); + sysbus_init_irqs(dev, p, 1); } /* Pass IRQs from a target device. */