From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374542011820.0486902258522; Sun, 4 May 2025 09:02:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbmc-0004p8-9p; Sun, 04 May 2025 12:01:38 -0400 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 1uBbma-0004oH-5R; Sun, 04 May 2025 12:01:36 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmY-0004AH-0K; Sun, 04 May 2025 12:01:35 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 9F72055D235; Sun, 04 May 2025 18:01:29 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id pWIEvT65vKHl; Sun, 4 May 2025 18:01:27 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id A5E8E55D233; Sun, 04 May 2025 18:01:27 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: <0d41c18a8831bd4c8b0948eda3ef8f60f5a311f3.1746374076.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 01/16] hw/pci-host/raven: Remove is-legacy-prep property To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:27 +0200 (CEST) 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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-ZM-MESSAGEID: 1746374544951019000 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This was a workaround for the prep machine that was removed 5 years ago so this is no longer needed. Fixes: b2ce76a073 (hw/ppc/prep: Remove the deprecated "prep" machine and the OpenHackware BIOS) Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/raven.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index 21f7ca65e0..b78a8f32d3 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -75,7 +75,6 @@ struct PRePPCIState { RavenPCIState pci_dev; =20 int contiguous_map; - bool is_legacy_prep; }; =20 #define BIOS_SIZE (1 * MiB) @@ -243,22 +242,18 @@ static void raven_pcihost_realizefn(DeviceState *d, E= rror **errp) MemoryRegion *address_space_mem =3D get_system_memory(); int i; =20 - if (s->is_legacy_prep) { - for (i =3D 0; i < PCI_NUM_PINS; i++) { - sysbus_init_irq(dev, &s->pci_irqs[i]); - } - } else { - /* According to PReP specification section 6.1.6 "System Interrupt - * Assignments", all PCI interrupts are routed via IRQ 15 */ - s->or_irq =3D OR_IRQ(object_new(TYPE_OR_IRQ)); - object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PI= NS, - &error_fatal); - qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal); - sysbus_init_irq(dev, &s->or_irq->out_irq); - - for (i =3D 0; i < PCI_NUM_PINS; i++) { - s->pci_irqs[i] =3D qdev_get_gpio_in(DEVICE(s->or_irq), i); - } + /* + * According to PReP specification section 6.1.6 "System Interrupt + * Assignments", all PCI interrupts are routed via IRQ 15 + */ + s->or_irq =3D OR_IRQ(object_new(TYPE_OR_IRQ)); + object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS, + &error_fatal); + qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal); + sysbus_init_irq(dev, &s->or_irq->out_irq); + + for (i =3D 0; i < PCI_NUM_PINS; i++) { + s->pci_irqs[i] =3D qdev_get_gpio_in(DEVICE(s->or_irq), i); } =20 qdev_init_gpio_in(d, raven_change_gpio, 1); @@ -426,9 +421,6 @@ static const Property raven_pcihost_properties[] =3D { DEFINE_PROP_UINT32("elf-machine", PREPPCIState, pci_dev.elf_machine, EM_NONE), DEFINE_PROP_STRING("bios-name", PREPPCIState, pci_dev.bios_name), - /* Temporary workaround until legacy prep machine is removed */ - DEFINE_PROP_BOOL("is-legacy-prep", PREPPCIState, is_legacy_prep, - false), }; =20 static void raven_pcihost_class_init(ObjectClass *klass, const void *data) --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374541682313.1846275210288; Sun, 4 May 2025 09:02:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbmd-0004sI-C4; Sun, 04 May 2025 12:01:39 -0400 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 1uBbmb-0004p0-Li; Sun, 04 May 2025 12:01:37 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmY-0004AN-0U; Sun, 04 May 2025 12:01:37 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id AE03155D21A; Sun, 04 May 2025 18:01:30 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id s2T_LI7CItth; Sun, 4 May 2025 18:01:28 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id B2D5555D234; Sun, 04 May 2025 18:01:28 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: <4ca4f71bf661923d9a91b7e6776a0e40726e2337.1746374076.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 02/16] hw/pci-host/raven: Revert "raven: Move BIOS loading from board code to PCI host" To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:28 +0200 (CEST) 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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-ZM-MESSAGEID: 1746374545286019000 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This reverts commit d0b25425749d5525b2ba6d9d966d8800a5643b35. Loading firmware from the PCI host is unusual and raven is only used by one board so this does not simplify anything but rather complicates it. Revert to loading firmware from board code as that is the usual way and also because raven has nothing to do with ROM so it is not a good place for this. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/raven.c | 55 --------------------------------------------- hw/ppc/prep.c | 27 ++++++++++++++++++++-- 2 files changed, 25 insertions(+), 57 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index b78a8f32d3..f8c0be5d21 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "qemu/datadir.h" #include "qemu/units.h" #include "qemu/log.h" #include "qapi/error.h" @@ -35,9 +34,7 @@ #include "migration/vmstate.h" #include "hw/intc/i8259.h" #include "hw/irq.h" -#include "hw/loader.h" #include "hw/or-irq.h" -#include "elf.h" #include "qom/object.h" =20 #define TYPE_RAVEN_PCI_DEVICE "raven" @@ -47,10 +44,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(RavenPCIState, RAVEN_PCI_DEVI= CE) =20 struct RavenPCIState { PCIDevice dev; - - uint32_t elf_machine; - char *bios_name; - MemoryRegion bios; }; =20 typedef struct PRePPCIState PREPPCIState; @@ -77,8 +70,6 @@ struct PRePPCIState { int contiguous_map; }; =20 -#define BIOS_SIZE (1 * MiB) - #define PCI_IO_BASE_ADDR 0x80000000 /* Physical address on main bus */ =20 static inline uint32_t raven_pci_io_config(hwaddr addr) @@ -333,48 +324,9 @@ static void raven_pcihost_initfn(Object *obj) =20 static void raven_realize(PCIDevice *d, Error **errp) { - RavenPCIState *s =3D RAVEN_PCI_DEVICE(d); - char *filename; - int bios_size =3D -1; - d->config[PCI_CACHE_LINE_SIZE] =3D 0x08; d->config[PCI_LATENCY_TIMER] =3D 0x10; d->config[PCI_CAPABILITY_LIST] =3D 0x00; - - if (!memory_region_init_rom_nomigrate(&s->bios, OBJECT(s), "bios", - BIOS_SIZE, errp)) { - return; - } - memory_region_add_subregion(get_system_memory(), (uint32_t)(-BIOS_SIZE= ), - &s->bios); - if (s->bios_name) { - filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, s->bios_name); - if (filename) { - if (s->elf_machine !=3D EM_NONE) { - bios_size =3D load_elf(filename, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, - ELFDATA2MSB, s->elf_machine, 0, 0); - } - if (bios_size < 0) { - bios_size =3D get_image_size(filename); - if (bios_size > 0 && bios_size <=3D BIOS_SIZE) { - hwaddr bios_addr; - bios_size =3D (bios_size + 0xfff) & ~0xfff; - bios_addr =3D (uint32_t)(-BIOS_SIZE); - bios_size =3D load_image_targphys(filename, bios_addr, - bios_size); - } - } - } - g_free(filename); - if (bios_size < 0 || bios_size > BIOS_SIZE) { - memory_region_del_subregion(get_system_memory(), &s->bios); - error_setg(errp, "Could not load bios image '%s'", s->bios_nam= e); - return; - } - } - - vmstate_register_ram_global(&s->bios); } =20 static const VMStateDescription vmstate_raven =3D { @@ -417,19 +369,12 @@ static const TypeInfo raven_info =3D { }, }; =20 -static const Property raven_pcihost_properties[] =3D { - DEFINE_PROP_UINT32("elf-machine", PREPPCIState, pci_dev.elf_machine, - EM_NONE), - DEFINE_PROP_STRING("bios-name", PREPPCIState, pci_dev.bios_name), -}; - static void raven_pcihost_class_init(ObjectClass *klass, const void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); dc->realize =3D raven_pcihost_realizefn; - device_class_set_props(dc, raven_pcihost_properties); dc->fw_name =3D "pci"; } =20 diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 739526335c..982e40e53e 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -35,6 +35,7 @@ #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/log.h" +#include "qemu/datadir.h" #include "hw/loader.h" #include "hw/rtc/mc146818rtc.h" #include "hw/isa/pc87312.h" @@ -55,6 +56,8 @@ #define KERNEL_LOAD_ADDR 0x01000000 #define INITRD_LOAD_ADDR 0x01800000 =20 +#define BIOS_ADDR 0xfff00000 +#define BIOS_SIZE (1 * MiB) #define NVRAM_SIZE 0x2000 =20 static void fw_cfg_boot_set(void *opaque, const char *boot_device, @@ -241,6 +244,9 @@ static void ibm_40p_init(MachineState *machine) ISADevice *isa_dev; ISABus *isa_bus; void *fw_cfg; + MemoryRegion *bios =3D g_new(MemoryRegion, 1); + char *filename; + ssize_t bios_size =3D -1; uint32_t kernel_base =3D 0, initrd_base =3D 0; long kernel_size =3D 0, initrd_size =3D 0; char boot_device; @@ -263,10 +269,27 @@ static void ibm_40p_init(MachineState *machine) cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); qemu_register_reset(ppc_prep_reset, cpu); =20 + /* allocate and load firmware */ + filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); + if (!filename) { + error_report("Could not find bios image '%s'", bios_name); + exit(1); + } + memory_region_init_rom(bios, NULL, "bios", BIOS_SIZE, &error_fatal); + memory_region_add_subregion(get_system_memory(), BIOS_ADDR, bios); + bios_size =3D load_elf(filename, NULL, NULL, NULL, NULL, NULL, NULL, N= ULL, + ELFDATA2MSB, PPC_ELF_MACHINE, 0, 0); + if (bios_size < 0) { + bios_size =3D load_image_targphys(filename, BIOS_ADDR, BIOS_SIZE); + } + if (bios_size < 0 || bios_size > BIOS_SIZE) { + error_report("Could not load bios image '%s'", filename); + return; + } + g_free(filename); + /* PCI host */ dev =3D qdev_new("raven-pcihost"); - qdev_prop_set_string(dev, "bios-name", bios_name); - qdev_prop_set_uint32(dev, "elf-machine", PPC_ELF_MACHINE); pcihost =3D SYS_BUS_DEVICE(dev); object_property_add_child(qdev_get_machine(), "raven", OBJECT(dev)); sysbus_realize_and_unref(pcihost, &error_fatal); --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374612059671.2269705179074; Sun, 4 May 2025 09:03:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbmd-0004sx-JK; Sun, 04 May 2025 12:01:40 -0400 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 1uBbmb-0004oy-J3; Sun, 04 May 2025 12:01:37 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmZ-0004AW-8J; Sun, 04 May 2025 12:01:37 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id B449B55D233; Sun, 04 May 2025 18:01:31 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id q6bw8mMbiMNA; Sun, 4 May 2025 18:01:29 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id BC0BA55D237; Sun, 04 May 2025 18:01:29 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: <3a588b74c994521a4e4a608a129a13bf9200030d.1746374076.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 03/16] hw/pci-host/raven: Simplify PCI facing part To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:29 +0200 (CEST) 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.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-ZM-MESSAGEID: 1746374614524116600 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The raven PCI device does not need a state struct as it has no data to store there any more so we can remove that to simplify code. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/raven.c | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index f8c0be5d21..172f01694c 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -31,7 +31,6 @@ #include "hw/pci/pci_bus.h" #include "hw/pci/pci_host.h" #include "hw/qdev-properties.h" -#include "migration/vmstate.h" #include "hw/intc/i8259.h" #include "hw/irq.h" #include "hw/or-irq.h" @@ -40,12 +39,6 @@ #define TYPE_RAVEN_PCI_DEVICE "raven" #define TYPE_RAVEN_PCI_HOST_BRIDGE "raven-pcihost" =20 -OBJECT_DECLARE_SIMPLE_TYPE(RavenPCIState, RAVEN_PCI_DEVICE) - -struct RavenPCIState { - PCIDevice dev; -}; - typedef struct PRePPCIState PREPPCIState; DECLARE_INSTANCE_CHECKER(PREPPCIState, RAVEN_PCI_HOST_BRIDGE, TYPE_RAVEN_PCI_HOST_BRIDGE) @@ -65,7 +58,6 @@ struct PRePPCIState { MemoryRegion bm_ram_alias; MemoryRegion bm_pci_memory_alias; AddressSpace bm_as; - RavenPCIState pci_dev; =20 int contiguous_map; }; @@ -268,8 +260,7 @@ static void raven_pcihost_realizefn(DeviceState *d, Err= or **errp) "pci-intack", 1); memory_region_add_subregion(address_space_mem, 0xbffffff0, &s->pci_int= ack); =20 - /* TODO Remove once realize propagates to child devices. */ - qdev_realize(DEVICE(&s->pci_dev), BUS(&s->pci_bus), errp); + pci_create_simple(&s->pci_bus, PCI_DEVFN(0, 0), TYPE_RAVEN_PCI_DEVICE); } =20 static void raven_pcihost_initfn(Object *obj) @@ -277,7 +268,6 @@ static void raven_pcihost_initfn(Object *obj) PCIHostState *h =3D PCI_HOST_BRIDGE(obj); PREPPCIState *s =3D RAVEN_PCI_HOST_BRIDGE(obj); MemoryRegion *address_space_mem =3D get_system_memory(); - DeviceState *pci_dev; =20 memory_region_init(&s->pci_io, obj, "pci-io", 0x3f800000); memory_region_init_io(&s->pci_io_non_contiguous, obj, &raven_io_ops, s, @@ -314,12 +304,6 @@ static void raven_pcihost_initfn(Object *obj) pci_setup_iommu(&s->pci_bus, &raven_iommu_ops, s); =20 h->bus =3D &s->pci_bus; - - object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_RAVEN_PCI_DEVI= CE); - pci_dev =3D DEVICE(&s->pci_dev); - object_property_set_int(OBJECT(&s->pci_dev), "addr", PCI_DEVFN(0, 0), - NULL); - qdev_prop_set_bit(pci_dev, "multifunction", false); } =20 static void raven_realize(PCIDevice *d, Error **errp) @@ -329,16 +313,6 @@ static void raven_realize(PCIDevice *d, Error **errp) d->config[PCI_CAPABILITY_LIST] =3D 0x00; } =20 -static const VMStateDescription vmstate_raven =3D { - .name =3D "raven", - .version_id =3D 0, - .minimum_version_id =3D 0, - .fields =3D (const VMStateField[]) { - VMSTATE_PCI_DEVICE(dev, RavenPCIState), - VMSTATE_END_OF_LIST() - }, -}; - static void raven_class_init(ObjectClass *klass, const void *data) { PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); @@ -350,7 +324,6 @@ static void raven_class_init(ObjectClass *klass, const = void *data) k->revision =3D 0x00; k->class_id =3D PCI_CLASS_BRIDGE_HOST; dc->desc =3D "PReP Host Bridge - Motorola Raven"; - dc->vmsd =3D &vmstate_raven; /* * Reason: PCI-facing part of the host bridge, not usable without * the host-facing part, which can't be device_add'ed, yet. @@ -361,7 +334,6 @@ static void raven_class_init(ObjectClass *klass, const = void *data) static const TypeInfo raven_info =3D { .name =3D TYPE_RAVEN_PCI_DEVICE, .parent =3D TYPE_PCI_DEVICE, - .instance_size =3D sizeof(RavenPCIState), .class_init =3D raven_class_init, .interfaces =3D (const InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374543190361.0610510779013; Sun, 4 May 2025 09:02:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbmf-0004wr-LF; Sun, 04 May 2025 12:01:42 -0400 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 1uBbmb-0004ow-FS; Sun, 04 May 2025 12:01:37 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmY-0004Ad-CY; Sun, 04 May 2025 12:01:37 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id B404155D237; Sun, 04 May 2025 18:01:32 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id rDJsTQnawBZ5; Sun, 4 May 2025 18:01:30 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id C935E55D230; Sun, 04 May 2025 18:01:30 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: <04bbdb7bcec7a4f1f88a903d782fd8737c7b8036.1746374076.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 04/16] hw/pci-host/raven: Simplify host bridge type declaration To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:30 +0200 (CEST) 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.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-ZM-MESSAGEID: 1746374546743116600 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use OBJECT_DECLARE_SIMPLE_TYPE macro instead of open coding it. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/raven.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index 172f01694c..878c915de5 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -39,11 +39,9 @@ #define TYPE_RAVEN_PCI_DEVICE "raven" #define TYPE_RAVEN_PCI_HOST_BRIDGE "raven-pcihost" =20 -typedef struct PRePPCIState PREPPCIState; -DECLARE_INSTANCE_CHECKER(PREPPCIState, RAVEN_PCI_HOST_BRIDGE, - TYPE_RAVEN_PCI_HOST_BRIDGE) +OBJECT_DECLARE_SIMPLE_TYPE(PREPPCIState, RAVEN_PCI_HOST_BRIDGE) =20 -struct PRePPCIState { +struct PREPPCIState { PCIHostState parent_obj; =20 OrIRQState *or_irq; --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374660481162.3320112148433; Sun, 4 May 2025 09:04:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbmp-0005Ge-Uh; Sun, 04 May 2025 12:01:51 -0400 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 1uBbmd-0004uu-KA; Sun, 04 May 2025 12:01:40 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmb-0004B9-HU; Sun, 04 May 2025 12:01:39 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id CFCB155D230; Sun, 04 May 2025 18:01:33 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id WaQYCQ-C9KKP; Sun, 4 May 2025 18:01:31 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id D4B1C55D234; Sun, 04 May 2025 18:01:31 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: <30b02e0496b76d640f222cfac492d73dbcc2b099.1746374076.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 05/16] hw/pci-host/raven: Use DEFINE_TYPES macro To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:31 +0200 (CEST) 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.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-ZM-MESSAGEID: 1746374663249019000 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Convert to using DEFINE_TYPES macro and move raven_pcihost_class_init so methods of each object are grouped together. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/raven.c | 57 +++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index 878c915de5..e0f98afebf 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -304,6 +304,15 @@ static void raven_pcihost_initfn(Object *obj) h->bus =3D &s->pci_bus; } =20 +static void raven_pcihost_class_init(ObjectClass *klass, const void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); + dc->realize =3D raven_pcihost_realizefn; + dc->fw_name =3D "pci"; +} + static void raven_realize(PCIDevice *d, Error **errp) { d->config[PCI_CACHE_LINE_SIZE] =3D 0x08; @@ -329,37 +338,23 @@ static void raven_class_init(ObjectClass *klass, cons= t void *data) dc->user_creatable =3D false; } =20 -static const TypeInfo raven_info =3D { - .name =3D TYPE_RAVEN_PCI_DEVICE, - .parent =3D TYPE_PCI_DEVICE, - .class_init =3D raven_class_init, - .interfaces =3D (const InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, +static const TypeInfo raven_types[] =3D { + { + .name =3D TYPE_RAVEN_PCI_HOST_BRIDGE, + .parent =3D TYPE_PCI_HOST_BRIDGE, + .instance_size =3D sizeof(PREPPCIState), + .instance_init =3D raven_pcihost_initfn, + .class_init =3D raven_pcihost_class_init, + }, + { + .name =3D TYPE_RAVEN_PCI_DEVICE, + .parent =3D TYPE_PCI_DEVICE, + .class_init =3D raven_class_init, + .interfaces =3D (const InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, }, }; =20 -static void raven_pcihost_class_init(ObjectClass *klass, const void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - - set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); - dc->realize =3D raven_pcihost_realizefn; - dc->fw_name =3D "pci"; -} - -static const TypeInfo raven_pcihost_info =3D { - .name =3D TYPE_RAVEN_PCI_HOST_BRIDGE, - .parent =3D TYPE_PCI_HOST_BRIDGE, - .instance_size =3D sizeof(PREPPCIState), - .instance_init =3D raven_pcihost_initfn, - .class_init =3D raven_pcihost_class_init, -}; - -static void raven_register_types(void) -{ - type_register_static(&raven_pcihost_info); - type_register_static(&raven_info); -} - -type_init(raven_register_types) +DEFINE_TYPES(raven_types) --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374558878328.0922475677718; Sun, 4 May 2025 09:02:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbmo-0005E7-D4; Sun, 04 May 2025 12:01:50 -0400 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 1uBbmd-0004uw-MS; Sun, 04 May 2025 12:01:40 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmb-0004BA-Iv; Sun, 04 May 2025 12:01:39 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id DF1F155D234; Sun, 04 May 2025 18:01:34 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id Q4UNgzUt1Dfr; Sun, 4 May 2025 18:01:32 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id E45E655D238; Sun, 04 May 2025 18:01:32 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: <92c00cd77ced8775c80116878094295a19fd4255.1746374076.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 06/16] hw/pci-host/raven: Simplify PCI bus creation To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:32 +0200 (CEST) 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.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-ZM-MESSAGEID: 1746374560162116600 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Instead of doing it manually use pci_register_root_bus() to create and register the PCI bus. Signed-off-by: BALATON Zoltan --- hw/pci-host/raven.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index e0f98afebf..51427553b2 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -46,7 +46,6 @@ struct PREPPCIState { =20 OrIRQState *or_irq; qemu_irq pci_irqs[PCI_NUM_PINS]; - PCIBus pci_bus; AddressSpace pci_io_as; MemoryRegion pci_io; MemoryRegion pci_io_non_contiguous; @@ -239,8 +238,9 @@ static void raven_pcihost_realizefn(DeviceState *d, Err= or **errp) =20 qdev_init_gpio_in(d, raven_change_gpio, 1); =20 - pci_bus_irqs(&s->pci_bus, raven_set_irq, s, PCI_NUM_PINS); - pci_bus_map_irqs(&s->pci_bus, raven_map_irq); + h->bus =3D pci_register_root_bus(d, NULL, raven_set_irq, raven_map_irq, + s, &s->pci_memory, &s->pci_io, 0, 4, + TYPE_PCI_BUS); =20 memory_region_init_io(&h->conf_mem, OBJECT(h), &pci_host_conf_le_ops, = s, "pci-conf-idx", 4); @@ -258,12 +258,14 @@ static void raven_pcihost_realizefn(DeviceState *d, E= rror **errp) "pci-intack", 1); memory_region_add_subregion(address_space_mem, 0xbffffff0, &s->pci_int= ack); =20 - pci_create_simple(&s->pci_bus, PCI_DEVFN(0, 0), TYPE_RAVEN_PCI_DEVICE); + pci_create_simple(h->bus, PCI_DEVFN(0, 0), TYPE_RAVEN_PCI_DEVICE); + + address_space_init(&s->bm_as, &s->bm, "raven-bm"); + pci_setup_iommu(h->bus, &raven_iommu_ops, s); } =20 static void raven_pcihost_initfn(Object *obj) { - PCIHostState *h =3D PCI_HOST_BRIDGE(obj); PREPPCIState *s =3D RAVEN_PCI_HOST_BRIDGE(obj); MemoryRegion *address_space_mem =3D get_system_memory(); =20 @@ -286,8 +288,6 @@ static void raven_pcihost_initfn(Object *obj) memory_region_add_subregion_overlap(address_space_mem, PCI_IO_BASE_ADD= R, &s->pci_io_non_contiguous, 1); memory_region_add_subregion(address_space_mem, 0xc0000000, &s->pci_mem= ory); - pci_root_bus_init(&s->pci_bus, sizeof(s->pci_bus), DEVICE(obj), NULL, - &s->pci_memory, &s->pci_io, 0, TYPE_PCI_BUS); =20 /* Bus master address space */ memory_region_init(&s->bm, obj, "bm-raven", 4 * GiB); @@ -298,10 +298,6 @@ static void raven_pcihost_initfn(Object *obj) get_system_memory(), 0, 0x80000000); memory_region_add_subregion(&s->bm, 0 , &s->bm_pci_memory_alia= s); memory_region_add_subregion(&s->bm, 0x80000000, &s->bm_ram_alias); - address_space_init(&s->bm_as, &s->bm, "raven-bm"); - pci_setup_iommu(&s->pci_bus, &raven_iommu_ops, s); - - h->bus =3D &s->pci_bus; } =20 static void raven_pcihost_class_init(ObjectClass *klass, const void *data) --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374874234480.36367127674055; Sun, 4 May 2025 09:07:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbms-0005KQ-2a; Sun, 04 May 2025 12:01:54 -0400 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 1uBbmf-0004xA-4C; Sun, 04 May 2025 12:01:41 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmb-0004BJ-JV; Sun, 04 May 2025 12:01:40 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id EF7EA55D238; Sun, 04 May 2025 18:01:35 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id LteAur2GItcj; Sun, 4 May 2025 18:01:33 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id EF04E55D23A; Sun, 04 May 2025 18:01:33 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 07/16] hw/pci-host/raven: Simplify PCI interrupt routing To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:33 +0200 (CEST) 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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-ZM-MESSAGEID: 1746374874968019000 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" No need to use an or-irq to map interrupt lines to a single IRQ as the PCI code can handle this internally so simplify by dropping the or-irq. Signed-off-by: BALATON Zoltan --- hw/pci-host/raven.c | 39 +++++++++++++++------------------------ hw/ppc/prep.c | 5 ++++- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index 51427553b2..a400a22df3 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -30,11 +30,8 @@ #include "hw/pci/pci_device.h" #include "hw/pci/pci_bus.h" #include "hw/pci/pci_host.h" -#include "hw/qdev-properties.h" #include "hw/intc/i8259.h" #include "hw/irq.h" -#include "hw/or-irq.h" -#include "qom/object.h" =20 #define TYPE_RAVEN_PCI_DEVICE "raven" #define TYPE_RAVEN_PCI_HOST_BRIDGE "raven-pcihost" @@ -44,8 +41,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(PREPPCIState, RAVEN_PCI_HOST_B= RIDGE) struct PREPPCIState { PCIHostState parent_obj; =20 - OrIRQState *or_irq; - qemu_irq pci_irqs[PCI_NUM_PINS]; + qemu_irq irq; AddressSpace pci_io_as; MemoryRegion pci_io; MemoryRegion pci_io_non_contiguous; @@ -183,16 +179,25 @@ static const MemoryRegionOps raven_io_ops =3D { .valid.unaligned =3D true, }; =20 +/* + * All four IRQ[ABCD] pins from all slots are tied to a single board + * IRQ, so our mapping function here maps everything to IRQ 0. + * The code in pci_change_irq_level() tracks the number of times + * the mapped IRQ is asserted and deasserted, so if multiple devices + * assert an IRQ at the same time the behaviour is correct. + * + * This may need further refactoring for boards that use multiple IRQ line= s. + */ static int raven_map_irq(PCIDevice *pci_dev, int irq_num) { - return (irq_num + (pci_dev->devfn >> 3)) & 1; + return 0; } =20 static void raven_set_irq(void *opaque, int irq_num, int level) { - PREPPCIState *s =3D opaque; + qemu_irq *irq =3D opaque; =20 - qemu_set_irq(s->pci_irqs[irq_num], level); + qemu_set_irq(*irq, level); } =20 static AddressSpace *raven_pcihost_set_iommu(PCIBus *bus, void *opaque, @@ -220,26 +225,12 @@ static void raven_pcihost_realizefn(DeviceState *d, E= rror **errp) PCIHostState *h =3D PCI_HOST_BRIDGE(dev); PREPPCIState *s =3D RAVEN_PCI_HOST_BRIDGE(dev); MemoryRegion *address_space_mem =3D get_system_memory(); - int i; - - /* - * According to PReP specification section 6.1.6 "System Interrupt - * Assignments", all PCI interrupts are routed via IRQ 15 - */ - s->or_irq =3D OR_IRQ(object_new(TYPE_OR_IRQ)); - object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS, - &error_fatal); - qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal); - sysbus_init_irq(dev, &s->or_irq->out_irq); - - for (i =3D 0; i < PCI_NUM_PINS; i++) { - s->pci_irqs[i] =3D qdev_get_gpio_in(DEVICE(s->or_irq), i); - } =20 qdev_init_gpio_in(d, raven_change_gpio, 1); =20 + sysbus_init_irq(dev, &s->irq); h->bus =3D pci_register_root_bus(d, NULL, raven_set_irq, raven_map_irq, - s, &s->pci_memory, &s->pci_io, 0, 4, + &s->irq, &s->pci_memory, &s->pci_io, 0,= 1, TYPE_PCI_BUS); =20 memory_region_init_io(&h->conf_mem, OBJECT(h), &pci_host_conf_le_ops, = s, diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 982e40e53e..d3365414d2 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -304,7 +304,10 @@ static void ibm_40p_init(MachineState *machine) qdev_realize_and_unref(i82378_dev, BUS(pci_bus), &error_fatal); qdev_connect_gpio_out(i82378_dev, 0, qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_INT)); - + /* + * According to PReP specification section 6.1.6 "System Interrupt + * Assignments", all PCI interrupts are routed via IRQ 15 + */ sysbus_connect_irq(pcihost, 0, qdev_get_gpio_in(i82378_dev, 15)); isa_bus =3D ISA_BUS(qdev_get_child_bus(i82378_dev, "isa.0")); =20 --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374639782325.3238224337339; Sun, 4 May 2025 09:03:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbmt-0005Ps-T3; Sun, 04 May 2025 12:01:55 -0400 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 1uBbmf-0004xB-8F; Sun, 04 May 2025 12:01:41 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmc-0004Bc-GN; Sun, 04 May 2025 12:01:40 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id EA3BD55D235; Sun, 04 May 2025 18:01:36 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id cw3LaJhPX7XG; Sun, 4 May 2025 18:01:35 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 060E055D23B; Sun, 04 May 2025 18:01:35 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 08/16] hw/pci-host/raven: Simplify direct config access address decoding To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:35 +0200 (CEST) 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.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-ZM-MESSAGEID: 1746374641729019000 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use ctz instead of an open coded version and rename function to better show what it does. Signed-off-by: BALATON Zoltan --- hw/pci-host/raven.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index a400a22df3..66dab28a29 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -57,16 +57,9 @@ struct PREPPCIState { =20 #define PCI_IO_BASE_ADDR 0x80000000 /* Physical address on main bus */ =20 -static inline uint32_t raven_pci_io_config(hwaddr addr) +static inline uint32_t raven_idsel_to_addr(hwaddr addr) { - int i; - - for (i =3D 0; i < 11; i++) { - if ((addr & (1 << (11 + i))) !=3D 0) { - break; - } - } - return (addr & 0x7ff) | (i << 11); + return (ctz16(addr >> 11) << 11) | (addr & 0x7ff); } =20 static void raven_pci_io_write(void *opaque, hwaddr addr, @@ -74,7 +67,7 @@ static void raven_pci_io_write(void *opaque, hwaddr addr, { PREPPCIState *s =3D opaque; PCIHostState *phb =3D PCI_HOST_BRIDGE(s); - pci_data_write(phb->bus, raven_pci_io_config(addr), val, size); + pci_data_write(phb->bus, raven_idsel_to_addr(addr), val, size); } =20 static uint64_t raven_pci_io_read(void *opaque, hwaddr addr, @@ -82,7 +75,7 @@ static uint64_t raven_pci_io_read(void *opaque, hwaddr ad= dr, { PREPPCIState *s =3D opaque; PCIHostState *phb =3D PCI_HOST_BRIDGE(s); - return pci_data_read(phb->bus, raven_pci_io_config(addr), size); + return pci_data_read(phb->bus, raven_idsel_to_addr(addr), size); } =20 static const MemoryRegionOps raven_pci_io_ops =3D { --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 174637466053451.58315632152244; Sun, 4 May 2025 09:04:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbmn-0005D7-MI; Sun, 04 May 2025 12:01:50 -0400 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 1uBbmf-0004yo-QW; Sun, 04 May 2025 12:01:42 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmd-0004C6-SN; Sun, 04 May 2025 12:01:41 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 01E5D55D23B; Sun, 04 May 2025 18:01:38 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id Pd2EdJe33L8X; Sun, 4 May 2025 18:01:36 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 117BB55D22E; Sun, 04 May 2025 18:01:36 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 09/16] hw/pci-host/raven: Rename direct config access ops To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:36 +0200 (CEST) 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.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-ZM-MESSAGEID: 1746374663237019000 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Rename memory io ops implementing PCI configuration direct access to mmcfg which describes better what these are for. Signed-off-by: BALATON Zoltan --- hw/pci-host/raven.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index 66dab28a29..d7a0bde382 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -62,25 +62,24 @@ static inline uint32_t raven_idsel_to_addr(hwaddr addr) return (ctz16(addr >> 11) << 11) | (addr & 0x7ff); } =20 -static void raven_pci_io_write(void *opaque, hwaddr addr, - uint64_t val, unsigned int size) +static void raven_mmcfg_write(void *opaque, hwaddr addr, uint64_t val, + unsigned int size) { PREPPCIState *s =3D opaque; PCIHostState *phb =3D PCI_HOST_BRIDGE(s); pci_data_write(phb->bus, raven_idsel_to_addr(addr), val, size); } =20 -static uint64_t raven_pci_io_read(void *opaque, hwaddr addr, - unsigned int size) +static uint64_t raven_mmcfg_read(void *opaque, hwaddr addr, unsigned int s= ize) { PREPPCIState *s =3D opaque; PCIHostState *phb =3D PCI_HOST_BRIDGE(s); return pci_data_read(phb->bus, raven_idsel_to_addr(addr), size); } =20 -static const MemoryRegionOps raven_pci_io_ops =3D { - .read =3D raven_pci_io_read, - .write =3D raven_pci_io_write, +static const MemoryRegionOps raven_mmcfg_ops =3D { + .read =3D raven_mmcfg_read, + .write =3D raven_mmcfg_write, .endianness =3D DEVICE_LITTLE_ENDIAN, }; =20 @@ -234,8 +233,8 @@ static void raven_pcihost_realizefn(DeviceState *d, Err= or **errp) "pci-conf-data", 4); memory_region_add_subregion(&s->pci_io, 0xcfc, &h->data_mem); =20 - memory_region_init_io(&h->mmcfg, OBJECT(s), &raven_pci_io_ops, s, - "pciio", 0x00400000); + memory_region_init_io(&h->mmcfg, OBJECT(s), &raven_mmcfg_ops, s, + "pci-mmcfg", 0x00400000); memory_region_add_subregion(address_space_mem, 0x80800000, &h->mmcfg); =20 memory_region_init_io(&s->pci_intack, OBJECT(s), &raven_intack_ops, s, --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374668285524.3394138988059; Sun, 4 May 2025 09:04:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbmv-0005S7-Ft; Sun, 04 May 2025 12:01:57 -0400 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 1uBbmg-0004zX-Fb; Sun, 04 May 2025 12:01:44 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbme-0004CF-PA; Sun, 04 May 2025 12:01:42 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 0AFD355D22E; Sun, 04 May 2025 18:01:39 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id gMeVB5h61AKH; Sun, 4 May 2025 18:01:37 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 1A72C55D23A; Sun, 04 May 2025 18:01:37 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: <6205b7eb571626ccc7fb017132e705a49fa3a6ff.1746374076.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 10/16] hw/pci-host/raven: Use correct parameter in direct access ops To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:37 +0200 (CEST) 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.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-ZM-MESSAGEID: 1746374670316019000 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Instead of passing unneeded enclosing objects to the config direct access ops that only need the bus we can pass that directly thus simplifying the functions. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/raven.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index d7a0bde382..c39e95b45f 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -65,16 +65,12 @@ static inline uint32_t raven_idsel_to_addr(hwaddr addr) static void raven_mmcfg_write(void *opaque, hwaddr addr, uint64_t val, unsigned int size) { - PREPPCIState *s =3D opaque; - PCIHostState *phb =3D PCI_HOST_BRIDGE(s); - pci_data_write(phb->bus, raven_idsel_to_addr(addr), val, size); + pci_data_write(opaque, raven_idsel_to_addr(addr), val, size); } =20 static uint64_t raven_mmcfg_read(void *opaque, hwaddr addr, unsigned int s= ize) { - PREPPCIState *s =3D opaque; - PCIHostState *phb =3D PCI_HOST_BRIDGE(s); - return pci_data_read(phb->bus, raven_idsel_to_addr(addr), size); + return pci_data_read(opaque, raven_idsel_to_addr(addr), size); } =20 static const MemoryRegionOps raven_mmcfg_ops =3D { @@ -233,7 +229,7 @@ static void raven_pcihost_realizefn(DeviceState *d, Err= or **errp) "pci-conf-data", 4); memory_region_add_subregion(&s->pci_io, 0xcfc, &h->data_mem); =20 - memory_region_init_io(&h->mmcfg, OBJECT(s), &raven_mmcfg_ops, s, + memory_region_init_io(&h->mmcfg, OBJECT(h), &raven_mmcfg_ops, h->bus, "pci-mmcfg", 0x00400000); memory_region_add_subregion(address_space_mem, 0x80800000, &h->mmcfg); =20 --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374628553209.33010764264304; Sun, 4 May 2025 09:03:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbmu-0005Qm-BG; Sun, 04 May 2025 12:01:56 -0400 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 1uBbmh-0004zi-Ed; Sun, 04 May 2025 12:01:44 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmf-0004CZ-OH; Sun, 04 May 2025 12:01:43 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 22E8F55D237; Sun, 04 May 2025 18:01:40 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id DGHbgXzqioK5; Sun, 4 May 2025 18:01:38 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 2D6AF55D21A; Sun, 04 May 2025 18:01:38 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: <104976fab9e144328dd9c73efceeb75a759a83f7.1746374076.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 11/16] hw/pci-host/raven: Do not use parent object for mmcfg region To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:38 +0200 (CEST) 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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-ZM-MESSAGEID: 1746374630184116600 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The mmcfg field in PCIHostState is only used by raven for the PCI config direct access but is not actually needed as the memory region lifetime can be managed by the object given during init so use that and remove the unused field from PCIHostState. Signed-off-by: BALATON Zoltan --- hw/pci-host/raven.c | 7 ++++--- include/hw/pci/pci_host.h | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index c39e95b45f..7550c291c6 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -212,7 +212,7 @@ static void raven_pcihost_realizefn(DeviceState *d, Err= or **errp) SysBusDevice *dev =3D SYS_BUS_DEVICE(d); PCIHostState *h =3D PCI_HOST_BRIDGE(dev); PREPPCIState *s =3D RAVEN_PCI_HOST_BRIDGE(dev); - MemoryRegion *address_space_mem =3D get_system_memory(); + MemoryRegion *mr, *address_space_mem =3D get_system_memory(); =20 qdev_init_gpio_in(d, raven_change_gpio, 1); =20 @@ -229,9 +229,10 @@ static void raven_pcihost_realizefn(DeviceState *d, Er= ror **errp) "pci-conf-data", 4); memory_region_add_subregion(&s->pci_io, 0xcfc, &h->data_mem); =20 - memory_region_init_io(&h->mmcfg, OBJECT(h), &raven_mmcfg_ops, h->bus, + mr =3D g_new0(MemoryRegion, 1); + memory_region_init_io(mr, OBJECT(h), &raven_mmcfg_ops, h->bus, "pci-mmcfg", 0x00400000); - memory_region_add_subregion(address_space_mem, 0x80800000, &h->mmcfg); + memory_region_add_subregion(address_space_mem, 0x80800000, mr); =20 memory_region_init_io(&s->pci_intack, OBJECT(s), &raven_intack_ops, s, "pci-intack", 1); diff --git a/include/hw/pci/pci_host.h b/include/hw/pci/pci_host.h index e52d8ec2cd..7c0285e2ff 100644 --- a/include/hw/pci/pci_host.h +++ b/include/hw/pci/pci_host.h @@ -41,7 +41,6 @@ struct PCIHostState { =20 MemoryRegion conf_mem; MemoryRegion data_mem; - MemoryRegion mmcfg; uint32_t config_reg; bool mig_enabled; PCIBus *bus; --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374655838899.7938649127412; Sun, 4 May 2025 09:04:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbmm-00058l-0j; Sun, 04 May 2025 12:01:48 -0400 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 1uBbmi-0004zr-FT; Sun, 04 May 2025 12:01:44 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmg-0004Cz-Rj; Sun, 04 May 2025 12:01:44 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 3027E55D21A; Sun, 04 May 2025 18:01:41 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id dzntd0URU0ww; Sun, 4 May 2025 18:01:39 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 3867855D233; Sun, 04 May 2025 18:01:39 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: <24056115eec7fc376d1520283122f9191bdb0553.1746374076.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 12/16] hw/pci-host/raven: Fix PCI config direct access region To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:39 +0200 (CEST) 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.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-ZM-MESSAGEID: 1746374656260019000 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The PCI configuration direct access region occupies 8 MiB at offset 0x800000 in PCI IO space so model that accordingly. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/raven.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index 7550c291c6..318400c595 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -231,8 +231,8 @@ static void raven_pcihost_realizefn(DeviceState *d, Err= or **errp) =20 mr =3D g_new0(MemoryRegion, 1); memory_region_init_io(mr, OBJECT(h), &raven_mmcfg_ops, h->bus, - "pci-mmcfg", 0x00400000); - memory_region_add_subregion(address_space_mem, 0x80800000, mr); + "pci-mmcfg", 8 * MiB); + memory_region_add_subregion(&s->pci_io, 0x800000, mr); =20 memory_region_init_io(&s->pci_intack, OBJECT(s), &raven_intack_ops, s, "pci-intack", 1); --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374873774615.1783052773148; Sun, 4 May 2025 09:07:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbms-0005LG-LC; Sun, 04 May 2025 12:01:54 -0400 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 1uBbmj-00054e-Ru; Sun, 04 May 2025 12:01:46 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmh-0004DM-Rn; Sun, 04 May 2025 12:01:45 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 399C455D233; Sun, 04 May 2025 18:01:42 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id tjCJE73rT7ND; Sun, 4 May 2025 18:01:40 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 43B3D55D230; Sun, 04 May 2025 18:01:40 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: <46d59935aa5be7b14260dc480b8b917d44bdaaf1.1746374076.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 13/16] hw/pci-host/raven: Simpify discontiguous IO access To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:40 +0200 (CEST) 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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-ZM-MESSAGEID: 1746374875090019000 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" PREP allows remapping of the 64k ISA IO addresses from the normal contiguous IO space into a discontiguous 8MB region and can switch between the two modes. We can implement this in a simpler way than is done currently using an io region that forwards access to the contiguous pci_io region and enabling/disabling the discontiguous region as needed. Signed-off-by: BALATON Zoltan --- hw/pci-host/raven.c | 88 ++++++++++++--------------------------------- 1 file changed, 22 insertions(+), 66 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index 318400c595..476ae5bc65 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -42,17 +42,14 @@ struct PREPPCIState { PCIHostState parent_obj; =20 qemu_irq irq; - AddressSpace pci_io_as; MemoryRegion pci_io; - MemoryRegion pci_io_non_contiguous; + MemoryRegion pci_discontiguous_io; MemoryRegion pci_memory; MemoryRegion pci_intack; MemoryRegion bm; MemoryRegion bm_ram_alias; MemoryRegion bm_pci_memory_alias; AddressSpace bm_as; - - int contiguous_map; }; =20 #define PCI_IO_BASE_ADDR 0x80000000 /* Physical address on main bus */ @@ -99,63 +96,28 @@ static const MemoryRegionOps raven_intack_ops =3D { }, }; =20 -static inline hwaddr raven_io_address(PREPPCIState *s, - hwaddr addr) +/* Convert 8 MB non-contiguous address to 64k ISA IO address */ +static inline hwaddr raven_io_addr(hwaddr addr) { - if (s->contiguous_map =3D=3D 0) { - /* 64 KB contiguous space for IOs */ - addr &=3D 0xFFFF; - } else { - /* 8 MB non-contiguous space for IOs */ - addr =3D (addr & 0x1F) | ((addr & 0x007FFF000) >> 7); - } - - /* FIXME: handle endianness switch */ - - return addr; + return ((addr & 0x007FFF000) >> 7) | (addr & 0x1F); } =20 -static uint64_t raven_io_read(void *opaque, hwaddr addr, - unsigned int size) +static uint64_t raven_io_read(void *opaque, hwaddr addr, unsigned int size) { - PREPPCIState *s =3D opaque; - uint8_t buf[4]; - - addr =3D raven_io_address(s, addr); - address_space_read(&s->pci_io_as, addr + PCI_IO_BASE_ADDR, - MEMTXATTRS_UNSPECIFIED, buf, size); - - if (size =3D=3D 1) { - return buf[0]; - } else if (size =3D=3D 2) { - return lduw_le_p(buf); - } else if (size =3D=3D 4) { - return ldl_le_p(buf); - } else { - g_assert_not_reached(); - } + uint64_t val =3D 0xffffffffULL; + + memory_region_dispatch_read(opaque, raven_io_addr(addr), &val, + size_memop(size) | MO_LE, + MEMTXATTRS_UNSPECIFIED); + return val; } =20 -static void raven_io_write(void *opaque, hwaddr addr, - uint64_t val, unsigned int size) +static void raven_io_write(void *opaque, hwaddr addr, uint64_t val, + unsigned int size) { - PREPPCIState *s =3D opaque; - uint8_t buf[4]; - - addr =3D raven_io_address(s, addr); - - if (size =3D=3D 1) { - buf[0] =3D val; - } else if (size =3D=3D 2) { - stw_le_p(buf, val); - } else if (size =3D=3D 4) { - stl_le_p(buf, val); - } else { - g_assert_not_reached(); - } - - address_space_write(&s->pci_io_as, addr + PCI_IO_BASE_ADDR, - MEMTXATTRS_UNSPECIFIED, buf, size); + memory_region_dispatch_write(opaque, raven_io_addr(addr), val, + size_memop(size) | MO_LE, + MEMTXATTRS_UNSPECIFIED); } =20 static const MemoryRegionOps raven_io_ops =3D { @@ -204,7 +166,7 @@ static void raven_change_gpio(void *opaque, int n, int = level) { PREPPCIState *s =3D opaque; =20 - s->contiguous_map =3D level; + memory_region_set_enabled(&s->pci_discontiguous_io, !!level); } =20 static void raven_pcihost_realizefn(DeviceState *d, Error **errp) @@ -250,23 +212,17 @@ static void raven_pcihost_initfn(Object *obj) MemoryRegion *address_space_mem =3D get_system_memory(); =20 memory_region_init(&s->pci_io, obj, "pci-io", 0x3f800000); - memory_region_init_io(&s->pci_io_non_contiguous, obj, &raven_io_ops, s, - "pci-io-non-contiguous", 0x00800000); + memory_region_init_io(&s->pci_discontiguous_io, obj, + &raven_io_ops, &s->pci_io, + "pci-discontiguous-io", 8 * MiB); memory_region_init(&s->pci_memory, obj, "pci-memory", 0x3f000000); - address_space_init(&s->pci_io_as, &s->pci_io, "raven-io"); - - /* - * Raven's raven_io_ops use the address-space API to access pci-conf-i= dx - * (which is also owned by the raven device). As such, mark the - * pci_io_non_contiguous as re-entrancy safe. - */ - s->pci_io_non_contiguous.disable_reentrancy_guard =3D true; =20 /* CPU address space */ memory_region_add_subregion(address_space_mem, PCI_IO_BASE_ADDR, &s->pci_io); memory_region_add_subregion_overlap(address_space_mem, PCI_IO_BASE_ADD= R, - &s->pci_io_non_contiguous, 1); + &s->pci_discontiguous_io, 1); + memory_region_set_enabled(&s->pci_discontiguous_io, false); memory_region_add_subregion(address_space_mem, 0xc0000000, &s->pci_mem= ory); =20 /* Bus master address space */ --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374651023744.7239707533035; Sun, 4 May 2025 09:04:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbmp-0005GG-9v; Sun, 04 May 2025 12:01:51 -0400 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 1uBbmk-00055s-KC; Sun, 04 May 2025 12:01:46 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmi-0004DY-Pd; Sun, 04 May 2025 12:01:46 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 4BABE55D230; Sun, 04 May 2025 18:01:43 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id RLM8-tPklq4S; Sun, 4 May 2025 18:01:41 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 5168B55D234; Sun, 04 May 2025 18:01:41 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: <2c0cea500b892a5d677547c2c8de8c268ddfff01.1746374076.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 14/16] hw/pci-host/raven: Move bus master address space creation to one place To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:41 +0200 (CEST) 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.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-ZM-MESSAGEID: 1746374652386019000 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Move the lines related to creating the bus master address space together and reduce the number of memory regions stored in the device state. These are used once to create the address space and can be tracked with their owner object so no need to keep track of them in the device state. Keep only the address space that is used later in a callback. Signed-off-by: BALATON Zoltan --- hw/pci-host/raven.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index 476ae5bc65..68d64e3a97 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -46,9 +46,6 @@ struct PREPPCIState { MemoryRegion pci_discontiguous_io; MemoryRegion pci_memory; MemoryRegion pci_intack; - MemoryRegion bm; - MemoryRegion bm_ram_alias; - MemoryRegion bm_pci_memory_alias; AddressSpace bm_as; }; =20 @@ -174,7 +171,8 @@ static void raven_pcihost_realizefn(DeviceState *d, Err= or **errp) SysBusDevice *dev =3D SYS_BUS_DEVICE(d); PCIHostState *h =3D PCI_HOST_BRIDGE(dev); PREPPCIState *s =3D RAVEN_PCI_HOST_BRIDGE(dev); - MemoryRegion *mr, *address_space_mem =3D get_system_memory(); + Object *o =3D OBJECT(d); + MemoryRegion *mr, *bm, *address_space_mem =3D get_system_memory(); =20 qdev_init_gpio_in(d, raven_change_gpio, 1); =20 @@ -183,26 +181,37 @@ static void raven_pcihost_realizefn(DeviceState *d, E= rror **errp) &s->irq, &s->pci_memory, &s->pci_io, 0,= 1, TYPE_PCI_BUS); =20 - memory_region_init_io(&h->conf_mem, OBJECT(h), &pci_host_conf_le_ops, = s, + memory_region_init_io(&h->conf_mem, o, &pci_host_conf_le_ops, s, "pci-conf-idx", 4); memory_region_add_subregion(&s->pci_io, 0xcf8, &h->conf_mem); =20 - memory_region_init_io(&h->data_mem, OBJECT(h), &pci_host_data_le_ops, = s, + memory_region_init_io(&h->data_mem, o, &pci_host_data_le_ops, s, "pci-conf-data", 4); memory_region_add_subregion(&s->pci_io, 0xcfc, &h->data_mem); =20 mr =3D g_new0(MemoryRegion, 1); - memory_region_init_io(mr, OBJECT(h), &raven_mmcfg_ops, h->bus, + memory_region_init_io(mr, o, &raven_mmcfg_ops, h->bus, "pci-mmcfg", 8 * MiB); memory_region_add_subregion(&s->pci_io, 0x800000, mr); =20 - memory_region_init_io(&s->pci_intack, OBJECT(s), &raven_intack_ops, s, + memory_region_init_io(&s->pci_intack, o, &raven_intack_ops, s, "pci-intack", 1); memory_region_add_subregion(address_space_mem, 0xbffffff0, &s->pci_int= ack); =20 pci_create_simple(h->bus, PCI_DEVFN(0, 0), TYPE_RAVEN_PCI_DEVICE); =20 - address_space_init(&s->bm_as, &s->bm, "raven-bm"); + /* Bus master address space */ + bm =3D g_new0(MemoryRegion, 1); + memory_region_init(bm, o, "raven-bm", 4 * GiB); + mr =3D g_new0(MemoryRegion, 1); + memory_region_init_alias(mr, o, "bm-pci-memory", &s->pci_memory, 0, + memory_region_size(&s->pci_memory)); + memory_region_add_subregion(bm, 0, mr); + mr =3D g_new0(MemoryRegion, 1); + memory_region_init_alias(mr, o, "bm-system", get_system_memory(), + 0, 0x80000000); + memory_region_add_subregion(bm, 0x80000000, mr); + address_space_init(&s->bm_as, bm, "raven-bm-as"); pci_setup_iommu(h->bus, &raven_iommu_ops, s); } =20 @@ -224,16 +233,6 @@ static void raven_pcihost_initfn(Object *obj) &s->pci_discontiguous_io, 1); memory_region_set_enabled(&s->pci_discontiguous_io, false); memory_region_add_subregion(address_space_mem, 0xc0000000, &s->pci_mem= ory); - - /* Bus master address space */ - memory_region_init(&s->bm, obj, "bm-raven", 4 * GiB); - memory_region_init_alias(&s->bm_pci_memory_alias, obj, "bm-pci-memory", - &s->pci_memory, 0, - memory_region_size(&s->pci_memory)); - memory_region_init_alias(&s->bm_ram_alias, obj, "bm-system", - get_system_memory(), 0, 0x80000000); - memory_region_add_subregion(&s->bm, 0 , &s->bm_pci_memory_alia= s); - memory_region_add_subregion(&s->bm, 0x80000000, &s->bm_ram_alias); } =20 static void raven_pcihost_class_init(ObjectClass *klass, const void *data) --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374542889818.9864350850095; Sun, 4 May 2025 09:02:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbmr-0005HP-LF; Sun, 04 May 2025 12:01:53 -0400 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 1uBbml-00059X-PS; Sun, 04 May 2025 12:01:47 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmj-0004Dq-VT; Sun, 04 May 2025 12:01:47 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 5C92355D234; Sun, 04 May 2025 18:01:44 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id pfVBfvaEZJSi; Sun, 4 May 2025 18:01:42 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 5D39555D238; Sun, 04 May 2025 18:01:42 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: <1e85cddcd56f2431e349d21fcf6e539a663a64c3.1746374076.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 15/16] hw/pci-host/raven: Do not map regions in init method To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:42 +0200 (CEST) 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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-ZM-MESSAGEID: 1746374546513116600 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Export memory regions as sysbus mmio regions and let the board code map them. Signed-off-by: BALATON Zoltan --- hw/pci-host/raven.c | 37 ++++++++++++------------------------- hw/ppc/prep.c | 11 +++++++++-- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index 68d64e3a97..c9df3db401 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -49,8 +49,6 @@ struct PREPPCIState { AddressSpace bm_as; }; =20 -#define PCI_IO_BASE_ADDR 0x80000000 /* Physical address on main bus */ - static inline uint32_t raven_idsel_to_addr(hwaddr addr) { return (ctz16(addr >> 11) << 11) | (addr & 0x7ff); @@ -166,7 +164,7 @@ static void raven_change_gpio(void *opaque, int n, int = level) memory_region_set_enabled(&s->pci_discontiguous_io, !!level); } =20 -static void raven_pcihost_realizefn(DeviceState *d, Error **errp) +static void raven_pcihost_realize(DeviceState *d, Error **errp) { SysBusDevice *dev =3D SYS_BUS_DEVICE(d); PCIHostState *h =3D PCI_HOST_BRIDGE(dev); @@ -176,7 +174,17 @@ static void raven_pcihost_realizefn(DeviceState *d, Er= ror **errp) =20 qdev_init_gpio_in(d, raven_change_gpio, 1); =20 + memory_region_init(&s->pci_io, o, "pci-io", 0x3f800000); + memory_region_init_io(&s->pci_discontiguous_io, o, + &raven_io_ops, &s->pci_io, + "pci-discontiguous-io", 8 * MiB); + memory_region_init(&s->pci_memory, o, "pci-memory", 0x3f000000); + + sysbus_init_mmio(dev, &s->pci_io); + sysbus_init_mmio(dev, &s->pci_discontiguous_io); + sysbus_init_mmio(dev, &s->pci_memory); sysbus_init_irq(dev, &s->irq); + h->bus =3D pci_register_root_bus(d, NULL, raven_set_irq, raven_map_irq, &s->irq, &s->pci_memory, &s->pci_io, 0,= 1, TYPE_PCI_BUS); @@ -215,32 +223,12 @@ static void raven_pcihost_realizefn(DeviceState *d, E= rror **errp) pci_setup_iommu(h->bus, &raven_iommu_ops, s); } =20 -static void raven_pcihost_initfn(Object *obj) -{ - PREPPCIState *s =3D RAVEN_PCI_HOST_BRIDGE(obj); - MemoryRegion *address_space_mem =3D get_system_memory(); - - memory_region_init(&s->pci_io, obj, "pci-io", 0x3f800000); - memory_region_init_io(&s->pci_discontiguous_io, obj, - &raven_io_ops, &s->pci_io, - "pci-discontiguous-io", 8 * MiB); - memory_region_init(&s->pci_memory, obj, "pci-memory", 0x3f000000); - - /* CPU address space */ - memory_region_add_subregion(address_space_mem, PCI_IO_BASE_ADDR, - &s->pci_io); - memory_region_add_subregion_overlap(address_space_mem, PCI_IO_BASE_ADD= R, - &s->pci_discontiguous_io, 1); - memory_region_set_enabled(&s->pci_discontiguous_io, false); - memory_region_add_subregion(address_space_mem, 0xc0000000, &s->pci_mem= ory); -} - static void raven_pcihost_class_init(ObjectClass *klass, const void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); - dc->realize =3D raven_pcihost_realizefn; + dc->realize =3D raven_pcihost_realize; dc->fw_name =3D "pci"; } =20 @@ -274,7 +262,6 @@ static const TypeInfo raven_types[] =3D { .name =3D TYPE_RAVEN_PCI_HOST_BRIDGE, .parent =3D TYPE_PCI_HOST_BRIDGE, .instance_size =3D sizeof(PREPPCIState), - .instance_init =3D raven_pcihost_initfn, .class_init =3D raven_pcihost_class_init, }, { diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index d3365414d2..23d0e1eeaa 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -53,8 +53,11 @@ =20 #define CFG_ADDR 0xf0000510 =20 -#define KERNEL_LOAD_ADDR 0x01000000 -#define INITRD_LOAD_ADDR 0x01800000 +#define KERNEL_LOAD_ADDR 0x01000000 +#define INITRD_LOAD_ADDR 0x01800000 + +#define PCI_IO_BASE_ADDR 0x80000000 +#define PCI_MEM_BASE_ADDR 0xc0000000 =20 #define BIOS_ADDR 0xfff00000 #define BIOS_SIZE (1 * MiB) @@ -293,6 +296,10 @@ static void ibm_40p_init(MachineState *machine) pcihost =3D SYS_BUS_DEVICE(dev); object_property_add_child(qdev_get_machine(), "raven", OBJECT(dev)); sysbus_realize_and_unref(pcihost, &error_fatal); + sysbus_mmio_map(pcihost, 0, PCI_IO_BASE_ADDR); + sysbus_mmio_map_overlap(pcihost, 1, PCI_IO_BASE_ADDR, 1); + memory_region_set_enabled(sysbus_mmio_get_region(pcihost, 1), false); + sysbus_mmio_map(pcihost, 2, PCI_MEM_BASE_ADDR); pci_bus =3D PCI_BUS(qdev_get_child_bus(dev, "pci.0")); if (!pci_bus) { error_report("could not create PCI host controller"); --=20 2.41.3 From nobody Tue Dec 16 02:54:45 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=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746374633279385.8597465343937; Sun, 4 May 2025 09:03:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uBbmy-0005UO-Mt; Sun, 04 May 2025 12:02:00 -0400 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 1uBbmm-0005C4-Lt; Sun, 04 May 2025 12:01:48 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uBbmk-0004ED-SD; Sun, 04 May 2025 12:01:48 -0400 Received: from zero.eik.bme.hu (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 53D7355D23A; Sun, 04 May 2025 18:01:45 +0200 (CEST) Received: from zero.eik.bme.hu ([127.0.0.1]) by zero.eik.bme.hu (zero.eik.bme.hu [127.0.0.1]) (amavisd-new, port 10028) with ESMTP id WUYX34EdIkCM; Sun, 4 May 2025 18:01:43 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 68E4655D235; Sun, 04 May 2025 18:01:43 +0200 (CEST) X-Virus-Scanned: amavisd-new at eik.bme.hu Message-ID: <26b4e976fe52243e26d495d8332186aff02d0a86.1746374076.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 16/16] hw/ppc/prep: Fix non-contiguous IO control bit To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Artyom Tarasenko , Nicholas Piggin Date: Sun, 04 May 2025 18:01:43 +0200 (CEST) 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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-ZM-MESSAGEID: 1746374634503019000 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The bit that is supposed to control if ISA IO ports are accessed with discontinuous addresses was not connected so it did nothing. We can now directly enable or disable the discontinuous region so allow the bit to function. This did not cause a problem so far as nothing seems to use this bit or discontinuous IO addresses. Signed-off-by: BALATON Zoltan --- hw/pci-host/raven.c | 9 --------- hw/ppc/prep.c | 3 +++ hw/ppc/prep_systemio.c | 14 ++++++++------ 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index c9df3db401..66ab940061 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -157,13 +157,6 @@ static const PCIIOMMUOps raven_iommu_ops =3D { .get_address_space =3D raven_pcihost_set_iommu, }; =20 -static void raven_change_gpio(void *opaque, int n, int level) -{ - PREPPCIState *s =3D opaque; - - memory_region_set_enabled(&s->pci_discontiguous_io, !!level); -} - static void raven_pcihost_realize(DeviceState *d, Error **errp) { SysBusDevice *dev =3D SYS_BUS_DEVICE(d); @@ -172,8 +165,6 @@ static void raven_pcihost_realize(DeviceState *d, Error= **errp) Object *o =3D OBJECT(d); MemoryRegion *mr, *bm, *address_space_mem =3D get_system_memory(); =20 - qdev_init_gpio_in(d, raven_change_gpio, 1); - memory_region_init(&s->pci_io, o, "pci-io", 0x3f800000); memory_region_init_io(&s->pci_discontiguous_io, o, &raven_io_ops, &s->pci_io, diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 23d0e1eeaa..678682fdd2 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -358,6 +358,9 @@ static void ibm_40p_init(MachineState *machine) dev =3D DEVICE(isa_dev); qdev_prop_set_uint32(dev, "ibm-planar-id", 0xfc); qdev_prop_set_uint32(dev, "equipment", 0xc0); + object_property_set_link(OBJECT(dev), "discontiguous-io", + OBJECT(sysbus_mmio_get_region(pcihost, 1)= ), + &error_fatal); isa_realize_and_unref(isa_dev, isa_bus, &error_fatal); =20 dev =3D DEVICE(pci_create_simple(pci_bus, PCI_DEVFN(1, 0), diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c index 41cd923b94..fe767cc4ac 100644 --- a/hw/ppc/prep_systemio.c +++ b/hw/ppc/prep_systemio.c @@ -44,9 +44,10 @@ OBJECT_DECLARE_SIMPLE_TYPE(PrepSystemIoState, PREP_SYSTE= MIO) =20 struct PrepSystemIoState { ISADevice parent_obj; + MemoryRegion ppc_parity_mem; + MemoryRegion *discontiguous_io; =20 - qemu_irq non_contiguous_io_map_irq; uint8_t sreset; /* 0x0092 */ uint8_t equipment; /* 0x080c */ uint8_t system_control; /* 0x081c */ @@ -206,8 +207,8 @@ static void prep_port0850_write(void *opaque, uint32_t = addr, uint32_t val) PrepSystemIoState *s =3D opaque; =20 trace_prep_systemio_write(addr, val); - qemu_set_irq(s->non_contiguous_io_map_irq, - val & PORT0850_IOMAP_NONCONTIGUOUS); + memory_region_set_enabled(s->discontiguous_io, + !(val & PORT0850_IOMAP_NONCONTIGUOUS)); s->iomap_type =3D val & PORT0850_IOMAP_NONCONTIGUOUS; } =20 @@ -257,10 +258,9 @@ static void prep_systemio_realize(DeviceState *dev, Er= ror **errp) PrepSystemIoState *s =3D PREP_SYSTEMIO(dev); PowerPCCPU *cpu; =20 - qdev_init_gpio_out(dev, &s->non_contiguous_io_map_irq, 1); s->iomap_type =3D PORT0850_IOMAP_NONCONTIGUOUS; - qemu_set_irq(s->non_contiguous_io_map_irq, - s->iomap_type & PORT0850_IOMAP_NONCONTIGUOUS); + memory_region_set_enabled(s->discontiguous_io, + !(s->iomap_type & PORT0850_IOMAP_NONCONTIGUO= US)); cpu =3D POWERPC_CPU(first_cpu); s->softreset_irq =3D qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_HRESET= ); =20 @@ -288,6 +288,8 @@ static const VMStateDescription vmstate_prep_systemio = =3D { static const Property prep_systemio_properties[] =3D { DEFINE_PROP_UINT8("ibm-planar-id", PrepSystemIoState, ibm_planar_id, 0= ), DEFINE_PROP_UINT8("equipment", PrepSystemIoState, equipment, 0), + DEFINE_PROP_LINK("discontiguous-io", PrepSystemIoState, discontiguous_= io, + TYPE_MEMORY_REGION, MemoryRegion *), }; =20 static void prep_systemio_class_initfn(ObjectClass *klass, const void *dat= a) --=20 2.41.3