From patchwork Tue Jan 21 15:55:24 2025 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: 858981 Delivered-To: patch@linaro.org Received: by 2002:adf:fb47:0:b0:385:e875:8a9e with SMTP id c7csp265842wrs; Tue, 21 Jan 2025 07:55:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV+XSW/CU0NPm3OWJU/QG+rxJ1srPYZ9dApg0P4ujGVTrFb5TknMZ4wl8YA6jFBzG7Sondtjw==@linaro.org X-Google-Smtp-Source: AGHT+IHaIuXKqOV9vkK5p5ZbkYBrkAxiwiPMUYZKFrotMJur8U8xh0TJRcob61NAb46lDBjYfYlQ X-Received: by 2002:a05:6122:3651:b0:51d:e6f6:deba with SMTP id 71dfb90a1353d-51de6f6e276mr10204348e0c.5.1737474955738; Tue, 21 Jan 2025 07:55:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737474955; cv=none; d=google.com; s=arc-20240605; b=kLtEUPq3OpNBXtYdcsLDjZPTFndxw9W/Wg+keCb6bieIRnH3dopXurowl3Pta/SRxy kIaukyMT5e1pa9CIAAiIGWGYKJAzb+j0/F9c9WFxxlVwpsYPHPi8edjnSYCJkdo72TUL lH56ULp+CqfozsGyjIQ9Fuc4vdGxtgz1vTHSTRD5NkOVu9wrWCXultjmGuVrjtiVuBCS 3Lths8Hu/UF466fzlMSNZUEtfrB0OGnhHu0BThfKIqhJRfIFZz3hDiYkOrytMDeNpL2F aaZU8rv2HRo3KSjSgZqmZzOBsMmhVpnSyxPDGKvJKlRIdC4vnK5uV48mVyqgU8bH+XY1 wMjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=h7fX1pHLOdoQX1u1iC7jxTdcN+u9AigZsBxvTYyjuig=; fh=X49eNotZLAaCp3q1AilLMhBUBp/Lnr0JPN983EpdPPw=; b=gLaItr2yu+KaL1GZeb5FNEQEXOUGt/0j74CmCsClpkJjJEAsFJH+WssntvsZcuxLOH SoZxupRsIYe/CIoIJlkbPp3IDFQCmPCiCPF8/ecBkeLHxdDB8Sy2c4iOMEz/2jwlV0oT ee+8SpBHAiSgPlllhiYjBmG2XNo7kLIDEo+Ndlu9jZbCaD9lXCR44q03TV/WnG6wSKFV /fJgMzEUWxDNWmajBLF/tWc3K3Y3Bw5uxSe/KGbGQ8n9Aomzw1xNiMCxKbWJLpSiCyH1 JfVDc97RjSPqxXF7sAjMq0+kFit7RlXqwHc/7m5o7GA4u9gI65IUPhiBHbumaOOgTPBO RQnQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L11HTGcn; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a1e0cc1a2514c-8642ccdc63csi2878389241.142.2025.01.21.07.55.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Jan 2025 07:55:55 -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; dkim=pass header.i=@linaro.org header.s=google header.b=L11HTGcn; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taGbS-0003tp-GF; Tue, 21 Jan 2025 10:55:47 -0500 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 1taGbM-0003n8-DZ for qemu-devel@nongnu.org; Tue, 21 Jan 2025 10:55:42 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taGbH-0001w8-Je for qemu-devel@nongnu.org; Tue, 21 Jan 2025 10:55:40 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43626213fffso42696205e9.1 for ; Tue, 21 Jan 2025 07:55:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737474933; x=1738079733; darn=nongnu.org; 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=h7fX1pHLOdoQX1u1iC7jxTdcN+u9AigZsBxvTYyjuig=; b=L11HTGcnKtJIMr8rPxNiiozYUppvarUrm1suTswWy6CieDtEzULf3iIG2Ojv20oJ5M EPDvAwWAV66pAG0GjyclLwpN6Z0qXisuVeqTYpTdqn9fbsVPP8+kSBz2xpexfQt9DIwt iyD/f+VZH2PTU3RZJVqRhktBip1zfn1YfoLPqwjgow+OqVUUnp/dSAiynEYN/sfjainQ Zw8BHsN21nmVHJfIw9VL+/I1RHl8lNIYDTgg5s7S36mjhbYH5sahnTqbxQ2Pu4P8ldzw Ysb5/5LJk47d4h8Zz3dSNfOlnSaDHRBm10/88LrS0+jpGHOBre+0luk2VzK66U+UGioh 4++Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737474933; x=1738079733; 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=h7fX1pHLOdoQX1u1iC7jxTdcN+u9AigZsBxvTYyjuig=; b=v28SorcAN9gpwEyBsZuDux+xJy6T2xcndukN9OC/UCHc7gN65rag0s1xRvT8Lycl+Q hVTYI6GIFUYa4SXKO/5UOu4R9TQxTseCSb2l5+RbuceW0nySZO6nZ0lVxLTIoBBbndP7 Jm5wzJ07vjdlXCkb2o4/XuYDYzErBRvFV0SfmjL1iNyZoULeOfref7u8M9PcHCRgsSUk YAXaUsGBrdws/+gU+TAUrYwZeXZ7MdS+N9alzxFWeZZV9ylK7jRZVVjPfFucZzDRUWCH cB3lHpdvzZE3rLITEOQiYlbDg98RVuyDl1C0jmDiqbdiUKNcYF/BzgBnphrmBCrt1cw8 R65w== X-Gm-Message-State: AOJu0Yz4FDiWucE3FZb8B4yOcMMszQuwrg+nj2b9ueIn7i1GrK+TU0bM hLll53Aqvr1T0ERx7a144NzOujog82g6+ER6iK9gDU0CelMmn5hSoFvmqkn1mOSrpBakXiKsTut ixFo= X-Gm-Gg: ASbGnctiC60TtGX5PF5+7HTr8NjaRIE4VSRrPpG3guLqlFBzhYdFUxCGRTotA13ckX9 xqncDtF4K0bfjdNztSbfZkDStMj4Y+g2FtB4Ra8xcxrg0DH0aJTAwxXXZjiWok7iIyzZB5oeo48 xFGhbFVS46BEvp7ZBdNZSWSLfulylv26iprWQtXiUOpbdTSBjndF1ieQTZwFjrydoJtej/DIczb WHb9ttEpnWglHp18p6aoYcijRE2/yf3yuUAO/m+gL2dBHH4LTDz/U4f6Kdrmq2aAs9rhwZWo32n DY79XFOzYxzLRIgiByAGWx98O3Jj/ikDsrWM+2qzjpB1 X-Received: by 2002:adf:9dce:0:b0:38a:88bc:aea6 with SMTP id ffacd0b85a97d-38bec4f592amr15248853f8f.6.1737474932698; Tue, 21 Jan 2025 07:55:32 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf322ac88sm14052137f8f.54.2025.01.21.07.55.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 07:55:32 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alberto Garcia , Bernhard Beschow , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 1/3] hw/irq: Introduce qemu_init_irqs() helper Date: Tue, 21 Jan 2025 16:55:24 +0100 Message-ID: <20250121155526.29982-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250121155526.29982-1-philmd@linaro.org> References: <20250121155526.29982-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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 autolearn=ham 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 While qemu_init_irq() initialize a single IRQ, qemu_init_irqs() initialize an array of them. Suggested-by: Bernhard Beschow Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/hw/irq.h | 11 +++++++++++ hw/core/irq.c | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/include/hw/irq.h b/include/hw/irq.h index c861c1debda..b3012237acd 100644 --- a/include/hw/irq.h +++ b/include/hw/irq.h @@ -41,6 +41,17 @@ static inline void qemu_irq_pulse(qemu_irq irq) void qemu_init_irq(IRQState *irq, qemu_irq_handler handler, void *opaque, int n); +/** + * qemu_init_irqs: Initialize an array of IRQs. + * + * @irq: Array of IRQs to initialize + * @count: number of IRQs to initialize + * @handler: handler to assign to each IRQ + * @opaque: opaque data to pass to @handler + */ +void qemu_init_irqs(IRQState irq[], size_t count, + qemu_irq_handler handler, void *opaque); + /* Returns an array of N IRQs. Each IRQ is assigned the argument handler and * opaque data. */ diff --git a/hw/core/irq.c b/hw/core/irq.c index 7d5b0038c12..6dd8d47bd6e 100644 --- a/hw/core/irq.c +++ b/hw/core/irq.c @@ -49,6 +49,14 @@ void qemu_init_irq(IRQState *irq, qemu_irq_handler handler, void *opaque, init_irq_fields(irq, handler, opaque, n); } +void qemu_init_irqs(IRQState irq[], size_t count, + qemu_irq_handler handler, void *opaque) +{ + for (size_t i = 0; i < count; i++) { + qemu_init_irq(&irq[i], handler, opaque, i); + } +} + qemu_irq *qemu_extend_irqs(qemu_irq *old, int n_old, qemu_irq_handler handler, void *opaque, int n) { From patchwork Tue Jan 21 15:55:25 2025 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: 858982 Delivered-To: patch@linaro.org Received: by 2002:adf:fb47:0:b0:385:e875:8a9e with SMTP id c7csp266160wrs; Tue, 21 Jan 2025 07:56:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUl5iyv8ouvwgy08gWxXVEdsncByBSlzaqRyTSepp4tCrjPXe/qDdgk5OAO34o37i9zXG+/oQ==@linaro.org X-Google-Smtp-Source: AGHT+IFW+nTZUTtI8sblDT2oaC9E5Fg2fWtDbEqLHrNaZ2dyhupuDp4R0hChK2JOu3hzBVMUwFZh X-Received: by 2002:a05:620a:3712:b0:7b6:d998:4fcd with SMTP id af79cd13be357-7be6323cc04mr3570554285a.25.1737475006211; Tue, 21 Jan 2025 07:56:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737475006; cv=none; d=google.com; s=arc-20240605; b=PU+efJfqKVa9N6K3WRoPiJ1FC19pL4VLrVILH0PfGMb+WnVDxZFOVUHZRfmr9P9syP DsvUyecbC6irrQF86OwoilbQE2p9s05w2AMoaYWoXuGrcL4dGw9gJtCMG7ar2dVMCb16 FyeKwrDFvlvv0VaIh8alaDweHVvdx84EljKq8vTwfkP/VOKYO51A/FGzChrDMz+/nJEr PDZ+6WLKrXMtHCgij4kPzMC+ZbRYNtryDEu6jTw40JSsgaOmeORDf78hNVmLIC95bXBK JbG0o5Ht5ecWU+iVnBRsnc5iGyoLS+oJBAeW8sTrayP5N1NpRc7567VVc6m8w87QRZ2d 0Iuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=xQw8hecSqNH6i5kzCWTZhqTCpjqpw+LPVTLqVJJZAzs=; fh=X49eNotZLAaCp3q1AilLMhBUBp/Lnr0JPN983EpdPPw=; b=UNl4SkuzQ8npVB37bg0c32RowFB7zLz/l4UesoDDuEa/H3hw02WVdbVhMPWFCl001O b61JwkxIwf2rnvZ7+2QYcxKltH19bCgT3MY5zyf8QVkArZ2Ur/TuSP4eLn36Bu7SR7W4 w3MAxQtFl+AdGHPcDXwD85mY9rL5IoPPnixFvoNC1zs1Upy1m4YagTV72TPlafayiQyP PZZHPkk0ZrKrRJGmyYjNC1KFprDos2HwEP4xB7NEhLlLGQLwtZfe52DNaVU+1hM87nu/ 1JwwcX1G0KvwhUWrzOvkoOc87gs4m3ete97tjksdhx60QblOr4vUrXdJgBvngAZKDroN wObQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ftWKLLBX; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46e104589c5si136494401cf.404.2025.01.21.07.56.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Jan 2025 07:56:46 -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; dkim=pass header.i=@linaro.org header.s=google header.b=ftWKLLBX; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taGbq-0004Gk-Pj; Tue, 21 Jan 2025 10:56:13 -0500 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 1taGbO-0003qS-OM for qemu-devel@nongnu.org; Tue, 21 Jan 2025 10:55:43 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taGbL-0001wd-AI for qemu-devel@nongnu.org; Tue, 21 Jan 2025 10:55:41 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-435f8f29f8aso42003205e9.2 for ; Tue, 21 Jan 2025 07:55:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737474937; x=1738079737; darn=nongnu.org; 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=xQw8hecSqNH6i5kzCWTZhqTCpjqpw+LPVTLqVJJZAzs=; b=ftWKLLBXMCQTRtU77TxaFPAAJn2HuyfQKt8Yy9U9P0ToBxzW1ahHVRQfqZ/BCBGebS OkRypaH28qSQTj4qz+Nsq1zqvGwzrQMC3DZVi2/I2IHVbC3SAkYfLJJ/ZmERH0fwltGc ygw1dpG92RjFyXeDbaULPLW+nJw16dRoiDabt8toL3a9iSHIP0hnBi13tdZVGfud/uhc /ZySR1lWoKCV5+cYLTOdLKiwze/sj4i7/YbL7PPyGq8ZNY6Ie2vLJ6R4qmo5TbVuHBkI 72iAb42C50/WTBilqJgeyAzmdnBEpD/TT57kXRlrcmq951VdBVHK/h6s82hLiHJCY32C DKTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737474937; x=1738079737; 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=xQw8hecSqNH6i5kzCWTZhqTCpjqpw+LPVTLqVJJZAzs=; b=stKngfJhErVYJnJf71pldow9ltFIBv/tMPzgV61dxUkteKbtafIByokia82GMykyZQ ZkD6tUOkoMNbmAaZ7qitcaDbuuXrCnDTOtFCl8UCkUzNf9Rkm6teDDZ2CEBVWjkjCXh5 KxnhRrQyTGSO6E8MfZJ++f0UdSK8xfiGLT7TT+3ufBC0VNeS5brWcU0eK7VO+ffni10P jYjEGyukKI5k8cJFuJFwkv6fTir1T5xvSp9lfyqK8V8fKLK3yEbMgwkfLyB5qtavotDM 4UBqMQ13UoHmprooqAXvHjgy4NaA702fPF9MUUZsDiIGrdFnLB5w33syeo6kmaMwBbE/ VJjw== X-Gm-Message-State: AOJu0YwR6EzbRrUggExrr+MAkj0CmV9XuDPh2dBVYCJBOXzX/j1eRGTX Hnm4gmGo+9F9Bk/3gQfAVOCKQVWzGBYcH/M1alsrHaya2MOOGst1d3SgYUBZ5Ro2yVbDUGe0U8C UFvA= X-Gm-Gg: ASbGncuGQCqv3hvxVzaIWE5JAlLnhUut4ZM+WaG7d9BJZuMFUzuWf9kFIfbSlP/l0sQ qqrMKqlOcuGc8I8U1HRql1D0doW12MCjBFz9qaA9ssYIRl4px/ifu/hEdoYAQMfwZXMeYkX+pTl D80GPOruRlAh585axaxoB/xfgoI28WYXlK6vklQXhhuo6/kt5RzWl1hEOMh1WHowy4FrQXrTwxs /RypW2nr///4wvCUZiS/OoEUMYu1+egGSh2y1i0rXNEWXEu84HyG184Qna+k5IAnVpgfxAQYCgD qM0/xsFAAbGCd31+jsgtnhcZqdz1y/e6UMm44DoAe0oW X-Received: by 2002:a05:600c:54e4:b0:434:f131:1e64 with SMTP id 5b1f17b1804b1-438913cb735mr163475285e9.9.1737474937218; Tue, 21 Jan 2025 07:55:37 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c7499942sm242499335e9.6.2025.01.21.07.55.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 07:55:36 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alberto Garcia , Bernhard Beschow , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 2/3] hw/ipack: Clarify KConfig symbols Date: Tue, 21 Jan 2025 16:55:25 +0100 Message-ID: <20250121155526.29982-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250121155526.29982-1-philmd@linaro.org> References: <20250121155526.29982-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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 autolearn=ham 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 Split IPACK Kconfig key as {IPACK, TPCI200, IP_OCTAL_232} - IPack is a bus - TPCI200 is a PCI device providing an IPack bus - IP-Octal232 is an IPack device plugged on an IPack bus Signed-off-by: Philippe Mathieu-Daudé --- hw/char/Kconfig | 5 +++++ hw/char/meson.build | 2 +- hw/ipack/Kconfig | 4 ++++ hw/ipack/meson.build | 3 ++- tests/qtest/libqos/meson.build | 4 +++- tests/qtest/meson.build | 4 +++- 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/hw/char/Kconfig b/hw/char/Kconfig index 4b73a803bf3..1dc20ee4c2c 100644 --- a/hw/char/Kconfig +++ b/hw/char/Kconfig @@ -78,3 +78,8 @@ config GOLDFISH_TTY config SHAKTI_UART bool + +config IP_OCTAL_232 + bool + default y + depends on IPACK diff --git a/hw/char/meson.build b/hw/char/meson.build index 1750834385a..ed3529cbbb7 100644 --- a/hw/char/meson.build +++ b/hw/char/meson.build @@ -4,7 +4,7 @@ system_ss.add(when: 'CONFIG_ESCC', if_true: files('escc.c')) system_ss.add(when: 'CONFIG_GRLIB', if_true: files('grlib_apbuart.c')) system_ss.add(when: 'CONFIG_IBEX', if_true: files('ibex_uart.c')) system_ss.add(when: 'CONFIG_IMX', if_true: files('imx_serial.c')) -system_ss.add(when: 'CONFIG_IPACK', if_true: files('ipoctal232.c')) +system_ss.add(when: 'CONFIG_IP_OCTAL_232', if_true: files('ipoctal232.c')) system_ss.add(when: 'CONFIG_ISA_BUS', if_true: files('parallel-isa.c')) system_ss.add(when: 'CONFIG_ISA_DEBUG', if_true: files('debugcon.c')) system_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_uart.c')) diff --git a/hw/ipack/Kconfig b/hw/ipack/Kconfig index f8da24a62be..28d668727c8 100644 --- a/hw/ipack/Kconfig +++ b/hw/ipack/Kconfig @@ -1,4 +1,8 @@ config IPACK bool + +config TPCI200 + bool + select IPACK default y if PCI_DEVICES depends on PCI diff --git a/hw/ipack/meson.build b/hw/ipack/meson.build index 26567f1068e..e4805228926 100644 --- a/hw/ipack/meson.build +++ b/hw/ipack/meson.build @@ -1 +1,2 @@ -system_ss.add(when: 'CONFIG_IPACK', if_true: files('ipack.c', 'tpci200.c')) +system_ss.add(when: 'CONFIG_IPACK', if_true: files('ipack.c')) +system_ss.add(when: 'CONFIG_TPCI200', if_true: files('tpci200.c')) diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build index 46f130ccfdb..1ddaf7b095b 100644 --- a/tests/qtest/libqos/meson.build +++ b/tests/qtest/libqos/meson.build @@ -32,7 +32,6 @@ libqos_srcs = files( 'i2c-omap.c', 'igb.c', 'sdhci.c', - 'tpci200.c', 'virtio.c', 'virtio-balloon.c', 'virtio-blk.c', @@ -70,6 +69,9 @@ endif if config_all_devices.has_key('CONFIG_RISCV_IOMMU') libqos_srcs += files('riscv-iommu.c') endif +if config_all_devices.has_key('CONFIG_TPCI200') + libqos_srcs += files('tpci200.c') +endif libqos = static_library('qos', libqos_srcs + genh, build_by_default: false) diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 94b28e5a534..e60e92fe9de 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -286,7 +286,6 @@ qos_test_ss.add( 'e1000-test.c', 'eepro100-test.c', 'es1370-test.c', - 'ipoctal232-test.c', 'lsm303dlhc-mag-test.c', 'isl_pmbus_vr-test.c', 'max34451-test.c', @@ -317,6 +316,9 @@ qos_test_ss.add( if config_all_devices.has_key('CONFIG_VIRTIO_SERIAL') qos_test_ss.add(files('virtio-serial-test.c')) endif +if config_all_devices.has_key('CONFIG_IP_OCTAL_232') + qos_test_ss.add(files('ipoctal232-test.c')) +endif if host_os != 'windows' qos_test_ss.add(files('e1000e-test.c')) From patchwork Tue Jan 21 15:55:26 2025 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: 858983 Delivered-To: patch@linaro.org Received: by 2002:adf:fb47:0:b0:385:e875:8a9e with SMTP id c7csp266258wrs; Tue, 21 Jan 2025 07:56:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV9Mqneh2WllzIzlbjOgNPhVF+360T9OENMnW78az3ZoqZY5q4NM9SFYvMUwH8L5VdPnmvgTw==@linaro.org X-Google-Smtp-Source: AGHT+IHTqxK2fCIaNlbBG5gdk6qEKyN8BBCdmxHL0zs8NsI62l0wBhyXkEZ+ZR725ZkBJRUjX+9x X-Received: by 2002:a05:620a:440a:b0:7b6:672d:7fc7 with SMTP id af79cd13be357-7be6325fb8amr2932469285a.46.1737475017528; Tue, 21 Jan 2025 07:56:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737475017; cv=none; d=google.com; s=arc-20240605; b=FOAtl/bVJ7D05AiCK6iO0zlDTZDia2oPbBRpybsCfSDCqFUmQlulPFeRdEIL1+KL6a f3aTTms2973O29YsFsskcbWYCa7uQkx74dESEd6Qmm6Tn4sRX2OgQRdgt1JBn7OONNzT uS1JLgVECqcDlXRe93BuGQMgJTuc5jSY1w+O7tXu9SsxRHIReL0AcrnrzXeguP10wSy9 Ogn9VIFKP4qxyzyMiyC6hVGwk6Wk5dYSN7o6yNt3Ec6vSyN/vLRe6WsKQWGjPOIm8bgS GqXCYvMH/MKNoJvH+KqYFGzyGgr1a5un9fDxeS2hjOlBuQCcEplkxE4jwkgHsU29dsYi dy7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=eS948Gr2VsnNjnco9hXr7RbHaTk3SiCQ0lKFo2k/clM=; fh=X49eNotZLAaCp3q1AilLMhBUBp/Lnr0JPN983EpdPPw=; b=LSWKA3XwVTLSt+0eRTzHGZ0cm/6+WOYeNPFgOCE62AdqrjanzULp1pEdezCF/vCO1R BUnqZSRTy5rlGMbvFiB9mB5JnNGtlod3TTI6JgsCjrIR4lYDT4Buxy2G2rjbx59RwNFH 7GdMWz+RP0eUQZ/emTMfKDzfRUhX/O2MLal9iIeXVuO+dS73BSthssRuAhNeqhj+nTiF bJULIjPhkkOExLc12wJ0obOesPokpd83BhlMoLKsQs1jOGllWQs0ufTrHAOSpGCd0Tnk sqZptPPpCIFQzA6qyMA1VSj+dvLghAkvVOa0vwwnz+rXUTOEHcL3Y7myBfdF6rOA8B5u GCsA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rZkiBxPK; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7be614caa1fsi1278648385a.419.2025.01.21.07.56.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Jan 2025 07:56:57 -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; dkim=pass header.i=@linaro.org header.s=google header.b=rZkiBxPK; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taGc1-0004LV-GF; Tue, 21 Jan 2025 10:56:22 -0500 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 1taGbS-0003xH-O9 for qemu-devel@nongnu.org; Tue, 21 Jan 2025 10:55:47 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taGbR-0001xS-2I for qemu-devel@nongnu.org; Tue, 21 Jan 2025 10:55:46 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3863703258fso4610458f8f.1 for ; Tue, 21 Jan 2025 07:55:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737474942; x=1738079742; darn=nongnu.org; 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=eS948Gr2VsnNjnco9hXr7RbHaTk3SiCQ0lKFo2k/clM=; b=rZkiBxPK4YiLMLf29HxL4ArNK+xMTNMQrvRJOgHxGFjX5snjN0uuwbGGgWe6pBfRT+ 8+jtBX8OOFBSJzceMA+zz7d71XmQnw3H52gYPb+hC0o/ZZB30PmaOExGDdJWp2QXOZ2I TK/ZZfO65i/UyZyA5cTqi9LUrINp60R7psMsHfT8fybJDcGf//eVZZ+taAInbR4aB4F1 KoWpYPYYQEB1kmm5K+OrzmFGuUbQFok1fZiiyhcKU82UsgjWAoQBPli/3Z0tRUKmAkwa esucQfdY2QNv3gnjmsI53jvD80U41NpxDHR0wyJLKP8nb3aV9ngYZKz2nVbvYkyQrek+ zVdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737474942; x=1738079742; 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=eS948Gr2VsnNjnco9hXr7RbHaTk3SiCQ0lKFo2k/clM=; b=PUyaq77s6IH+UBkNg5wnTuXWIpOMChszwdqeEbcR28dRPtPOIirhrDy1dE3sgFVf2z HcovcGg8qhrrs1QpbEPbwM8sd/P4FMBn6v73PitAuLyhhUSOk7XREvqWzfwRbONa1cOA CF9AASOU6zuRPHaZy54rBEOtKNATcVyEXc0RtoznXIIVS9vhHNQiwWhlWM2Ygj+bECBU HYqIDkyv4LJ6sZXEdAsspJpwR4uRGwJOKR5PAXozRuHLUioqbQvSlOY88ASrwOr/52OY 90dcK51pQgJokeg0VxJ2PN5oB4R3QRaHIJqkvxzypm9GsdR7glmBUvmKuNt9uYPnXXeY W4Bw== X-Gm-Message-State: AOJu0YwYpiPgHN6x6sBi2gYod5QYTO7GEpW5e0NZ/1Lb2HG4jXwTrEx0 qTOTtoJrG3GR3l8eh1fUNizGYZcnKN/NBqdMlyavW5mEBd7NApmAMsy/sLofNKb8WZh6+cXVG3m vUK0= X-Gm-Gg: ASbGncvt7313qwEvMmhN3Sks+4VKoM6uUlpsBzOEb7SWeDca2psaP7YocylfvTCAgUE OWXbxCT0DMOhRlDITbat5QjBJ65QezOxIwreL9hAxz/AkGOeawg39le/LyuOiNrBaMZEJ+LvUar AyvqUBnO3YulzqOUK9PIgWGP1ve5mTpqNiJlmob/JaOObdV9YZqfD6OTLJ6uyf/ycKw+FnIXH73 KcvQA+1+3PL2Ytt3d0X3caIc+TyC7BnqJ6Iq00vRUeDcjm/OaKTlNnTTJxFKgGAumE+jb1Zqc9d txCeaKRmgcoxs635c8w3bDTlMQBzp5peVjqMFPkCRiP/ X-Received: by 2002:a5d:598d:0:b0:388:c61d:4415 with SMTP id ffacd0b85a97d-38bf5b02ac3mr14856940f8f.18.1737474941719; Tue, 21 Jan 2025 07:55:41 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf3214fc9sm13471098f8f.6.2025.01.21.07.55.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 07:55:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alberto Garcia , Bernhard Beschow , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 3/3] hw/ipack: Remove legacy qemu_allocate_irqs() use Date: Tue, 21 Jan 2025 16:55:26 +0100 Message-ID: <20250121155526.29982-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250121155526.29982-1-philmd@linaro.org> References: <20250121155526.29982-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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 autolearn=ham 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 No need to dynamically allocate IRQ when we know before hands how many we'll use. Declare the 2 of them in IPackDevice state and initialize them in the DeviceRealize handler. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/hw/ipack/ipack.h | 7 ++----- hw/char/ipoctal232.c | 4 ++-- hw/ipack/ipack.c | 5 +---- hw/ipack/tpci200.c | 6 +++--- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/include/hw/ipack/ipack.h b/include/hw/ipack/ipack.h index cbcdda509d3..00f397fd020 100644 --- a/include/hw/ipack/ipack.h +++ b/include/hw/ipack/ipack.h @@ -12,6 +12,7 @@ #define QEMU_IPACK_H #include "hw/qdev-core.h" +#include "hw/irq.h" #include "qom/object.h" @@ -19,10 +20,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(IPackBus, IPACK_BUS) struct IPackBus { - /*< private >*/ BusState parent_obj; - /* All fields are private */ uint8_t n_slots; uint8_t free_slot; qemu_irq_handler set_irq; @@ -58,13 +57,11 @@ struct IPackDeviceClass { }; struct IPackDevice { - /*< private >*/ DeviceState parent_obj; - /*< public >*/ int32_t slot; /* IRQ objects for the IndustryPack INT0# and INT1# */ - qemu_irq *irq; + IRQState irq[2]; }; extern const VMStateDescription vmstate_ipack_device; diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c index d1e5f6dad2e..a2879977fb3 100644 --- a/hw/char/ipoctal232.c +++ b/hw/char/ipoctal232.c @@ -184,9 +184,9 @@ static void update_irq(IPOctalState *dev, unsigned block) unsigned intno = block / 2; if ((blk0->isr & blk0->imr) || (blk1->isr & blk1->imr)) { - qemu_irq_raise(idev->irq[intno]); + qemu_irq_raise(&idev->irq[intno]); } else { - qemu_irq_lower(idev->irq[intno]); + qemu_irq_lower(&idev->irq[intno]); } } diff --git a/hw/ipack/ipack.c b/hw/ipack/ipack.c index ed75f791832..b6defae6025 100644 --- a/hw/ipack/ipack.c +++ b/hw/ipack/ipack.c @@ -55,22 +55,19 @@ static void ipack_device_realize(DeviceState *dev, Error **errp) } bus->free_slot = idev->slot + 1; - idev->irq = qemu_allocate_irqs(bus->set_irq, idev, 2); + qemu_init_irqs(idev->irq, ARRAY_SIZE(idev->irq), bus->set_irq, idev); k->realize(dev, errp); } static void ipack_device_unrealize(DeviceState *dev) { - IPackDevice *idev = IPACK_DEVICE(dev); IPackDeviceClass *k = IPACK_DEVICE_GET_CLASS(dev); if (k->unrealize) { k->unrealize(dev); return; } - - qemu_free_irqs(idev->irq, 2); } static const Property ipack_device_props[] = { diff --git a/hw/ipack/tpci200.c b/hw/ipack/tpci200.c index 88eef4b8308..470a4203ae4 100644 --- a/hw/ipack/tpci200.c +++ b/hw/ipack/tpci200.c @@ -275,11 +275,11 @@ static void tpci200_write_las0(void *opaque, hwaddr addr, uint64_t val, if (ip != NULL) { if (val & STATUS_INT(i, 0)) { DPRINTF("Clear IP %c INT0# status\n", 'A' + i); - qemu_irq_lower(ip->irq[0]); + qemu_irq_lower(&ip->irq[0]); } if (val & STATUS_INT(i, 1)) { DPRINTF("Clear IP %c INT1# status\n", 'A' + i); - qemu_irq_lower(ip->irq[1]); + qemu_irq_lower(&ip->irq[1]); } } @@ -344,7 +344,7 @@ static uint64_t tpci200_read_las1(void *opaque, hwaddr addr, unsigned size) bool int_set = s->status & STATUS_INT(ip_n, intno); bool int_edge_sensitive = s->ctrl[ip_n] & CTRL_INT_EDGE(intno); if (int_set && !int_edge_sensitive) { - qemu_irq_lower(ip->irq[intno]); + qemu_irq_lower(&ip->irq[intno]); } }