From nobody Tue Apr 7 19:55:51 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=1773260768; cv=none; d=zohomail.com; s=zohoarc; b=Z1F7k+FFr2CwrDxhvJ0P+TSvI0KQyEKdOrHKLzEoDUPrEsbKZ9eLEDznCEUrAUh1rGNoz+kjRtz6nKqTquh43kfi9K39UD4van99Jj2WwaAfSjUF6ngIxTrH+3w8ryH5krztqayBHBvekRuwXPZ2vGhrpi01ve0gL7zAheGBcCs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773260768; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=l+BjQ8FOy6t37ibkk0za6l4Z/vUyjg/Lc+4JRXsEnIU=; b=AVvfWzvWGCRDiIbtjHPtsrwEY/wZxlept9TtvxmluXGbrbWUtSE144VYyk54+4A0CQ8rE7g3tds2/x5EiaYIwUIqERGcOpMS9GxtG27qK1Er3Ht/C3Eg1DY2FIh2+FxQuZHbW6Td/WWBhgzBzJzkNaBx4/qZ8Wi/PCWZxjUb8hA= 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 1773260768712588.0864352653634; Wed, 11 Mar 2026 13:26:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0Q7J-0003eV-Ir; Wed, 11 Mar 2026 16:25:17 -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 1w0Q7I-0003eM-Bz for qemu-devel@nongnu.org; Wed, 11 Mar 2026 16:25:16 -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 1w0Q7F-0007iO-8p for qemu-devel@nongnu.org; Wed, 11 Mar 2026 16:25:16 -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-66-mxeIwg0vNLelVY4IyZABVA-1; Wed, 11 Mar 2026 16:25:08 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 80C52180061E; Wed, 11 Mar 2026 20:25:07 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.44.35.99]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A47161800107; Wed, 11 Mar 2026 20:25:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773260710; 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; bh=l+BjQ8FOy6t37ibkk0za6l4Z/vUyjg/Lc+4JRXsEnIU=; b=gKC+xwxdSo1dIyz0otOWQ+dkkof4EZAD0tR21sMa6FnIlmJyt4qlPnFGQlUAumfHF9ecnx Vs8NfeB5zsPCPv92heMVMe+MN1a9qm3nSzmoC5LZWiKU5MZrnxDuCVYxvSxkrHZL/DwEaW KCOHLO4B0MQwxWoVjUuwfkMoaBYjhQM= X-MC-Unique: mxeIwg0vNLelVY4IyZABVA-1 X-Mimecast-MFC-AGG-ID: mxeIwg0vNLelVY4IyZABVA_1773260707 From: Thomas Huth To: Max Filippov , qemu-devel@nongnu.org Cc: Markus Armbruster Subject: [PATCH] target/xtensa/cpu: Move initialization of memory region to realize function Date: Wed, 11 Mar 2026 21:25:03 +0100 Message-ID: <20260311202503.107026-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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: 1773260771577154100 Content-Type: text/plain; charset="utf-8" From: Thomas Huth When introspecting the xtensa CPUs from the command line, QEMU currently crashes: $ ./qemu-system-xtensa -device dc233c-xtensa-cpu,help qemu-system-xtensa: ../../devel/qemu/system/physmem.c:1401: register_multipage: Assertion `num_pages' failed. Aborted (core dumped) Move the initialization of the memory regions to the realize function to fix this problem. Reported-by: Markus Armbruster Signed-off-by: Thomas Huth Tested-by: Markus Armbruster --- target/xtensa/cpu.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 86ec899a67c..eebf40559bc 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -244,6 +244,14 @@ static void xtensa_cpu_realizefn(DeviceState *dev, Err= or **errp) Error *local_err =3D NULL; =20 #ifndef CONFIG_USER_ONLY + CPUXtensaState *env =3D &XTENSA_CPU(dev)->env; + + env->address_space_er =3D g_malloc(sizeof(*env->address_space_er)); + env->system_er =3D g_malloc(sizeof(*env->system_er)); + memory_region_init_io(env->system_er, OBJECT(dev), NULL, env, "er", + UINT64_C(0x100000000)); + address_space_init(env->address_space_er, env->system_er, "ER"); + xtensa_irq_init(&XTENSA_CPU(dev)->env); #endif =20 @@ -269,12 +277,6 @@ static void xtensa_cpu_initfn(Object *obj) env->config =3D xcc->config; =20 #ifndef CONFIG_USER_ONLY - env->address_space_er =3D g_malloc(sizeof(*env->address_space_er)); - env->system_er =3D g_malloc(sizeof(*env->system_er)); - memory_region_init_io(env->system_er, obj, NULL, env, "er", - UINT64_C(0x100000000)); - address_space_init(env->address_space_er, env->system_er, "ER"); - cpu->clock =3D qdev_init_clock_in(DEVICE(obj), "clk-in", NULL, cpu, 0); clock_set_hz(cpu->clock, env->config->clock_freq_khz * 1000); #endif --=20 2.53.0