From nobody Fri Apr 3 20:53:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1774261808; cv=none; d=zohomail.com; s=zohoarc; b=nhzQA7HPShMuVJBzIKbfxoRxLMFZ2vOlgg+0vScv0reJ/hq1L2iIxpO43sAKm6dPr00gSrSE0S5W5oDo7uJl7ovWvvrkWsDvYML6dIhmCQnnrn6fARvlDjlQa9HmUV6pc3Qn81+vVyW4GmgpwLnPz6f7fbXlYvldXZ7DyWKODnU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774261808; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=b6P1feMDdwcFxEciBW2XMAB2VUtIVlNsPJjXIjnBwqc=; b=HaQDuXjIrg2npRZU1qGkhbtNVN7D/If44w/RstOJcc1R1jmyYuZWkFd99qekjY930uUlXQlJd1P0bdRDt6K+RrBB+30bxZ78HrIEpHuk8klri4G1M8hhmENzlaOW15RAg+NHHWo6jdYUtcrT+OkAPCBGbPXfxnJSglll9BxjbA8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177426180895597.65849390563801; Mon, 23 Mar 2026 03:30:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w4cXR-0002zp-9K; Mon, 23 Mar 2026 06:29:37 -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 1w4cXN-0002yk-If for qemu-devel@nongnu.org; Mon, 23 Mar 2026 06:29:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w4cXL-0008DX-CE for qemu-devel@nongnu.org; Mon, 23 Mar 2026 06:29:33 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-479-l3lPZHxnOoSqbSgMk50nRQ-1; Mon, 23 Mar 2026 06:29:27 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2729119560AF; Mon, 23 Mar 2026 10:29:26 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8DCA530001BB; Mon, 23 Mar 2026 10:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774261770; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b6P1feMDdwcFxEciBW2XMAB2VUtIVlNsPJjXIjnBwqc=; b=EKWUtkt9mpSiGtJM24HjH0UW+m2GIeC3V6dIYYYwI8Qx+ZpG8c1vWqK7SkFxH1qjTOUV1X Ez8jSz72mMIG2JHuFaNQOFzfs11xdd+BHo5oNfvR7Jrcijz9bqDYgwZIIu3exEXYNJ8j5r 7PhniY0tWT4id9anp0kafc/s0G6znno= X-MC-Unique: l3lPZHxnOoSqbSgMk50nRQ-1 X-Mimecast-MFC-AGG-ID: l3lPZHxnOoSqbSgMk50nRQ_1774261766 From: Thomas Huth To: Peter Maydell Cc: qemu-devel@nongnu.org, Markus Armbruster Subject: [PULL 1/6] hw/pci-host/raven: Fix crash when introspecting raven-pcihost from the CLI Date: Mon, 23 Mar 2026 11:29:15 +0100 Message-ID: <20260323102920.25170-2-thuth@redhat.com> In-Reply-To: <20260323102920.25170-1-thuth@redhat.com> References: <20260323102920.25170-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1774261811760154100 Content-Type: text/plain; charset="utf-8" From: Thomas Huth QEMU currently crashes when introspecting raven-pcihost from the command line interface: $ ./qemu-system-ppc -device raven-pcihost,help Segmentation fault (core dumped) This happens because the raven_pcihost_initfn instance init function calls get_system_memory(), but that is not available here yet. There does not seem to be a compelling reason for initializing the memory regions from the instance init function, so let's simply move the code into the realize() function instead to fix this issue. Tested-by: Markus Armbruster Signed-off-by: Thomas Huth Message-ID: <20260317074049.436460-1-thuth@redhat.com> --- hw/pci-host/raven.c | 68 +++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 37 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index b3c2678667a..b3836dc9a28 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -212,8 +212,39 @@ static void raven_pcihost_realizefn(DeviceState *d, Er= ror **errp) PCIHostState *h =3D PCI_HOST_BRIDGE(dev); PREPPCIState *s =3D RAVEN_PCI_HOST_BRIDGE(dev); MemoryRegion *address_space_mem =3D get_system_memory(); + Object *obj =3D OBJECT(d); int i; =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(&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; + + /* 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); + 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", + address_space_mem, 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); + /* * According to PReP specification section 6.1.6 "System Interrupt * Assignments", all PCI interrupts are routed via IRQ 15 @@ -256,42 +287,6 @@ static void raven_pcihost_realizefn(DeviceState *d, Er= ror **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_io_non_contiguous, obj, &raven_io_ops, s, - "pci-io-non-contiguous", 0x00800000); - 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; - - /* 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); - 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); -} - static void raven_pcihost_class_init(ObjectClass *klass, const void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -330,7 +325,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, }, { --=20 2.53.0 From nobody Fri Apr 3 20:53:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1774261875; cv=none; d=zohomail.com; s=zohoarc; b=OoGIO99W1wLd3fkt5PtxO1o0rQydnIAiRw6hZgLlBHtjNbB9O5Sxj4Xkoj39JodW382qjJqebhiAa84Si9TS1fpJfAvZADORBf2omFFgqKxGgWEJyzbODffFomQMkG45Nl3EqvFIvGCd7rq+cFot+BP/EiwChts81oDPZxXG7QY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774261875; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gPE0PGbUieh4H5tEywglXPgc/0vbzNmgzvnwWExdN24=; b=cfQ0VGnemoVeUdFl/Szop+drPBaK6dVM92PT73Xe71FO0iR5nnHYDg7kpjQuzZteL3xBkcgjshY7vDmiBAoKF8Af7wJ6qvazCGf8SFm0m4X3+VmieXIUSgyn733O3oS92JvcL7SrULlD+7LFcB8gjng8N5JH33+SdopndGa/BVk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774261875871805.8317389305988; Mon, 23 Mar 2026 03:31:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w4cXV-00030M-5X; Mon, 23 Mar 2026 06:29:41 -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 1w4cXP-0002zQ-Dg for qemu-devel@nongnu.org; Mon, 23 Mar 2026 06:29:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w4cXN-0008Do-L9 for qemu-devel@nongnu.org; Mon, 23 Mar 2026 06:29:34 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-582-aEnvW9e2NsScVVTxMvggMw-1; Mon, 23 Mar 2026 06:29:31 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F08E31944F2F; Mon, 23 Mar 2026 10:29:28 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2F86A300019F; Mon, 23 Mar 2026 10:29:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774261772; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gPE0PGbUieh4H5tEywglXPgc/0vbzNmgzvnwWExdN24=; b=IJB2RGFOlNU2pbQu3/DR6coaM2ZdeOUfgwllmH3wFE7Aj8sI9BHv31gStb2JsnNvpca1Rn h3pBi7KhEqz7wi8+QoKv0gHQ3/KFu5O2nqByllvAA1VRuGREAxGSORRIcMaZB34Wl5IWNa kfExlKm5uTwG6tNxGR1fcHdVRzqU5+w= X-MC-Unique: aEnvW9e2NsScVVTxMvggMw-1 X-Mimecast-MFC-AGG-ID: aEnvW9e2NsScVVTxMvggMw_1774261769 From: Thomas Huth To: Peter Maydell Cc: qemu-devel@nongnu.org, Markus Armbruster Subject: [PULL 2/6] hw/display/cg3: Fix crash when introspecting cgthree from the CLI Date: Mon, 23 Mar 2026 11:29:16 +0100 Message-ID: <20260323102920.25170-3-thuth@redhat.com> In-Reply-To: <20260323102920.25170-1-thuth@redhat.com> References: <20260323102920.25170-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1774261877016154100 Content-Type: text/plain; charset="utf-8" From: Thomas Huth QEMU currently crashes when introspecting the cgthree device from the command line interface: $ ./qemu-system-sparc -device cgthree,help Segmentation fault (core dumped) This happens because the memory_region_init_rom() function internally calls qemu_ram_alloc_internal() that needs the current_machine pointer to be set up - which is not the case here since the machine has not been created yet. There does not seem to be a compelling reason for initializing the memory regions from the instance_init function, so let's simply move the code into the realize() function instead to fix this issue. Tested-by: Markus Armbruster Signed-off-by: Thomas Huth Message-ID: <20260317080623.438230-1-thuth@redhat.com> --- hw/display/cg3.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/hw/display/cg3.c b/hw/display/cg3.c index 61bdb0552e9..0a413fbb7ec 100644 --- a/hw/display/cg3.c +++ b/hw/display/cg3.c @@ -277,10 +277,13 @@ static const GraphicHwOps cg3_ops =3D { .gfx_update =3D cg3_update_display, }; =20 -static void cg3_initfn(Object *obj) +static void cg3_realizefn(DeviceState *dev, Error **errp) { - SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); - CG3State *s =3D CG3(obj); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); + Object *obj =3D OBJECT(dev); + CG3State *s =3D CG3(dev); + int ret; + char *fcode_filename; =20 memory_region_init_rom(&s->rom, obj, "cg3.prom", FCODE_MAX_ROM_SIZE, &error_fatal); @@ -289,14 +292,6 @@ static void cg3_initfn(Object *obj) memory_region_init_io(&s->reg, obj, &cg3_reg_ops, s, "cg3.reg", CG3_REG_SIZE); sysbus_init_mmio(sbd, &s->reg); -} - -static void cg3_realizefn(DeviceState *dev, Error **errp) -{ - SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); - CG3State *s =3D CG3(dev); - int ret; - char *fcode_filename; =20 /* FCode ROM */ fcode_filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, CG3_ROM_FILE); @@ -381,7 +376,6 @@ static const TypeInfo cg3_info =3D { .name =3D TYPE_CG3, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(CG3State), - .instance_init =3D cg3_initfn, .class_init =3D cg3_class_init, }; =20 --=20 2.53.0 From nobody Fri Apr 3 20:53:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1774261839; cv=none; d=zohomail.com; s=zohoarc; b=jp2QQxUWxlSAFJ0lVFtxiNti+6k7xAQ9HicNyKA4YlSII6Qd/Tm4h0AEvoPtbIjukBjji297pB003mPllIEGRdaubD5OllfqIuhoEzWzRUcjf3DIzRx6xkXnKiUPMmXcZMu+D9TBTYExzGMt9K1qjOeZ6/N5yNphqyduFLDgppY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774261839; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=YnROsTNxHyES9AurHPzCrNFn6wWU4LohssBPpErdJYY=; b=I59TlJYZPXEeIkCSDLVJ3qII/MbCzZc3YFjs9CfyHE7k9JhUGS7cL15eZeDoZa9XS+tlNk5TVkI0G60YGms+hNAVta15cwfUNEp65YoCZrhxHWxczYlPR+vjZe8Acxr/Gx16rGQ++CqozPKLGAjZOxCap6O3MXsSUusGu+rdXgU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774261839726704.6024268203174; Mon, 23 Mar 2026 03:30:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w4cXV-00030J-3Y; Mon, 23 Mar 2026 06:29:41 -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 1w4cXQ-0002zq-PR for qemu-devel@nongnu.org; Mon, 23 Mar 2026 06:29:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w4cXP-0008E0-9g for qemu-devel@nongnu.org; Mon, 23 Mar 2026 06:29:36 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-103--VSlaN-ZOOuzU4MovGzuXA-1; Mon, 23 Mar 2026 06:29:32 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 42A79195608D; Mon, 23 Mar 2026 10:29:31 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A92C3300019F; Mon, 23 Mar 2026 10:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774261773; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YnROsTNxHyES9AurHPzCrNFn6wWU4LohssBPpErdJYY=; b=WLIXD5L7sOonIcZSS0Zu5R9duHaJymhy6kDeWCIf3EqUoXtTPkxBRiSd8JwIlNQ5V8ntZs eAc1uvS2w90Z2Dv1rFHnA2Zf6bbUWzzeu1Vlx850XJ12uPgWnI1d0EyAsLtmpeFBTO+r/N ZoWTxlW/kH4cJGM+8Dv5ElFYDosD9lE= X-MC-Unique: -VSlaN-ZOOuzU4MovGzuXA-1 X-Mimecast-MFC-AGG-ID: -VSlaN-ZOOuzU4MovGzuXA_1774261771 From: Thomas Huth To: Peter Maydell Cc: qemu-devel@nongnu.org, Markus Armbruster Subject: [PULL 3/6] hw/sparc/sun4m_iommu: Fix crash when introspecting sun4m-iommu from the CLI Date: Mon, 23 Mar 2026 11:29:17 +0100 Message-ID: <20260323102920.25170-4-thuth@redhat.com> In-Reply-To: <20260323102920.25170-1-thuth@redhat.com> References: <20260323102920.25170-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1774261842100158500 Content-Type: text/plain; charset="utf-8" From: Thomas Huth QEMU currently crashes when introspecting the sun4m-iommu device from the command line interface: $ ./qemu-system-sparc -display none -device sun4m-iommu,help qemu-system-sparc: ../../devel/qemu/system/physmem.c:1401: register_multipage: Assertion `num_pages' failed. Aborted (core dumped) There does not seem to be a compelling reason for initializing the memory regions from the instance_init function, so let's simply move the code into a realize() function instead to fix this issue. Reported-by: Markus Armbruster Tested-by: Markus Armbruster Signed-off-by: Thomas Huth Message-ID: <20260317084450.442071-1-thuth@redhat.com> --- hw/sparc/sun4m_iommu.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/sparc/sun4m_iommu.c b/hw/sparc/sun4m_iommu.c index ab5eb67072a..1534445992b 100644 --- a/hw/sparc/sun4m_iommu.c +++ b/hw/sparc/sun4m_iommu.c @@ -351,13 +351,14 @@ static void iommu_reset(DeviceState *d) s->regs[IOMMU_MASK_ID] =3D IOMMU_TS_MASK; } =20 -static void iommu_init(Object *obj) +static void iommu_realize(DeviceState *ds, Error **errp) { - IOMMUState *s =3D SUN4M_IOMMU(obj); - SysBusDevice *dev =3D SYS_BUS_DEVICE(obj); + IOMMUState *s =3D SUN4M_IOMMU(ds); + SysBusDevice *dev =3D SYS_BUS_DEVICE(ds); + Object *obj =3D OBJECT(ds); =20 memory_region_init_iommu(&s->iommu, sizeof(s->iommu), - TYPE_SUN4M_IOMMU_MEMORY_REGION, OBJECT(dev), + TYPE_SUN4M_IOMMU_MEMORY_REGION, obj, "iommu-sun4m", UINT64_MAX); address_space_init(&s->iommu_as, MEMORY_REGION(&s->iommu), "iommu-as"); =20 @@ -377,6 +378,7 @@ static void iommu_class_init(ObjectClass *klass, const = void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); =20 device_class_set_legacy_reset(dc, iommu_reset); + dc->realize =3D iommu_realize; dc->vmsd =3D &vmstate_iommu; device_class_set_props(dc, iommu_properties); } @@ -385,7 +387,6 @@ static const TypeInfo iommu_info =3D { .name =3D TYPE_SUN4M_IOMMU, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(IOMMUState), - .instance_init =3D iommu_init, .class_init =3D iommu_class_init, }; =20 --=20 2.53.0 From nobody Fri Apr 3 20:53:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1774261857; cv=none; d=zohomail.com; s=zohoarc; b=U8yRDZq7a09V/1QstZeH9zqulYif89EjS3EzON7AMDn6NfBuskD69IJpwlCK6KlHM5ypF2a7nwIXV7LmAsrgNgnL4iN/3GP6V78tNV7rt/fkk7YQxkxi1KH5M3bBbKoQ9hz6nc8vsqncUb2VuqWFiHEA9RAsPyULd4g9/YOww68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774261857; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=slhezMnjlGT9RdbBjD1s3kQcLCoZ7olpegqY4OEqyAU=; b=UHZ0f/mSMf82aLm4OxwIjSwjH4TZup+oMHUbJCsYjSNGmzmjloTJK1dqUHTyIKhBjqd+4eMNWLBhZyAHQmfNB1XGjGUaaVGTOJENeFKGmySIf53g9ib80arcDGat+v8piK/TjVqrvHLDD5g27jISQvVLsDR6y63HmKGR5wngNco= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774261857772579.6785265257871; Mon, 23 Mar 2026 03:30:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w4cXX-00032P-MU; Mon, 23 Mar 2026 06:29:43 -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 1w4cXT-00030N-TW for qemu-devel@nongnu.org; Mon, 23 Mar 2026 06:29:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w4cXS-0008Ed-FV for qemu-devel@nongnu.org; Mon, 23 Mar 2026 06:29:39 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-312-kBzbxR7fPGOxLLSXjXPhHQ-1; Mon, 23 Mar 2026 06:29:36 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 885A7183018E; Mon, 23 Mar 2026 10:29:34 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B8D69300019F; Mon, 23 Mar 2026 10:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774261777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=slhezMnjlGT9RdbBjD1s3kQcLCoZ7olpegqY4OEqyAU=; b=TkRZi9f8oADXc1wBG2P7FxF3giAMTOahQatpOjvX3y9m/WcPsEYqg4OtoTaLTebgUo0EWV tK0c4qvzQ3xxOKkzp4JLtVnuRpX9lvJxLRZq09EETTXnaYS7eQ2xsX6CezDNhSDMXC3WaV Ba0e/nC/MesEiJpYerhxhnI9E5Cjjo0= X-MC-Unique: kBzbxR7fPGOxLLSXjXPhHQ-1 X-Mimecast-MFC-AGG-ID: kBzbxR7fPGOxLLSXjXPhHQ_1774261775 From: Thomas Huth To: Peter Maydell Cc: qemu-devel@nongnu.org, Markus Armbruster Subject: [PULL 4/6] hw/sparc64/sun4u_iommu: Fix crash when introspecting sun4u-iommu from the CLI Date: Mon, 23 Mar 2026 11:29:18 +0100 Message-ID: <20260323102920.25170-5-thuth@redhat.com> In-Reply-To: <20260323102920.25170-1-thuth@redhat.com> References: <20260323102920.25170-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1774261860368158500 Content-Type: text/plain; charset="utf-8" From: Thomas Huth QEMU currently crashes when introspecting the sun4u-iommu device from the command line interface: $ ./qemu-system-sparc64 -display none -device sun4u-iommu,help qemu-system-sparc64: ../../devel/qemu/system/physmem.c:1401: register_multipage: Assertion `num_pages' failed. Aborted (core dumped) There does not seem to be a compelling reason for initializing the memory regions from the instance_init function, so let's simply move the code into a realize() function instead to fix this issue. Reported-by: Markus Armbruster Tested-by: Markus Armbruster Signed-off-by: Thomas Huth Message-ID: <20260317085839.445178-1-thuth@redhat.com> --- hw/sparc64/sun4u_iommu.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/sparc64/sun4u_iommu.c b/hw/sparc64/sun4u_iommu.c index 0188ce35d29..fe9d47b822f 100644 --- a/hw/sparc64/sun4u_iommu.c +++ b/hw/sparc64/sun4u_iommu.c @@ -290,13 +290,14 @@ static void iommu_reset(DeviceState *d) memset(s->regs, 0, IOMMU_NREGS * sizeof(uint64_t)); } =20 -static void iommu_init(Object *obj) +static void iommu_realize(DeviceState *ds, Error **errp) { - IOMMUState *s =3D SUN4U_IOMMU(obj); - SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); + IOMMUState *s =3D SUN4U_IOMMU(ds); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(ds); + Object *obj =3D OBJECT(ds); =20 memory_region_init_iommu(&s->iommu, sizeof(s->iommu), - TYPE_SUN4U_IOMMU_MEMORY_REGION, OBJECT(s), + TYPE_SUN4U_IOMMU_MEMORY_REGION, obj, "iommu-sun4u", UINT64_MAX); address_space_init(&s->iommu_as, MEMORY_REGION(&s->iommu), "iommu-as"); =20 @@ -310,13 +311,13 @@ static void iommu_class_init(ObjectClass *klass, cons= t void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); =20 device_class_set_legacy_reset(dc, iommu_reset); + dc->realize =3D iommu_realize; } =20 static const TypeInfo iommu_info =3D { .name =3D TYPE_SUN4U_IOMMU, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(IOMMUState), - .instance_init =3D iommu_init, .class_init =3D iommu_class_init, }; =20 --=20 2.53.0 From nobody Fri Apr 3 20:53:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1774261827; cv=none; d=zohomail.com; s=zohoarc; b=SBM5egdn3mS/0VO2q6CoGcBoiDyvKr02JTCgnwAiCwJluv9PEGjp4EQrjd1L68ZqgIaHO2qWjzUZBHwKdIJeDQHKcmZjJ5g2rpXaYEK0cN/Hkp4KcTKLj0qC6VRQR0MUdvG1DtTayt/Jxz56o+ASvT7NWaSxHoGz/3BeTwolzSg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774261827; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kXKx2eZSRRxB3m9Jr0Wq1EtQtmX2RWQ+MaUvt9gRf1Y=; b=HLEuCpyX/gMepDG1c65FglyazmePIWt9EQZf4h8o1EBjV/JIQgBB0imWsiIjx6Wa/VWLAUOq4RBEC54wyVKUCm4SLNYpu0hjIYCBM0wRuPqFfUIELRvRh5vB0tymzYCy5MSuarAW2b0XxBRp4uaVuj/8b4YVYlM7V5XBUCGnOpc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774261827719333.9145310964591; Mon, 23 Mar 2026 03:30:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w4cXa-000333-9T; Mon, 23 Mar 2026 06:29:46 -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 1w4cXY-00032i-OA for qemu-devel@nongnu.org; Mon, 23 Mar 2026 06:29:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w4cXW-0008Fa-V0 for qemu-devel@nongnu.org; Mon, 23 Mar 2026 06:29:44 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-292-HCeoZSw1Op-GAsPIad4QEQ-1; Mon, 23 Mar 2026 06:29:41 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E80CE1977031; Mon, 23 Mar 2026 10:29:37 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2B2D6300019F; Mon, 23 Mar 2026 10:29:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774261782; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kXKx2eZSRRxB3m9Jr0Wq1EtQtmX2RWQ+MaUvt9gRf1Y=; b=c/GhSBO6esAHdB0UmJgMxMsJSqINQkRcN+S3AoaLS8wuiZwJly8Iyt54z3md8GPHmX219A GK3jrf1UaC+TS6/JabY6iB5NyruvTR+kwDH14Bt1W8RjhFKT16SiXRIqMjHC9fWSgKVxL2 gg4M+2Y5y9SUHmeL67Fyqqd1TFDVRIs= X-MC-Unique: HCeoZSw1Op-GAsPIad4QEQ-1 X-Mimecast-MFC-AGG-ID: HCeoZSw1Op-GAsPIad4QEQ_1774261780 From: Thomas Huth To: Peter Maydell Cc: qemu-devel@nongnu.org, =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PULL 5/6] tests/functional: fix log placement when run directly Date: Mon, 23 Mar 2026 11:29:19 +0100 Message-ID: <20260323102920.25170-6-thuth@redhat.com> In-Reply-To: <20260323102920.25170-1-thuth@redhat.com> References: <20260323102920.25170-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1774261830032158500 From: Daniel P. Berrang=C3=A9 When running functional tests directly there are some heuristics to figure out where the build directory lives, along with the possibility to override the logic by setting the QEMU_BUILD_DIR env variable. This env var is set as part of the test env when run via Meson but not when run directly. A particular flaw with the currently logic is that it silently uses the wrong location when the build directory is a sub-dir under "./build", which is a common usage scenario for some devs. With the recent introduction of the 'run' script, we now have the MESON_BUILD_ROOT env variable set unconditionally, so we can rely on that from the functional tests to get the correct location in all scenarios. Reported-by: Peter Maydell Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Thomas Huth Message-ID: <20260310114756.146083-2-berrange@redhat.com> Signed-off-by: Thomas Huth --- tests/functional/meson.build | 2 +- tests/functional/qemu_test/config.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 9bec5a07516..0f7c90bed0f 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -75,7 +75,7 @@ foreach speed : ['quick', 'thorough'] test_deps +=3D [qemu_img] endif test_env.set('QEMU_TEST_QEMU_BINARY', test_emulator.full_path()) - test_env.set('QEMU_BUILD_ROOT', meson.project_build_root()) + test_env.set('MESON_BUILD_ROOT', meson.project_build_root()) test_env.set('PYTHONPATH', meson.project_source_root() / 'python:' + meson.current_source_dir()) =20 diff --git a/tests/functional/qemu_test/config.py b/tests/functional/qemu_t= est/config.py index 6d4c9c3ce1d..0192027233e 100644 --- a/tests/functional/qemu_test/config.py +++ b/tests/functional/qemu_test/config.py @@ -21,7 +21,7 @@ def _source_dir(): return Path(__file__).parent.parent.parent.parent =20 def _build_dir(): - root =3D os.getenv('QEMU_BUILD_ROOT') + root =3D os.getenv('MESON_BUILD_ROOT') if root is not None: return Path(root) # Makefile.mtest only exists in build dir, so if it is available, use = CWD @@ -32,7 +32,7 @@ def _build_dir(): if os.path.exists(root): return Path(root) =20 - raise Exception("Cannot identify build dir, set QEMU_BUILD_ROOT") + raise Exception("Cannot identify build dir, set MESON_BUILD_ROOT") =20 BUILD_DIR =3D _build_dir() =20 --=20 2.53.0 From nobody Fri Apr 3 20:53:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1774261870; cv=none; d=zohomail.com; s=zohoarc; b=fhw0Ywacn+wi49TgTGB/chUTzCKs+BQ22hl1zCdId6W7GSW4ThT+FhiUShT8jTmhWnomMcy8CdKYzEWjLlUYSgLPNjvkK4rX4gRihZfhivDpGAQFyFKE77Vs7xf7BIpvtBJR+bbt5l2YUpnaMpmTz4O0SP8y6tPpdI/Kfaba6/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774261870; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zYFFP1Q/3RTsXIUtXyfWqmNdeCk8HMsQrSZQdg/MncY=; b=V890IC9GKcqDzSrCWAP1ogCEgTyNA7C2I1LKiK5jSUmUAA9TwD5XU3eWkx/Naw0b5IBNEsBzMt9qNNDgvVWzrvCfuldK7tbcJPWzow534amgmCtL5aVFvM7/ktmbS9nBWBVZsRVk6GCJqMtMuI9OjeV2TxUBNt5U52m5Xd4EWp8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774261870248502.20665180509513; Mon, 23 Mar 2026 03:31:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w4cXg-000379-85; Mon, 23 Mar 2026 06:29:52 -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 1w4cXe-00035U-12 for qemu-devel@nongnu.org; Mon, 23 Mar 2026 06:29:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w4cXc-0008Ft-EW for qemu-devel@nongnu.org; Mon, 23 Mar 2026 06:29:49 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-wzBt3M-WPw2cxYuLwFlg0Q-1; Mon, 23 Mar 2026 06:29:46 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EB4CA1918E40; Mon, 23 Mar 2026 10:29:40 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 68E6530001A2; Mon, 23 Mar 2026 10:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774261787; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zYFFP1Q/3RTsXIUtXyfWqmNdeCk8HMsQrSZQdg/MncY=; b=Tse/giZRyg/s8sHFsIQqnBPftb8VY+sNcwD/nsPf+TCrdMegYW0bCbfv1v7XNITAQozHCm b9L54aXV+e8pKaXvTP80R1xnsSyYX3y/Ncn8pIA+9XXhkW8xGy8rTvCx9+b7+1DNq7fKCg gIwp2IQabVDIGKt9OPvP6Ar3Y8Ss+F4= X-MC-Unique: wzBt3M-WPw2cxYuLwFlg0Q-1 X-Mimecast-MFC-AGG-ID: wzBt3M-WPw2cxYuLwFlg0Q_1774261785 From: Thomas Huth To: Peter Maydell Cc: qemu-devel@nongnu.org, =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PULL 6/6] tests/functional: remove heuristics for finding build dir Date: Mon, 23 Mar 2026 11:29:20 +0100 Message-ID: <20260323102920.25170-7-thuth@redhat.com> In-Reply-To: <20260323102920.25170-1-thuth@redhat.com> References: <20260323102920.25170-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1774261872786154100 From: Daniel P. Berrang=C3=A9 Currently some heuristics are used to locate the build dir, if the MESON_BUILD_ROOT environment variable is not set. These are not entirely accurate, however, especially if the developer is using nested sub-dirs under $PWD/build/... Since the introduction of the 'run' script, we can ensure any direct execution of the tests will have MESON_BUILD_ROOT set. Meanwhile when meson runs the test it will also have this env set. The only gap is when running pre-caching, and that is easily fixed to set MESON_BUILD_ROOT. It can thus be assumed that MESON_BUILD_ROOT will always be set in any supported execution scenario, which allows the heuristics to be removed. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Thomas Huth Message-ID: <20260310114756.146083-3-berrange@redhat.com> Signed-off-by: Thomas Huth --- tests/functional/meson.build | 1 + tests/functional/qemu_test/config.py | 11 +++-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 0f7c90bed0f..3b42299e7ce 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -96,6 +96,7 @@ foreach speed : ['quick', 'thorough'] teststamp =3D testname + '.tstamp' test_precache_env =3D environment() test_precache_env.set('QEMU_TEST_PRECACHE', meson.current_build_dir(= ) / teststamp) + test_precache_env.set('MESON_BUILD_ROOT', meson.project_build_root()) test_precache_env.set('PYTHONPATH', meson.project_source_root() / 'p= ython:' + meson.current_source_dir()) precache =3D custom_target('func-precache-' + testname, diff --git a/tests/functional/qemu_test/config.py b/tests/functional/qemu_t= est/config.py index 0192027233e..e0893f630ee 100644 --- a/tests/functional/qemu_test/config.py +++ b/tests/functional/qemu_test/config.py @@ -24,15 +24,10 @@ def _build_dir(): root =3D os.getenv('MESON_BUILD_ROOT') if root is not None: return Path(root) - # Makefile.mtest only exists in build dir, so if it is available, use = CWD - if os.path.exists('Makefile.mtest'): - return Path(os.getcwd()) =20 - root =3D os.path.join(_source_dir(), 'build') - if os.path.exists(root): - return Path(root) - - raise Exception("Cannot identify build dir, set MESON_BUILD_ROOT") + raise Exception("Missing MESON_BUILD_ROOT environment variable. " + + "Please use the '/run' script if invoking "= + + "directly instead of via make/meson") =20 BUILD_DIR =3D _build_dir() =20 --=20 2.53.0