From nobody Thu Jan 23 05:46:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1737476335; cv=none; d=zohomail.com; s=zohoarc; b=E7iRwdBJk/wrNSYAQDm6ZZ8e66ZYWPrzBfT7b8PCwwAx81RNKeFTnzlJD5FxkARYD4V/Joy625qGix3LxfL3zW+Zxm0XTheeJ97kG2pUSJPktAswcWUF+hEcEf8lk+tQr4QydOt117Ken0P0e3nUMcFUXVipRFxDJshrH1fMg+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737476335; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+2sEtAFoFWHQ01p5+N4SGtbcml5iyx/5IH+2u55pyYU=; b=fTXpft/zgYfV5V/ySy8YxC0AjruVPpXzvr6F5B/nmBEYFUOOXW+ZDQ38y2vKITpBjU8ImyOPkvZzA6TJDksJoXYLUHXl5pR5v5otdy2ikMPbWpmu9Wai1EBQDm+/J9a5EpT+Z/4242XfZvpzoQkZJUPxO6w0x6PpgNCK+k5eJvU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737476335361776.2842028456743; Tue, 21 Jan 2025 08:18:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taGxU-0000NY-Jh; Tue, 21 Jan 2025 11:18:32 -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 1taGxP-0000Lu-ML for qemu-devel@nongnu.org; Tue, 21 Jan 2025 11:18:28 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taGxN-0005zT-R6 for qemu-devel@nongnu.org; Tue, 21 Jan 2025 11:18:27 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-436a39e4891so40398045e9.1 for ; Tue, 21 Jan 2025 08:18:25 -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-38bf322ad81sm13927504f8f.52.2025.01.21.08.18.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 08:18:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737476304; x=1738081104; 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=+2sEtAFoFWHQ01p5+N4SGtbcml5iyx/5IH+2u55pyYU=; b=uWmqTyWAUkYeY11VIzZzNu6dkww2abQGqIPyIPcJiT6iiW53J9mPvCLcIzMHdPWed/ ML+nUUvEiFtIwCYzDqmDCzqblnJaybxjbp2oEwbmSUMeKU9KIVb1OZYhr6KlSe+4CTF4 vKWsJq95jnDlc4UmFwkPYZXZwN3gIi6554wGS0Wb8pmeRnL5lZ5HugUhq+5sZxWQyypv /m7H8IiTSem7UbSuPqg41JabIt6WMpfoydt/Vo08cFK9kToYxjJFkEjpbWMX2lKNwX/W kB2CzQmPfPtZm6oAfZrdg59+qbAYx4stB3j/87uUnkga/Ac3bZfoUvRGSZbC5w5hIoJP GgVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737476304; x=1738081104; 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=+2sEtAFoFWHQ01p5+N4SGtbcml5iyx/5IH+2u55pyYU=; b=C9ihxdttRYUrRaryyyHTAz+lBiwy7TgWcVAr2/d076BgNbu407y9OVZ3YZ9sFFI9wM 79Q41Th2t/uBU7WocGjUbpBBnBETmS0yiCBOEHO5NODBvCBjhRjs8rm/ifIwKAemy6Po rOHC28+sVBuyx7xOo05REmTQK5jHo8bxI9f2pMD1zQMPYndn0oRVusvDmbeYAb43WA1R AXDahb9CafE+QlBhRE9mipAcBdIQYK+GXZoV4mnRPelXI+QTKvDaiP5TDJxf/OmK5Eks XRWTkmnGn5YUTEDGoJzgEzVE+Egk4vcgPrsykJyw/wcVMsZpkUbDQh+68rG7MmkAgN+q iZdQ== X-Gm-Message-State: AOJu0Yy2VX4pZgFneBIYfGHYSBOUfD3vVE8GqMpFOThqhCyHfUoU01Zc flXTvoACMo7NBBKL6to7o7PZSRp1aTWaageIIylMzvTlnrfKGc5qQJ6k9R/gNFDd7L7k5akkumm nojM= X-Gm-Gg: ASbGncsZiYgTIpaIR3srxQdevKrIrCzoRYSiTF0Ju30Hn63Wvr3It+X8v5ACJU71yqt MjceuVr8Q96zoVZNRKZrM2dbetWECOwgNoWkdMOBkDrpXK1q2zFRZDagkpbVrwl9HIC7J1/+HGn XSHZ5Wbr5khMuD0bWVtUfT2vd9yQfAe/tNrwRfgmaZ+8QlrMXLuVvWR4L2vUZOCS2/7Ld2CPT1O iq8zUL5j79jZAOiTnJNlHqOB4o/cbyqoLGCUZxb8rfHnLsUBlmhiiVJiz2BTQ6i3nOcvYQcKtIc A8ze0qmxYXCkuGz4mvhp+MuF5N/GZx9d2nloCtn9Q2ge X-Google-Smtp-Source: AGHT+IHVqbmzrHpbpgLX2XakH9ckSR0ikqCPW62HV7ihCVZEp/lxxvZN70vOCdo3IgRSKmMJZzamwA== X-Received: by 2002:adf:f1cc:0:b0:38b:ed88:f045 with SMTP id ffacd0b85a97d-38bf566fb1bmr14177124f8f.33.1737476303934; Tue, 21 Jan 2025 08:18:23 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Rikalo , Jiaxun Yang , Bernhard Beschow , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Huacai Chen , Aurelien Jarno Subject: [PATCH 1/6] hw/pci-host/bonito: Expose output IRQ as QDev GPIO Date: Tue, 21 Jan 2025 17:18:12 +0100 Message-ID: <20250121161817.33654-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250121161817.33654-1-philmd@linaro.org> References: <20250121161817.33654-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1737476337820019000 Expose IRQ using qdev_init_gpio_out() in bonito_host_realize(), wire it using qdev_connect_gpio_out() in bonito_init(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/mips/mips.h | 2 +- hw/mips/fuloong2e.c | 2 +- hw/pci-host/bonito.c | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/hw/mips/mips.h b/include/hw/mips/mips.h index 101799f7d3e..1176291cca6 100644 --- a/include/hw/mips/mips.h +++ b/include/hw/mips/mips.h @@ -10,7 +10,7 @@ #include "exec/memory.h" =20 /* bonito.c */ -PCIBus *bonito_init(qemu_irq *pic); +PCIBus *bonito_init(qemu_irq irq); =20 /* rc4030.c */ typedef struct rc4030DMAState *rc4030_dma; diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 16b6a5129e7..160ceb769dc 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -282,7 +282,7 @@ static void mips_fuloong2e_init(MachineState *machine) cpu_mips_clock_init(cpu); =20 /* North bridge, Bonito --> IP2 */ - pci_bus =3D bonito_init((qemu_irq *)&(env->irq[2])); + pci_bus =3D bonito_init(env->irq[2]); =20 /* South bridge -> IP5 */ pci_dev =3D pci_new_multifunction(PCI_DEVFN(FULOONG2E_VIA_SLOT, 0), diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index 49669148923..6bc66c9e227 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -234,7 +234,7 @@ typedef struct PCIBonitoState PCIBonitoState; =20 struct BonitoState { PCIHostState parent_obj; - qemu_irq *pic; + qemu_irq irq; PCIBonitoState *pci_dev; MemoryRegion pci_mem; }; @@ -554,17 +554,16 @@ static const MemoryRegionOps bonito_spciconf_ops =3D { static void pci_bonito_set_irq(void *opaque, int irq_num, int level) { BonitoState *s =3D opaque; - qemu_irq *pic =3D s->pic; PCIBonitoState *bonito_state =3D s->pci_dev; int internal_irq =3D irq_num - BONITO_IRQ_BASE; =20 if (bonito_state->regs[BONITO_INTEDGE] & (1 << internal_irq)) { - qemu_irq_pulse(*pic); + qemu_irq_pulse(s->irq); } else { /* level triggered */ if (bonito_state->regs[BONITO_INTPOL] & (1 << internal_irq)) { - qemu_irq_raise(*pic); + qemu_irq_raise(s->irq); } else { - qemu_irq_lower(*pic); + qemu_irq_lower(s->irq); } } } @@ -631,6 +630,7 @@ static void bonito_host_realize(DeviceState *dev, Error= **errp) BonitoState *bs =3D BONITO_PCI_HOST_BRIDGE(dev); MemoryRegion *pcimem_lo_alias =3D g_new(MemoryRegion, 3); =20 + qdev_init_gpio_out(dev, &bs->irq, 1); memory_region_init(&bs->pci_mem, OBJECT(dev), "pci.mem", BONITO_PCIHI_= SIZE); phb->bus =3D pci_register_root_bus(dev, "pci", pci_bonito_set_irq, pci_bonito_map_ir= q, @@ -734,7 +734,7 @@ static void bonito_pci_realize(PCIDevice *dev, Error **= errp) pci_set_byte(dev->config + PCI_MAX_LAT, 0x00); } =20 -PCIBus *bonito_init(qemu_irq *pic) +PCIBus *bonito_init(qemu_irq irq) { DeviceState *dev; BonitoState *pcihost; @@ -745,8 +745,8 @@ PCIBus *bonito_init(qemu_irq *pic) dev =3D qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE); phb =3D PCI_HOST_BRIDGE(dev); pcihost =3D BONITO_PCI_HOST_BRIDGE(dev); - pcihost->pic =3D pic; sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + qdev_connect_gpio_out(dev, 0, irq); =20 d =3D pci_new(PCI_DEVFN(0, 0), TYPE_PCI_BONITO); s =3D PCI_BONITO(d); --=20 2.47.1