From patchwork Thu Jun 1 09:46:21 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: 687698 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp239851wru; Thu, 1 Jun 2023 02:48:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6OpaAVT4EqG/PNcKqFtztvValzAAUQ/TWjOQosye+3BYQx/nqTP55/RrdrZTiUphzxDKBD X-Received: by 2002:a05:620a:8ac4:b0:75b:23a0:d9ba with SMTP id qv4-20020a05620a8ac400b0075b23a0d9bamr6893520qkn.16.1685612902378; Thu, 01 Jun 2023 02:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685612902; cv=none; d=google.com; s=arc-20160816; b=Jh2oNnYKEr8sJe9Ciu8UBKZEQj4UO7lCWhoJUZ8W5jH+IDbNY2ItGRE997sQ1n0msj rcQEDLmOxxuVVKiqAz9+K9YJ08hjIG9Ny/55l5gavzM9jhq02ID3wkipRrVC3/tS3cDw 281E5WstRJBMKj4CWGsPIqeHs4Cxx3vw3qavjj/8CcJNgmG3NvZDLlhHn8NEEeJo+Kpp 8F4//z3sj/DyIEgP6XdJHcGornTdGh+1YBod7rWPKiMW+sjL8m10/SYwNZaUk4XMGNQi z7N1/fL9y2blHTPjsRHGtw+tRilvu84AVPlXfBxLbbq23TOiKCQUWSHNQklQKy5jwJat 1G9Q== 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=1Fxf+SZnw4PIJBwyheZ5LFEtj2ykqgNetOmC+XmhM6A=; b=FaELOumxftAqjrbogrTWOnOYYOFOdDnNLjMhElbmUIOOE50Iiw4s/kyws1zXb6r2Qn UP0pkp54xQnunilh5puELhELaTT5NQd8FIjFAznU/QvL+kMQ286+RdGcrRIoaUjVmAbt jCh1f2O+EvB9MN+mh5dnBUpxWtdzxZuQtczZRwm4SkDhFsqkLoRpnvFDsWABcG6hTL3D DHUqYjGcIhPXUBvxyqPA5CMylVJ2c6YJdC0CG6vQY0E/czACwy8wErLUc/D7dMU0t5VA oWmpabjyxZFtkeKcv68xZzEYWg2WMNqsVLoJ/jQwyk0nu4feTcwX/VVrDJNf7TWIfRLo nxpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YlBTXBwn; 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 c9-20020ae9e209000000b007595c2bb085si5350199qkc.259.2023.06.01.02.48.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jun 2023 02:48:22 -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=YlBTXBwn; 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 1q4etQ-0004lx-Rh; Thu, 01 Jun 2023 05:46:52 -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 1q4etM-0004l9-VK for qemu-devel@nongnu.org; Thu, 01 Jun 2023 05:46:48 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q4etK-0004F3-7e for qemu-devel@nongnu.org; Thu, 01 Jun 2023 05:46:48 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3f60e536250so14560315e9.1 for ; Thu, 01 Jun 2023 02:46:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685612804; x=1688204804; 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=1Fxf+SZnw4PIJBwyheZ5LFEtj2ykqgNetOmC+XmhM6A=; b=YlBTXBwnaD/PIPk9893Cv4vi/8MuzsGTK0l1d4NvZS5Gtdp/Zt8GhJHNAo82MwtVZJ BGNxauwXMiPzWYds4g/HuWfJTb8+pwugxMCv/FrKMi34u8J2KtucLxiNols5fOUcRFrs jUEBChfTzNXbeDbQQ84evcqg//XLqIL223TzqsoZH8JrNikyp3VjjyBgV23dfN45bZWI qX+1As9DM2Vu7HtCWqb2v/altGVauCsV3Yg/mmLep8iMMPzubFKjjjaHZkiWgQVdHYBh 2slE0xeYpa/QalGpUZYdOYw7pH66f+BYdaOyy/SLTc6tdxL8HTK5bABCXxM4c5Pho6Nv j3Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685612804; x=1688204804; 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=1Fxf+SZnw4PIJBwyheZ5LFEtj2ykqgNetOmC+XmhM6A=; b=PlGvlVe0Uw3Tdo094qM2eesZcVhPYnIQJ6I4K860mFl+VLOIl65XuSz3MEknHstylB wPCLwcjB78IdU2CiyxS7hIfMPGoc/CMAmg46xFuY68F7eqwR5Cyn/mNvBPW+6DeJRA24 QdzD2gAnULZJxP3g+6enb5X0i9Ff+BV9+KyqGU01u8B0cNGVkFGVFua5JUu07P6i+pgU 0BLgJxaCYNKleX0TIkMc8RPiH5rZ8vw81dc7oQzrQygU9QYekahKEilpmR2zqhGe0d6n +XQKDomB861OwZKAYAjc4xwfzIYYJlP4XL4FCOfZ2dm8HDOW9/av6FmOnAX6Akw6dMx6 Ee3g== X-Gm-Message-State: AC+VfDysl4WpMJ9DjoiG/HjLv4LactCyccGp4Kvy30vt0ED0mATSy2La G65K5TDfiHk4lq7W5BQrzHHCJ2KsJKsF9qLgJCk= X-Received: by 2002:a05:600c:15d4:b0:3f6:117c:b8a1 with SMTP id v20-20020a05600c15d400b003f6117cb8a1mr1149973wmf.6.1685612804581; Thu, 01 Jun 2023 02:46:44 -0700 (PDT) Received: from localhost.localdomain ([176.176.141.224]) by smtp.gmail.com with ESMTPSA id c15-20020a7bc00f000000b003f4fffccd73sm1724741wmb.9.2023.06.01.02.46.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 01 Jun 2023 02:46:44 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Thomas Huth , Markus Armbruster , qemu-ppc@nongnu.org, Eduardo Habkost , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 3/7] hw/sysbus: Introduce sysbus_init_irqs() Date: Thu, 1 Jun 2023 11:46:21 +0200 Message-Id: <20230601094625.39569-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230601094625.39569-1-philmd@linaro.org> References: <20230601094625.39569-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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. */