From nobody Tue Feb 10 12:59:57 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1648146007370809.4874229394225; Thu, 24 Mar 2022 11:20:07 -0700 (PDT) Received: from localhost ([::1]:58978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nXS45-00088R-UM for importer@patchew.org; Thu, 24 Mar 2022 14:20:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nXS0M-0005ql-2N for qemu-devel@nongnu.org; Thu, 24 Mar 2022 14:16:14 -0400 Received: from [2607:f8b0:4864:20::431] (port=34455 helo=mail-pf1-x431.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nXS0K-00033E-KL for qemu-devel@nongnu.org; Thu, 24 Mar 2022 14:16:13 -0400 Received: by mail-pf1-x431.google.com with SMTP id h19so3602945pfv.1 for ; Thu, 24 Mar 2022 11:16:11 -0700 (PDT) Received: from dev.lizongyuan.local ([103.177.44.101]) by smtp.gmail.com with ESMTPSA id u10-20020a17090a2b8a00b001c6594e5ddcsm3577725pjd.15.2022.03.24.11.16.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Mar 2022 11:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5SrYGGx56D5KZCgDRAE+ARenQHiw5A2xBeYHRC7blJI=; b=rDHG9AqpGCyEQHWiSxi8VCe4kJs2bIUZHzrzyG/78OW+dLVWl7qmiBYd5d2/Cz7xwP 57KwaiNe7DdQDwMOG4GWWnZeG4QE+bsAsaSRMKqpiAD4+3e4MH+FMkNbvAZgTP/QU2oE SvoXiNPFK81biDCvluJvePFLmKa+kjfo5yTm0nI5I3BdR5XDCtMQSjYoEvtad3fem9EC 8yxpX5myPgo1EyE6AInA1jw4xxBhvK4m1lujj+WEy837dNszGND1rhNhpjBVt0kjANea 7LCNTA5dfntHwXgEkISSyCRDGDV0ZhXHLayp+Tr22GDfZaAdIL3Lyaa4dKAq4mLzshxL tf0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5SrYGGx56D5KZCgDRAE+ARenQHiw5A2xBeYHRC7blJI=; b=nUaj1Kn8ta7olWLO8/URF6zSqIaLJAGR2KHn/trBUjaBgcRL1YPyayyrkFuY9zh5Di 4tyrYD/ExvjhhsoPeLtFAZisKhSVy8fnvQhfi5D27uxMCo2wgrfho+d8nXfNII3ZxrWk 9FLzEx235DgdgelaTOxy5cTtzHLEj66q8KroHYaitMDxjsJydJdxI1SNpBXDWqzx0Njp EqQPDZ0jNsWlly2EQDAqkLIFofErjDqsnsEH3BV2Yd/CvNIzTIIk02/6okLCj6JPntIa YBzaOH+1zmWHL7Q/WaJyylAIw0oa5LlcmyNkA4Fk+qhOsGJxON4hAX5UnihhcfuXVhcD 5a1A== X-Gm-Message-State: AOAM530ZgYEw6Lh7L5e3W/J7IBtLjmdU4i7U7S5OmxGNnI9x+yT6P8y4 zuwQ/ImP2eaVHCpmNOaiUgsx0tBeIQUaag== X-Google-Smtp-Source: ABdhPJwpSz3xLGe3oOZ0PZsFrh+ZXI+QqWL0xL8vit6tT7rD0dKLyHEruJHVF9VB2HbN6lSeoaUJmQ== X-Received: by 2002:a65:424a:0:b0:375:6d8b:8d44 with SMTP id d10-20020a65424a000000b003756d8b8d44mr5055867pgq.170.1648145770176; Thu, 24 Mar 2022 11:16:10 -0700 (PDT) From: Zongyuan Li To: qemu-devel@nongnu.org Subject: [PATCH v5 1/4] hw/arm/realview: replace 'qemu_split_irq' with 'TYPE_SPLIT_IRQ' Date: Fri, 25 Mar 2022 02:15:54 +0800 Message-Id: <20220324181557.203805-2-zongyuan.li@smartx.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220324181557.203805-1-zongyuan.li@smartx.com> References: <20220324181557.203805-1-zongyuan.li@smartx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::431 (failed) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::431; envelope-from=zongyuan.li@smartx.com; helo=mail-pf1-x431.google.com X-Spam_score_int: 29 X-Spam_score: 2.9 X-Spam_bar: ++ X-Spam_report: (2.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: Peter Maydell , "open list:Real View" , Zongyuan Li Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1648146009519100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Zongyuan Li Reviewed-by: Peter Maydell --- hw/arm/realview.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 7b424e94a5..d2dc8a8952 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -13,9 +13,11 @@ #include "hw/sysbus.h" #include "hw/arm/boot.h" #include "hw/arm/primecell.h" +#include "hw/core/split-irq.h" #include "hw/net/lan9118.h" #include "hw/net/smc91c111.h" #include "hw/pci/pci.h" +#include "hw/qdev-core.h" #include "net/net.h" #include "sysemu/sysemu.h" #include "hw/boards.h" @@ -53,6 +55,20 @@ static const int realview_board_id[] =3D { 0x76d }; =20 +static void split_irq_from_named(DeviceState *src, const char* outname, + qemu_irq out1, qemu_irq out2) { + DeviceState *splitter =3D qdev_new(TYPE_SPLIT_IRQ); + + qdev_prop_set_uint32(splitter, "num-lines", 2); + + qdev_realize_and_unref(splitter, NULL, &error_fatal); + + qdev_connect_gpio_out(splitter, 0, out1); + qdev_connect_gpio_out(splitter, 1, out2); + qdev_connect_gpio_out_named(src, outname, 0, + qdev_get_gpio_in(splitter, 0)); +} + static void realview_init(MachineState *machine, enum realview_board_type board_type) { @@ -66,7 +82,6 @@ static void realview_init(MachineState *machine, DeviceState *dev, *sysctl, *gpio2, *pl041; SysBusDevice *busdev; qemu_irq pic[64]; - qemu_irq mmc_irq[2]; PCIBus *pci_bus =3D NULL; NICInfo *nd; DriveInfo *dinfo; @@ -229,14 +244,14 @@ static void realview_init(MachineState *machine, * and the PL061 has them the other way about. Also the card * detect line is inverted. */ - mmc_irq[0] =3D qemu_irq_split( - qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT), - qdev_get_gpio_in(gpio2, 1)); - mmc_irq[1] =3D qemu_irq_split( - qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN), - qemu_irq_invert(qdev_get_gpio_in(gpio2, 0))); - qdev_connect_gpio_out_named(dev, "card-read-only", 0, mmc_irq[0]); - qdev_connect_gpio_out_named(dev, "card-inserted", 0, mmc_irq[1]); + split_irq_from_named(dev, "card-read-only", + qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT), + qdev_get_gpio_in(gpio2, 1)); + + split_irq_from_named(dev, "card-inserted", + qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN), + qemu_irq_invert(qdev_get_gpio_in(gpio2, 0))); + dinfo =3D drive_get(IF_SD, 0, 0); if (dinfo) { DeviceState *card; --=20 2.34.0