From nobody Fri Nov 7 09:14:50 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609413736; cv=none; d=zohomail.com; s=zohoarc; b=ccklnPvoO3EMk8/fPCSMMcXQe0szorMf3SaysuelAk0lN+1RQivtvDv70KfR/7jlojJq2psYQxEgBgEhcl11YnjknMkpdStTrImdPNZq1qEO7lklsR7q0xXvGJUBlFoO1Ts6/ECahCg1nZce2HNgN3Se6aaGj5OAy2rVwdYRFHI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609413736; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=W3TaPg63qdiDVK9O8ny+f/GxzWCeg+r0Rb27Tmb8ftI=; b=c9CbCl8uXJBIZ/BLBzgcPDdRO7vy/i4tzmk2dE3Ynd75fQURWkUGsmopG4zxVnkA7sE7+wPnt6AViNsSG9dkXVs9PIEm7MXZTWyOOZZTg2tXuT8ps/i7eFETgb2yBLSQnxZZNGzf/qlt4W4om+4JTiU2awLTBFChu2MxqmeBsms= ARC-Authentication-Results: i=1; mx.zohomail.com; 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609413736039283.28527237410105; Thu, 31 Dec 2020 03:22:16 -0800 (PST) Received: from localhost ([::1]:55686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kuw22-00038C-Re for importer@patchew.org; Thu, 31 Dec 2020 06:22:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuw0U-0001XP-Bn; Thu, 31 Dec 2020 06:20:38 -0500 Received: from zero.eik.bme.hu ([152.66.115.2]:48351) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuw0R-0003eZ-MA; Thu, 31 Dec 2020 06:20:37 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id AE05F7470EC; Thu, 31 Dec 2020 12:20:30 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 3016C7470EB; Thu, 31 Dec 2020 12:20:30 +0100 (CET) Message-Id: <9c0b7267edf1dc4624702a29101154a8910682f2.1609413115.git.balaton@eik.bme.hu> In-Reply-To: References: Subject: [PATCH v2 1/3] ppc4xx: Move common dependency on serial to common option Date: Thu, 31 Dec 2020 12:11:55 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org X-Spam-Probability: 8% 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=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Mark Cave-Ayland , Guenter Roeck , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan From: BALATON Zoltan via Content-Type: text/plain; charset="utf-8" All machines that select SERIAL also select PPC4XX so we can just add this common dependency there once. Signed-off-by: BALATON Zoltan --- hw/ppc/Kconfig | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig index dd86e664d2..8548f42b0d 100644 --- a/hw/ppc/Kconfig +++ b/hw/ppc/Kconfig @@ -37,7 +37,6 @@ config PPC405 select M48T59 select PFLASH_CFI02 select PPC4XX - select SERIAL =20 config PPC440 bool @@ -46,13 +45,13 @@ config PPC440 imply E1000_PCI select PCI_EXPRESS select PPC4XX - select SERIAL select FDT_PPC =20 config PPC4XX bool select BITBANG_I2C select PCI + select SERIAL =20 config SAM460EX bool @@ -61,7 +60,6 @@ config SAM460EX select IDE_SII3112 select M41T80 select PPC440 - select SERIAL select SM501 select SMBUS_EEPROM select USB_EHCI_SYSBUS @@ -123,7 +121,6 @@ config VIRTEX bool select PPC4XX select PFLASH_CFI01 - select SERIAL select XILINX select XILINX_ETHLITE select FDT_PPC --=20 2.21.3 From nobody Fri Nov 7 09:14:50 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609413808; cv=none; d=zohomail.com; s=zohoarc; b=L/Av2/nKY4hN7yoigNled5lct53rk/RU0qJ2fddeSFzQSU9i1ilsJBVlz8SuTE9eavYqxLN6k7KuC2Yo3yQ17606k3rBwKHjWwo9KZMYYnkmTfEvcBcGUZKviyDxUdKZJhjGAaxt3TQf4yh3G4CX/ItGSRyEsa0IXww8za3SW+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609413808; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=5tgAWsMAVpUf4vENyT3H7k2MxihUjCzWlwIYBEOqVlQ=; b=L3BWAxnMIRZiWo9XF06XpP46zgvXUnmP2cBmWVKdYCH52CQJf6a1ebDjsVXKBxLPZbARPleIK13XB4WQp9g/6fFZNN2iv2GAwW2nIM52fXYpRP5UrTWGb8ZgN49Uj/8r71OnPes9wZkRNVIQuzM8J4MMQi8IeYI0xXPrWP4OM+A= ARC-Authentication-Results: i=1; mx.zohomail.com; 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609413808969958.2689457338521; Thu, 31 Dec 2020 03:23:28 -0800 (PST) Received: from localhost ([::1]:59474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kuw3C-0004f7-Rs for importer@patchew.org; Thu, 31 Dec 2020 06:23:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuw0X-0001aA-Ci; Thu, 31 Dec 2020 06:20:41 -0500 Received: from zero.eik.bme.hu ([152.66.115.2]:48358) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuw0V-0003hU-UB; Thu, 31 Dec 2020 06:20:41 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id DA6067470E3; Thu, 31 Dec 2020 12:20:37 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 35FEF7470EF; Thu, 31 Dec 2020 12:20:30 +0100 (CET) Message-Id: In-Reply-To: References: Date: Fri, 25 Dec 2020 21:12:15 +0100 Subject: [PATCH v2 2/3] sam460ex: Remove FDT_PPC dependency from KConfig Date: Thu, 31 Dec 2020 12:11:55 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org X-Spam-Probability: 9% 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=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: 3 X-Spam_score: 0.3 X-Spam_bar: / X-Spam_report: (0.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, INVALID_DATE=1.096, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Mark Cave-Ayland , Guenter Roeck , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan From: BALATON Zoltan via Content-Type: text/plain; charset="utf-8" Dependency on FDT_PPC was added in commit b0048f76095 ("hw/ppc/Kconfig: Only select FDT helper for machines using it") but it does not seem to be really necessary so remove it again. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- v2: Do not remove PPC405, reworded commit message hw/ppc/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig index 8548f42b0d..f1e1be208e 100644 --- a/hw/ppc/Kconfig +++ b/hw/ppc/Kconfig @@ -64,7 +64,6 @@ config SAM460EX select SMBUS_EEPROM select USB_EHCI_SYSBUS select USB_OHCI - select FDT_PPC =20 config PREP bool --=20 2.21.3 From nobody Fri Nov 7 09:14:50 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1609413740; cv=none; d=zohomail.com; s=zohoarc; b=FAmpTTaxt02BZItkEC1twCrytA3Dg25vMfgKje0EGTB0FajCPZlA5HzoxWwE6bz6JbcS2YWW+7ICGT+TrlKy5U7IQ4nN4p50XJIYhkynrunVyBuMBXwqF/h6g1wYtmwEmIFubIouXa6XOSzWA1i3ts7aOIioTyZXu9u6nN2HHps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609413740; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=BOjZmjI0s5DMnIeanbHkGbST9PThZArVNrObP+NKlQI=; b=lHqmBfR1ykkzal5BCTZNy97cST0qqBXo1wyJXAoGWDjXlAbqKz0+ZFVdoSoQWtGwtr7sb96VDltvv6Tlxybjp3SsSZ6ApudXvJqFwgJ0Ul8IZDmpF+IT/U8XTBKEvDZ3PG8zGzN0EEWzteuGfa/quqsSCBTyB6fACsGMsR/aPpk= ARC-Authentication-Results: i=1; mx.zohomail.com; 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609413740420190.94935381892935; Thu, 31 Dec 2020 03:22:20 -0800 (PST) Received: from localhost ([::1]:56092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kuw27-0003I7-3E for importer@patchew.org; Thu, 31 Dec 2020 06:22:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuw0X-0001aE-DS; Thu, 31 Dec 2020 06:20:41 -0500 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:48361) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kuw0V-0003hV-GE; Thu, 31 Dec 2020 06:20:41 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 0EA237470EB; Thu, 31 Dec 2020 12:20:38 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 3B13B7470E7; Thu, 31 Dec 2020 12:20:30 +0100 (CET) Message-Id: <6892fc8ac57283bf7ba27fe89ea9dbdd6a37f988.1609413115.git.balaton@eik.bme.hu> In-Reply-To: References: Subject: [PATCH v2 3/3] sam460ex: Clean up irq mapping Date: Thu, 31 Dec 2020 12:11:55 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org X-Spam-Probability: 8% 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=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Mark Cave-Ayland , Guenter Roeck , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan From: BALATON Zoltan via Content-Type: text/plain; charset="utf-8" Avoid mapping multiple interrupts to the same irq. Instead map them to the 4 PCI interrupts and use an or-gate in the board to connect them to the interrupt controller. This does not fix any known problem but does not seem to cause a new problem either and may be cleaner at least. Signed-off-by: BALATON Zoltan Tested-by: Guenter Roeck Reviewed-by: Peter Maydell --- hw/ppc/Kconfig | 1 + hw/ppc/ppc440_pcix.c | 28 ++++++++++++++-------------- hw/ppc/sam460ex.c | 16 +++++++++++++--- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig index f1e1be208e..ebb70803c4 100644 --- a/hw/ppc/Kconfig +++ b/hw/ppc/Kconfig @@ -59,6 +59,7 @@ config SAM460EX select PFLASH_CFI01 select IDE_SII3112 select M41T80 + select OR_IRQ select PPC440 select SM501 select SMBUS_EEPROM diff --git a/hw/ppc/ppc440_pcix.c b/hw/ppc/ppc440_pcix.c index ee952314c8..504decbbc2 100644 --- a/hw/ppc/ppc440_pcix.c +++ b/hw/ppc/ppc440_pcix.c @@ -57,8 +57,8 @@ struct PPC440PCIXState { PCIDevice *dev; struct PLBOutMap pom[PPC440_PCIX_NR_POMS]; struct PLBInMap pim[PPC440_PCIX_NR_PIMS]; + qemu_irq irq[PCI_NUM_PINS]; uint32_t sts; - qemu_irq irq; AddressSpace bm_as; MemoryRegion bm; =20 @@ -415,24 +415,20 @@ static void ppc440_pcix_reset(DeviceState *dev) s->sts =3D 0; } =20 -/* All pins from each slot are tied to a single board IRQ. - * This may need further refactoring for other boards. */ static int ppc440_pcix_map_irq(PCIDevice *pci_dev, int irq_num) { - trace_ppc440_pcix_map_irq(pci_dev->devfn, irq_num, 0); - return 0; + int n =3D (irq_num + PCI_SLOT(pci_dev->devfn)) % PCI_NUM_PINS; + + trace_ppc440_pcix_map_irq(pci_dev->devfn, irq_num, n); + return n; } =20 static void ppc440_pcix_set_irq(void *opaque, int irq_num, int level) { - qemu_irq *pci_irq =3D opaque; + qemu_irq *pci_irqs =3D opaque; =20 trace_ppc440_pcix_set_irq(irq_num); - if (irq_num < 0) { - error_report("%s: PCI irq %d", __func__, irq_num); - return; - } - qemu_set_irq(*pci_irq, level); + qemu_set_irq(pci_irqs[irq_num], level); } =20 static AddressSpace *ppc440_pcix_set_iommu(PCIBus *b, void *opaque, int de= vfn) @@ -472,15 +468,19 @@ static void ppc440_pcix_realize(DeviceState *dev, Err= or **errp) SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); PPC440PCIXState *s; PCIHostState *h; + int i; =20 h =3D PCI_HOST_BRIDGE(dev); s =3D PPC440_PCIX_HOST_BRIDGE(dev); =20 - sysbus_init_irq(sbd, &s->irq); + for (i =3D 0; i < ARRAY_SIZE(s->irq); i++) { + sysbus_init_irq(sbd, &s->irq[i]); + } memory_region_init(&s->busmem, OBJECT(dev), "pci bus memory", UINT64_M= AX); h->bus =3D pci_register_root_bus(dev, NULL, ppc440_pcix_set_irq, - ppc440_pcix_map_irq, &s->irq, &s->busmem, - get_system_io(), PCI_DEVFN(0, 0), 1, TYPE_PCI_BUS= ); + ppc440_pcix_map_irq, s->irq, &s->busmem, + get_system_io(), PCI_DEVFN(0, 0), ARRAY_SIZE(s->i= rq), + TYPE_PCI_BUS); =20 s->dev =3D pci_create_simple(h->bus, PCI_DEVFN(0, 0), "ppc4xx-host-bri= dge"); =20 diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 14e6583eb0..59b19fbca1 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -33,6 +33,7 @@ #include "sysemu/qtest.h" #include "sysemu/reset.h" #include "hw/sysbus.h" +#include "hw/or-irq.h" #include "hw/char/serial.h" #include "hw/i2c/ppc4xx_i2c.h" #include "hw/i2c/smbus_eeprom.h" @@ -292,7 +293,7 @@ static void sam460ex_init(MachineState *machine) SysBusDevice *sbdev; struct boot_info *boot_info; uint8_t *spd_data; - int success; + int i, success; =20 cpu =3D POWERPC_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; @@ -382,13 +383,22 @@ static void sam460ex_init(MachineState *machine) =20 /* PCI bus */ ppc460ex_pcie_init(env); - /* All PCI irqs are connected to the same UIC pin (cf. UBoot source) */ - dev =3D sysbus_create_simple("ppc440-pcix-host", 0xc0ec00000, uic[1][0= ]); + dev =3D sysbus_create_simple("ppc440-pcix-host", 0xc0ec00000, NULL); pci_bus =3D (PCIBus *)qdev_get_child_bus(dev, "pci.0"); if (!pci_bus) { error_report("couldn't create PCI controller!"); exit(1); } + /* All PCI irqs are connected to the same UIC pin (cf. UBoot source) */ + sbdev =3D SYS_BUS_DEVICE(dev); + dev =3D qdev_new(TYPE_OR_IRQ); + object_property_set_int(OBJECT(dev), "num-lines", PCI_NUM_PINS, + &error_fatal); + qdev_realize_and_unref(dev, NULL, &error_fatal); + for (i =3D 0; i < PCI_NUM_PINS; i++) { + sysbus_connect_irq(sbdev, i, qdev_get_gpio_in(dev, i)); + } + qdev_connect_gpio_out(dev, 0, uic[1][0]); memory_region_init_alias(isa, NULL, "isa_mmio", get_system_io(), 0, 0x10000); memory_region_add_subregion(get_system_memory(), 0xc08000000, isa); --=20 2.21.3