From nobody Fri May 3 21:17:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499810263530784.1466878669172; Tue, 11 Jul 2017 14:57:43 -0700 (PDT) Received: from localhost ([::1]:49096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV3A6-0004bT-EA for importer@patchew.org; Tue, 11 Jul 2017 17:57:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV36J-0001JT-Dz for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dV36G-0005Li-Cl for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:47 -0400 Received: from chuckie.co.uk ([82.165.15.123]:35117 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dV36G-0005L7-5H for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:44 -0400 Received: from host109-153-193-12.range109-153.btcentralplus.com ([109.153.193.12] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dV36B-0003gf-Sy; Tue, 11 Jul 2017 22:53:40 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, atar4qemu@gmail.com Date: Tue, 11 Jul 2017 22:53:20 +0100 Message-Id: <1499810007-28613-2-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.153.193.12 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 1/8] sun4u: pass PCIDevice into pci_ebus_init() instead of PCIBus X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In order to wire up the ebus PCI address spaces differently then we need access to the underlying PCIDevice. Signed-off-by: Mark Cave-Ayland --- hw/sparc64/sun4u.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 69f565d..7738856 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -224,13 +224,11 @@ static void isa_irq_handler(void *opaque, int n, int = level) =20 /* EBUS (Eight bit bus) bridge */ static ISABus * -pci_ebus_init(PCIBus *bus, int devfn, qemu_irq *irqs) +pci_ebus_init(PCIDevice *pci_dev, qemu_irq *irqs) { qemu_irq *isa_irq; - PCIDevice *pci_dev; ISABus *isa_bus; =20 - pci_dev =3D pci_create_simple(bus, devfn, "ebus"); isa_bus =3D ISA_BUS(qdev_get_child_bus(DEVICE(pci_dev), "isa.0")); isa_irq =3D qemu_allocate_irqs(isa_irq_handler, irqs, 16); isa_bus_irqs(isa_bus, isa_irq); @@ -429,6 +427,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, unsigned int i; uint64_t initrd_addr, initrd_size, kernel_addr, kernel_size, kernel_en= try; PCIBus *pci_bus, *pci_bus2, *pci_bus3; + PCIDevice *ebus; ISABus *isa_bus; SysBusDevice *s; qemu_irq *ivec_irqs, *pbm_irqs; @@ -452,7 +451,8 @@ static void sun4uv_init(MemoryRegion *address_space_mem, pci_vga_init(pci_bus); =20 // XXX Should be pci_bus3 - isa_bus =3D pci_ebus_init(pci_bus, -1, pbm_irqs); + ebus =3D pci_create_simple(pci_bus, -1, "ebus"); + isa_bus =3D pci_ebus_init(ebus, pbm_irqs); =20 i =3D 0; if (hwdef->console_serial_base) { --=20 1.7.10.4 From nobody Fri May 3 21:17:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499810144475578.248339865568; Tue, 11 Jul 2017 14:55:44 -0700 (PDT) Received: from localhost ([::1]:49090 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV38B-0002ql-3l for importer@patchew.org; Tue, 11 Jul 2017 17:55:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV36J-0001JR-Dx for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dV36H-0005MM-Br for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:47 -0400 Received: from chuckie.co.uk ([82.165.15.123]:35125 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dV36H-0005Lr-3z for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:45 -0400 Received: from host109-153-193-12.range109-153.btcentralplus.com ([109.153.193.12] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dV36D-0003gf-1O; Tue, 11 Jul 2017 22:53:41 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, atar4qemu@gmail.com Date: Tue, 11 Jul 2017 22:53:21 +0100 Message-Id: <1499810007-28613-3-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.153.193.12 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 2/8] sun4u: switch to using qdev to instantiate fw_cfg interface X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mark Cave-Ayland --- hw/sparc64/sun4u.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 7738856..8932be9 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -512,7 +512,15 @@ static void sun4uv_init(MemoryRegion *address_space_me= m, graphic_width, graphic_height, graphic_depth, (uint8_t *)&nd_table[0].macaddr); =20 - fw_cfg =3D fw_cfg_init_io(BIOS_CFG_IOPORT); + dev =3D qdev_create(NULL, TYPE_FW_CFG_IO); + qdev_prop_set_bit(dev, "dma_enabled", false); + object_property_add_child(OBJECT(qdev_get_machine()), TYPE_FW_CFG, + OBJECT(dev), NULL); + qdev_init_nofail(dev); + memory_region_add_subregion(get_system_io(), BIOS_CFG_IOPORT, + &FW_CFG_IO(dev)->comb_iomem); + + fw_cfg =3D FW_CFG(dev); fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)smp_cpus); fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); --=20 1.7.10.4 From nobody Fri May 3 21:17:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499810143070768.926573224654; Tue, 11 Jul 2017 14:55:43 -0700 (PDT) Received: from localhost ([::1]:49089 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV389-0002q4-Mu for importer@patchew.org; Tue, 11 Jul 2017 17:55:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV36J-0001JQ-Dx for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dV36G-0005M8-Tp for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:47 -0400 Received: from chuckie.co.uk ([82.165.15.123]:35123 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dV36G-0005LT-MH for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:44 -0400 Received: from host109-153-193-12.range109-153.btcentralplus.com ([109.153.193.12] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dV36E-0003gf-Ii; Tue, 11 Jul 2017 22:53:43 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, atar4qemu@gmail.com Date: Tue, 11 Jul 2017 22:53:22 +0100 Message-Id: <1499810007-28613-4-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.193.12 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 3/8] sun4u: expose fw_cfg and NVRAM on ebus PCI IO address space X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail: RSF_0 Z_629925259 SPT_0 To allow future changes to the sun4u PCI topology. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-By: Artyom Tarasenko --- hw/sparc64/sun4u.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 8932be9..4f96d97 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -450,7 +450,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, &pci_bus3, &pbm_irqs); pci_vga_init(pci_bus); =20 - // XXX Should be pci_bus3 + /* XXX Should be pci_bus3 */ ebus =3D pci_create_simple(pci_bus, -1, "ebus"); isa_bus =3D pci_ebus_init(ebus, pbm_irqs); =20 @@ -492,7 +492,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, /* Map NVRAM into I/O (ebus) space */ nvram =3D m48t59_init(NULL, 0, 0, NVRAM_SIZE, 1968, 59); s =3D SYS_BUS_DEVICE(nvram); - memory_region_add_subregion(get_system_io(), 0x2000, + memory_region_add_subregion(pci_address_space_io(ebus), 0x2000, sysbus_mmio_get_region(s, 0)); =20 initrd_size =3D 0; @@ -514,10 +514,9 @@ static void sun4uv_init(MemoryRegion *address_space_me= m, =20 dev =3D qdev_create(NULL, TYPE_FW_CFG_IO); qdev_prop_set_bit(dev, "dma_enabled", false); - object_property_add_child(OBJECT(qdev_get_machine()), TYPE_FW_CFG, - OBJECT(dev), NULL); + object_property_add_child(OBJECT(ebus), TYPE_FW_CFG, OBJECT(dev), NULL= ); qdev_init_nofail(dev); - memory_region_add_subregion(get_system_io(), BIOS_CFG_IOPORT, + memory_region_add_subregion(pci_address_space_io(ebus), BIOS_CFG_IOPOR= T, &FW_CFG_IO(dev)->comb_iomem); =20 fw_cfg =3D FW_CFG(dev); --=20 1.7.10.4 From nobody Fri May 3 21:17:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499810143131159.1216661615448; Tue, 11 Jul 2017 14:55:43 -0700 (PDT) Received: from localhost ([::1]:49088 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV389-0002pV-0T for importer@patchew.org; Tue, 11 Jul 2017 17:55:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV36J-0001JS-Dy for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dV36I-0005Mg-4r for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:47 -0400 Received: from chuckie.co.uk ([82.165.15.123]:35128 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dV36H-0005MG-Ti for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:46 -0400 Received: from host109-153-193-12.range109-153.btcentralplus.com ([109.153.193.12] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dV36F-0003gf-NB; Tue, 11 Jul 2017 22:53:44 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, atar4qemu@gmail.com Date: Tue, 11 Jul 2017 22:53:23 +0100 Message-Id: <1499810007-28613-5-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.153.193.12 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 4/8] apb: fix up PCI bus nomenclature X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Rather than referring to the PCI busses as bus2 and bus3, refer to them as busA and busB as per the documentation. Also replace the long bus names with the shorter pciA and pciB aliases (to make it easier to attach additional devices to either from the command line). Signed-off-by: Mark Cave-Ayland --- hw/pci-host/apb.c | 12 +++++------- hw/sparc64/sun4u.c | 8 ++++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c index 326f5ef..622c341 100644 --- a/hw/pci-host/apb.c +++ b/hw/pci-host/apb.c @@ -656,7 +656,7 @@ static void apb_pci_bridge_realize(PCIDevice *dev, Erro= r **errp) =20 PCIBus *pci_apb_init(hwaddr special_base, hwaddr mem_base, - qemu_irq *ivec_irqs, PCIBus **bus2, PCIBus **bus3, + qemu_irq *ivec_irqs, PCIBus **busA, PCIBus **busB, qemu_irq **pbm_irqs) { DeviceState *dev; @@ -706,18 +706,16 @@ PCIBus *pci_apb_init(hwaddr special_base, pci_dev =3D pci_create_multifunction(phb->bus, PCI_DEVFN(1, 0), true, "pbm-bridge"); br =3D PCI_BRIDGE(pci_dev); - pci_bridge_map_irq(br, "Advanced PCI Bus secondary bridge 1", - pci_apb_map_irq); + pci_bridge_map_irq(br, "pciB", pci_apb_map_irq); qdev_init_nofail(&pci_dev->qdev); - *bus2 =3D pci_bridge_get_sec_bus(br); + *busB =3D pci_bridge_get_sec_bus(br); =20 pci_dev =3D pci_create_multifunction(phb->bus, PCI_DEVFN(1, 1), true, "pbm-bridge"); br =3D PCI_BRIDGE(pci_dev); - pci_bridge_map_irq(br, "Advanced PCI Bus secondary bridge 2", - pci_apb_map_irq); + pci_bridge_map_irq(br, "pciA", pci_apb_map_irq); qdev_init_nofail(&pci_dev->qdev); - *bus3 =3D pci_bridge_get_sec_bus(br); + *busA =3D pci_bridge_get_sec_bus(br); =20 return phb->bus; } diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 4f96d97..5ddd30f 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -426,7 +426,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, Nvram *nvram; unsigned int i; uint64_t initrd_addr, initrd_size, kernel_addr, kernel_size, kernel_en= try; - PCIBus *pci_bus, *pci_bus2, *pci_bus3; + PCIBus *pci_bus, *pci_busA, *pci_busB; PCIDevice *ebus; ISABus *isa_bus; SysBusDevice *s; @@ -446,11 +446,11 @@ static void sun4uv_init(MemoryRegion *address_space_m= em, prom_init(hwdef->prom_addr, bios_name); =20 ivec_irqs =3D qemu_allocate_irqs(sparc64_cpu_set_ivec_irq, cpu, IVEC_M= AX); - pci_bus =3D pci_apb_init(APB_SPECIAL_BASE, APB_MEM_BASE, ivec_irqs, &p= ci_bus2, - &pci_bus3, &pbm_irqs); + pci_bus =3D pci_apb_init(APB_SPECIAL_BASE, APB_MEM_BASE, ivec_irqs, &p= ci_busA, + &pci_busB, &pbm_irqs); pci_vga_init(pci_bus); =20 - /* XXX Should be pci_bus3 */ + /* XXX Should be pci_busA */ ebus =3D pci_create_simple(pci_bus, -1, "ebus"); isa_bus =3D pci_ebus_init(ebus, pbm_irqs); =20 --=20 1.7.10.4 From nobody Fri May 3 21:17:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149981041446924.48277759586483; Tue, 11 Jul 2017 15:00:14 -0700 (PDT) Received: from localhost ([::1]:49102 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV3CX-0006dV-6P for importer@patchew.org; Tue, 11 Jul 2017 18:00:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV36L-0001Jq-Do for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dV36K-0005OK-LV for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:49 -0400 Received: from chuckie.co.uk ([82.165.15.123]:35131 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dV36K-0005Nc-DY for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:48 -0400 Received: from host109-153-193-12.range109-153.btcentralplus.com ([109.153.193.12] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dV36G-0003gf-Td; Tue, 11 Jul 2017 22:53:45 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, atar4qemu@gmail.com Date: Tue, 11 Jul 2017 22:53:24 +0100 Message-Id: <1499810007-28613-6-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.153.193.12 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 5/8] apb: fix endianness for APB and PCI config accesses X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mark Cave-Ayland --- hw/pci-host/apb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c index 622c341..5ad7678 100644 --- a/hw/pci-host/apb.c +++ b/hw/pci-host/apb.c @@ -561,7 +561,7 @@ static uint64_t apb_config_readl (void *opaque, static const MemoryRegionOps apb_config_ops =3D { .read =3D apb_config_readl, .write =3D apb_config_writel, - .endianness =3D DEVICE_NATIVE_ENDIAN, + .endianness =3D DEVICE_BIG_ENDIAN, }; =20 static void apb_pci_config_write(void *opaque, hwaddr addr, @@ -570,7 +570,6 @@ static void apb_pci_config_write(void *opaque, hwaddr a= ddr, APBState *s =3D opaque; PCIHostState *phb =3D PCI_HOST_BRIDGE(s); =20 - val =3D qemu_bswap_len(val, size); APB_DPRINTF("%s: addr " TARGET_FMT_plx " val %" PRIx64 "\n", __func__,= addr, val); pci_data_write(phb->bus, addr, val, size); } @@ -583,7 +582,6 @@ static uint64_t apb_pci_config_read(void *opaque, hwadd= r addr, PCIHostState *phb =3D PCI_HOST_BRIDGE(s); =20 ret =3D pci_data_read(phb->bus, addr, size); - ret =3D qemu_bswap_len(ret, size); APB_DPRINTF("%s: addr " TARGET_FMT_plx " -> %x\n", __func__, addr, ret= ); return ret; } @@ -744,7 +742,7 @@ static void pci_pbm_reset(DeviceState *d) static const MemoryRegionOps pci_config_ops =3D { .read =3D apb_pci_config_read, .write =3D apb_pci_config_write, - .endianness =3D DEVICE_NATIVE_ENDIAN, + .endianness =3D DEVICE_LITTLE_ENDIAN, }; =20 static int pci_pbm_init_device(SysBusDevice *dev) --=20 1.7.10.4 From nobody Fri May 3 21:17:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499810148612918.9012589048618; Tue, 11 Jul 2017 14:55:48 -0700 (PDT) Received: from localhost ([::1]:49091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV38F-0002vQ-7G for importer@patchew.org; Tue, 11 Jul 2017 17:55:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV36N-0001LS-0H for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dV36L-0005P2-VC for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:51 -0400 Received: from chuckie.co.uk ([82.165.15.123]:35138 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dV36L-0005OY-OG for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:49 -0400 Received: from host109-153-193-12.range109-153.btcentralplus.com ([109.153.193.12] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dV36H-0003gf-TZ; Tue, 11 Jul 2017 22:53:47 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, atar4qemu@gmail.com Date: Tue, 11 Jul 2017 22:53:25 +0100 Message-Id: <1499810007-28613-7-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.153.193.12 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 6/8] apb: add busA qdev property to PBM PCI bridge X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" As future sun4u PCI topologies place the ebus containing the in-built devic= es behind a PCI bridge, add a busA property to the PBM PCI bridge that is then used to allow IO accesses by default. This allows early fw_cfg/NVRAM/serial access to occur even before OpenBIOS has had a chance to configure the PCI bridges. Signed-off-by: Mark Cave-Ayland --- hw/pci-host/apb.c | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c index 5ad7678..f9badad 100644 --- a/hw/pci-host/apb.c +++ b/hw/pci-host/apb.c @@ -153,6 +153,18 @@ typedef struct APBState { unsigned int nr_resets; } APBState; =20 +#define TYPE_PBM_PCI_BRIDGE "pbm-bridge" +#define PBM_PCI_BRIDGE(obj) \ + OBJECT_CHECK(PBMPCIBridge, (obj), TYPE_PBM_PCI_BRIDGE) + +typedef struct PBMPCIBridge { + /*< private >*/ + PCIBridge parent_obj; + + /* Is this busA with in-built devices (ebus)? */ + bool busA; +} PBMPCIBridge; + static inline void pbm_set_request(APBState *s, unsigned int irq_num) { APB_DPRINTF("%s: request irq %d\n", __func__, irq_num); @@ -634,8 +646,6 @@ static void pci_apb_set_irq(void *opaque, int irq_num, = int level) =20 static void apb_pci_bridge_realize(PCIDevice *dev, Error **errp) { - pci_bridge_initfn(dev, TYPE_PCI_BUS); - /* * command register: * According to PCI bridge spec, after reset @@ -645,11 +655,23 @@ static void apb_pci_bridge_realize(PCIDevice *dev, Er= ror **errp) * the reset value should be zero unless the boot pin is tied high * (which is true) and thus it should be PCI_COMMAND_MEMORY. */ - pci_set_word(dev->config + PCI_COMMAND, - PCI_COMMAND_MEMORY); + uint16_t cmd =3D PCI_COMMAND_MEMORY; + PBMPCIBridge *br =3D PBM_PCI_BRIDGE(dev); + + pci_bridge_initfn(dev, TYPE_PCI_BUS); + + /* If initialising busA, ensure that we allow IO transactions so that + we get the early serial console until OpenBIOS configures the bridg= e */ + if (br->busA) { + cmd |=3D PCI_COMMAND_IO; + } + + pci_set_word(dev->config + PCI_COMMAND, cmd); pci_set_word(dev->config + PCI_STATUS, PCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ | PCI_STATUS_DEVSEL_MEDIUM); + + pci_bridge_update_mappings(PCI_BRIDGE(br)); } =20 PCIBus *pci_apb_init(hwaddr special_base, @@ -702,16 +724,17 @@ PCIBus *pci_apb_init(hwaddr special_base, =20 /* APB secondary busses */ pci_dev =3D pci_create_multifunction(phb->bus, PCI_DEVFN(1, 0), true, - "pbm-bridge"); + TYPE_PBM_PCI_BRIDGE); br =3D PCI_BRIDGE(pci_dev); pci_bridge_map_irq(br, "pciB", pci_apb_map_irq); qdev_init_nofail(&pci_dev->qdev); *busB =3D pci_bridge_get_sec_bus(br); =20 pci_dev =3D pci_create_multifunction(phb->bus, PCI_DEVFN(1, 1), true, - "pbm-bridge"); + TYPE_PBM_PCI_BRIDGE); br =3D PCI_BRIDGE(pci_dev); pci_bridge_map_irq(br, "pciA", pci_apb_map_irq); + qdev_prop_set_bit(DEVICE(pci_dev), "busA", true); qdev_init_nofail(&pci_dev->qdev); *busA =3D pci_bridge_get_sec_bus(br); =20 @@ -833,6 +856,11 @@ static const TypeInfo pbm_host_info =3D { .class_init =3D pbm_host_class_init, }; =20 +static Property pbm_pci_properties[] =3D { + DEFINE_PROP_BOOL("busA", PBMPCIBridge, busA, false), + DEFINE_PROP_END_OF_LIST(), +}; + static void pbm_pci_bridge_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -848,12 +876,14 @@ static void pbm_pci_bridge_class_init(ObjectClass *kl= ass, void *data) set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); dc->reset =3D pci_bridge_reset; dc->vmsd =3D &vmstate_pci_device; + dc->props =3D pbm_pci_properties; } =20 static const TypeInfo pbm_pci_bridge_info =3D { - .name =3D "pbm-bridge", + .name =3D TYPE_PBM_PCI_BRIDGE, .parent =3D TYPE_PCI_BRIDGE, .class_init =3D pbm_pci_bridge_class_init, + .instance_size =3D sizeof(PBMPCIBridge), }; =20 static void pbm_register_types(void) --=20 1.7.10.4 From nobody Fri May 3 21:17:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499810262546726.9671765648321; Tue, 11 Jul 2017 14:57:42 -0700 (PDT) Received: from localhost ([::1]:49095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV3A5-0004ax-Dj for importer@patchew.org; Tue, 11 Jul 2017 17:57:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV36M-0001Kk-7y for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dV36L-0005Or-IM for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:50 -0400 Received: from chuckie.co.uk ([82.165.15.123]:35135 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dV36L-0005OG-BG for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:49 -0400 Received: from host109-153-193-12.range109-153.btcentralplus.com ([109.153.193.12] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dV36J-0003gf-8e; Tue, 11 Jul 2017 22:53:48 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, atar4qemu@gmail.com Date: Tue, 11 Jul 2017 22:53:26 +0100 Message-Id: <1499810007-28613-8-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.153.193.12 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 7/8] sun4u: create single default onboard ne2k_pci NIC for machine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" As we move towards a real Ultra 5 machine, allow only a single NIC to be instantiated with the legacy net options. More devices can be added with the new -netdev and -device options if required. Signed-off-by: Mark Cave-Ayland --- hw/sparc64/sun4u.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 5ddd30f..3bb3bf2 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -427,7 +427,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, unsigned int i; uint64_t initrd_addr, initrd_size, kernel_addr, kernel_size, kernel_en= try; PCIBus *pci_bus, *pci_busA, *pci_busB; - PCIDevice *ebus; + PCIDevice *ebus, *pci_dev; ISABus *isa_bus; SysBusDevice *s; qemu_irq *ivec_irqs, *pbm_irqs; @@ -464,8 +464,10 @@ static void sun4uv_init(MemoryRegion *address_space_me= m, serial_hds_isa_init(isa_bus, i, MAX_SERIAL_PORTS); parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS); =20 - for(i =3D 0; i < nb_nics; i++) - pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL); + pci_dev =3D pci_create(pci_bus, -1, "ne2k_pci"); + dev =3D &pci_dev->qdev; + qdev_set_nic_properties(dev, &nd_table[0]); + qdev_init_nofail(dev); =20 ide_drive_get(hd, ARRAY_SIZE(hd)); =20 --=20 1.7.10.4 From nobody Fri May 3 21:17:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499810482698739.2268381455535; Tue, 11 Jul 2017 15:01:22 -0700 (PDT) Received: from localhost ([::1]:49118 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV3Db-0007Mj-Sr for importer@patchew.org; Tue, 11 Jul 2017 18:01:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dV36O-0001Lm-Gl for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dV36N-0005Pp-CP for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:52 -0400 Received: from chuckie.co.uk ([82.165.15.123]:35140 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dV36N-0005PK-1W for qemu-devel@nongnu.org; Tue, 11 Jul 2017 17:53:51 -0400 Received: from host109-153-193-12.range109-153.btcentralplus.com ([109.153.193.12] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1dV36K-0003gf-CY; Tue, 11 Jul 2017 22:53:49 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, atar4qemu@gmail.com Date: Tue, 11 Jul 2017 22:53:27 +0100 Message-Id: <1499810007-28613-9-git-send-email-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> References: <1499810007-28613-1-git-send-email-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.153.193.12 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 8/8] sun4u: move in-built devices behind PCI bridge A X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This switches the sun4u model to being much closer to a real Ultra 5. Since the existing code previously bypassed the PCI bridge interrupt swizzling, reorganise the interrupt mapping functions so that pci_pbm_map_irq() is used by the PCI bridges and pci_apb_map_irq() is used by the PCI host bridge. As part of this change we also combine the "onboard" NIC and the ebus into a single multi-function device as done on a real Ultra 5. Finally we mark the physically unavailable slots (plus slot 0 in busA) as reserved to ensure that users can't plug devices into non-existent slots which will break interrupt routing. Signed-off-by: Mark Cave-Ayland --- hw/pci-host/apb.c | 35 +++++++++++++++++++++++++++-------- hw/sparc64/sun4u.c | 25 ++++++++++++++++++++----- 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c index f9badad..5000432 100644 --- a/hw/pci-host/apb.c +++ b/hw/pci-host/apb.c @@ -601,16 +601,35 @@ static uint64_t apb_pci_config_read(void *opaque, hwa= ddr addr, /* The APB host has an IRQ line for each IRQ line of each slot. */ static int pci_apb_map_irq(PCIDevice *pci_dev, int irq_num) { - return ((pci_dev->devfn & 0x18) >> 1) + irq_num; + /* Return the irq as swizzled by the PBM */ + return irq_num; } =20 static int pci_pbm_map_irq(PCIDevice *pci_dev, int irq_num) { + PBMPCIBridge *br =3D PBM_PCI_BRIDGE(pci_bridge_get_device( + PCI_BUS(qdev_get_parent_bus(DEVICE(pci_dev))))); + int bus_offset; - if (pci_dev->devfn & 1) - bus_offset =3D 16; - else - bus_offset =3D 0; + if (br->busA) { + bus_offset =3D 0x0; + + /* The on-board devices have fixed (legacy) OBIO intnos */ + switch (PCI_SLOT(pci_dev->devfn)) { + case 1: + /* Onboard NIC */ + return 0x21; + case 3: + /* Onboard IDE */ + return 0x20; + + default: + /* Normal intno, fall through */ + break; + } + } else { + bus_offset =3D 0x10; + } return (bus_offset + (PCI_SLOT(pci_dev->devfn) << 2) + irq_num) & 0x1f; } =20 @@ -692,7 +711,7 @@ PCIBus *pci_apb_init(hwaddr special_base, d =3D APB_DEVICE(dev); phb =3D PCI_HOST_BRIDGE(dev); phb->bus =3D pci_register_bus(DEVICE(phb), "pci", - pci_apb_set_irq, pci_pbm_map_irq, d, + pci_apb_set_irq, pci_apb_map_irq, d, &d->pci_mmio, get_system_io(), 0, 32, TYPE_PCI_BUS); @@ -726,14 +745,14 @@ PCIBus *pci_apb_init(hwaddr special_base, pci_dev =3D pci_create_multifunction(phb->bus, PCI_DEVFN(1, 0), true, TYPE_PBM_PCI_BRIDGE); br =3D PCI_BRIDGE(pci_dev); - pci_bridge_map_irq(br, "pciB", pci_apb_map_irq); + pci_bridge_map_irq(br, "pciB", pci_pbm_map_irq); qdev_init_nofail(&pci_dev->qdev); *busB =3D pci_bridge_get_sec_bus(br); =20 pci_dev =3D pci_create_multifunction(phb->bus, PCI_DEVFN(1, 1), true, TYPE_PBM_PCI_BRIDGE); br =3D PCI_BRIDGE(pci_dev); - pci_bridge_map_irq(br, "pciA", pci_apb_map_irq); + pci_bridge_map_irq(br, "pciA", pci_pbm_map_irq); qdev_prop_set_bit(DEVICE(pci_dev), "busA", true); qdev_init_nofail(&pci_dev->qdev); *busA =3D pci_bridge_get_sec_bus(br); diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 3bb3bf2..b8b96be 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -27,6 +27,7 @@ #include "cpu.h" #include "hw/hw.h" #include "hw/pci/pci.h" +#include "hw/pci/pci_bus.h" #include "hw/pci-host/apb.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" @@ -42,6 +43,7 @@ #include "hw/nvram/fw_cfg.h" #include "hw/sysbus.h" #include "hw/ide.h" +#include "hw/ide/pci.h" #include "hw/loader.h" #include "elf.h" #include "qemu/cutils.h" @@ -448,10 +450,17 @@ static void sun4uv_init(MemoryRegion *address_space_m= em, ivec_irqs =3D qemu_allocate_irqs(sparc64_cpu_set_ivec_irq, cpu, IVEC_M= AX); pci_bus =3D pci_apb_init(APB_SPECIAL_BASE, APB_MEM_BASE, ivec_irqs, &p= ci_busA, &pci_busB, &pbm_irqs); - pci_vga_init(pci_bus); =20 - /* XXX Should be pci_busA */ - ebus =3D pci_create_simple(pci_bus, -1, "ebus"); + /* Only in-built Simba PBMs can exist on the root bus, slot 0 on busA = is + reserved (leaving no slots free after on-board devices) leaving slo= ts + 0-3 are free on busB 4*/ + pci_bus->slot_reserved_mask =3D 0xfffffffc; + pci_busA->slot_reserved_mask =3D 0xfffffff1; + pci_busB->slot_reserved_mask =3D 0xfffffff0; + + ebus =3D pci_create_multifunction(pci_busA, PCI_DEVFN(1, 0), true, "eb= us"); + qdev_init_nofail(DEVICE(ebus)); + isa_bus =3D pci_ebus_init(ebus, pbm_irqs); =20 i =3D 0; @@ -464,14 +473,20 @@ static void sun4uv_init(MemoryRegion *address_space_m= em, serial_hds_isa_init(isa_bus, i, MAX_SERIAL_PORTS); parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS); =20 - pci_dev =3D pci_create(pci_bus, -1, "ne2k_pci"); + pci_dev =3D pci_create_simple(pci_busA, PCI_DEVFN(2, 0), "VGA"); + + pci_dev =3D pci_create_multifunction(pci_busA, PCI_DEVFN(1, 1), true, + "ne2k_pci"); dev =3D &pci_dev->qdev; qdev_set_nic_properties(dev, &nd_table[0]); qdev_init_nofail(dev); =20 ide_drive_get(hd, ARRAY_SIZE(hd)); =20 - pci_cmd646_ide_init(pci_bus, hd, 1); + pci_dev =3D pci_create(pci_busA, PCI_DEVFN(3, 0), "cmd646-ide"); + qdev_prop_set_uint32(&pci_dev->qdev, "secondary", 1); + qdev_init_nofail(&pci_dev->qdev); + pci_ide_create_devs(pci_dev, hd); =20 isa_create_simple(isa_bus, "i8042"); =20 --=20 1.7.10.4