From nobody Tue Apr 7 18:49:43 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1773290009; cv=none; d=zohomail.com; s=zohoarc; b=JgzkCdSlwWQIntjf2ipBgntl2UnnhlInk4/QeZlfXL/WBJXwQcmc7MJJvt1p4546EhYJBvxUF8bYEoCeZJN598ZbX1NNrea136ZnkTGpxMMT97ku9Pb0w4IK90j36nJugobeaGrXN6j7x0Xmyj9JDKe06EihMHvXizfWLhnTXz4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773290009; 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=vS70tBBYbFPB6IXfN8audWC5xzob048TiMHoxsESAWE=; b=mGlwp3X/y0pu11FhfUQLcH5fZF6/ByF9+iPTN1PdHBE9bih4ZBfpOMdmRLVpHwMGiW1+wEHu2vsUja82YM6w+NKDd1Pfz6ikYljKO51UslHzv3SqwYS6oHR97KSyB5rpDPswcOt9TMzThvDnuOtkWEDMbwRctWG+AAc11jwc45o= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773290009902117.58421533556668; Wed, 11 Mar 2026 21:33:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0Xid-0004TF-PD; Thu, 12 Mar 2026 00:32:19 -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 1w0Xic-0004T4-6K for qemu-devel@nongnu.org; Thu, 12 Mar 2026 00:32:18 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w0Xia-00042O-JR for qemu-devel@nongnu.org; Thu, 12 Mar 2026 00:32:17 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-2aaf59c4f7cso3380415ad.1 for ; Wed, 11 Mar 2026 21:32:16 -0700 (PDT) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:6209:4521:6813:45b7]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2aeae222ab6sm54340785ad.10.2026.03.11.21.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 21:32:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773289935; x=1773894735; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vS70tBBYbFPB6IXfN8audWC5xzob048TiMHoxsESAWE=; b=k8L3zRFWIbPwr8Nm7IPuzL865Mhy85hRKpQA+6L7YRjMTPlBkXNIrIxoQGJmYmU9r4 Jho0WTkr/qbqJFHLTr9upZP7TOV8kFGvyEOJZpYAu48d9UqIWar2gmXxPIHL+EHgCEJc eiqjle7Q5qGjipw4XAqULLqS88aqVwvX2O5hfW9vBkmKT/iCr7tH5V6YXZGELYDL8FL6 +fxqnW5AN0e5gkRwvs1ppTrfx8jx28f7dKR5F1CYr5gObCrvXqS91xbzQSsDU54oeOwx 7Y0HsGKOZyDLL1lKucQPv4Tya7CUA4T13yR6lKDt6ztrfSuXc7YR+LNRWuWn30m9GV9r 5s+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773289935; x=1773894735; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=vS70tBBYbFPB6IXfN8audWC5xzob048TiMHoxsESAWE=; b=QhibHbF8P1WJ86mf4DS1o+kxh9Nu2ynJBO5iWzU6mou6crmc95HpsgnrVTKMezodKm 3c/dDNMqvZOrmYYWpgR0Z0DI80M+29Nxvxvf2ZKe6pwRsa8YI+X2ZTWf5+px7py3BSl2 sVsDav+tUJvPqYm0bL3mhRFhYCVn5wTLYE3yHlxQWBE2lBeb7NL+austwqPU/h8PdMrG y9CNDPzlAQ6bcCYcEtwqcjvVnkJEYiXGL0T9HEnwOOsrEY8S3BsZYjUbRfOU9039a17W vXt/X5KJWS0DyOdsXTdOW3PV0cCzdzbQJJScKhqMPcpli8gONGpePdYkARUCvhKFpVtC Fvnw== X-Gm-Message-State: AOJu0YxQMSYOjJtKl0sZBqN/Ij395TgZN3pqhGwW2xXhmE+6SGd1SKxP ugsNDMdpZLh+M4e+EzOrQqHBnBP+sF7L/i6x80x3zLk/Wibw/KEYm6tpo8JeWBzL X-Gm-Gg: ATEYQzwPev7B2tvqC1vtmMIjxQMaJ/gj9+TTeROFS45ve5VTgdoj4p7ffdjPAbKaNaN 8kHOFmJpRinJRpUwt7+kGCE9WOZGMfHvyL4dI5vh01GiyNmPIIn8zAS2nm2J9yk8hHPcCDYmyyr Pf9toRBUA+MMmh2dbabrM8j/7P+2AwzltvvTuBzL8avHDWNNGUR7iTLoPVp8GMnQVVT8vFDf6GA 7I6ELMsCQZJ4YyZW8eOypK99RbPkqlvMyIPBpQhsNPnbLBNd2oCvfbcGGtAt/0p/WfJH3y4oVwS LU+p0KY7D21vowfCB7oYILcDH/TjP9PIjNDpPFLQmyiRtVBDGXwB2yBBQ/hNB0NcvY2rQuw3PwB +sfwujR7WAKiNZXpBMtqk4NC1t02HKbTt7UeAjMn+cuhN3gA7aEqsEXV900y/jmM9RmSoL0A28D IznL9FtmhfLUWA72U2UAn3zDYQMF2iI6YS+cpt41GMI3kFmN12yk4o X-Received: by 2002:a17:903:950:b0:2ad:bd4c:a2 with SMTP id d9443c01a7336-2aeae9447d0mr48009335ad.55.1773289934705; Wed, 11 Mar 2026 21:32:14 -0700 (PDT) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org, armbru@redhat.com, pbonzini@redhat.com, berrange@redhat.com, peterx@redhat.com, philmd@linaro.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH 1/7] hw/riscv: sifive_e: Don't call qdev_get_machine in soc init Date: Thu, 12 Mar 2026 14:31:52 +1000 Message-ID: <20260312043158.4191378-2-alistair.francis@wdc.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260312043158.4191378-1-alistair.francis@wdc.com> References: <20260312043158.4191378-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::635; envelope-from=alistair23@gmail.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: 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 @gmail.com) X-ZM-MESSAGEID: 1773290010897154100 Content-Type: text/plain; charset="utf-8" From: Alistair Francis Calling qdev_get_machine() in the soc_init function would result in the following assert ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed. when trying to run ./qemu-system-riscv64 -S -display none -M virt -device riscv.sifive.e.s= oc,help as the machine wasn't created yet. We call qdev_get_machine() to obtain the number of CPUs in the machine. So instead of setting the CPU num-harts in the init function let's set it in realise where the machine will exist. Signed-off-by: Alistair Francis Tested-by: Markus Armbruster --- hw/riscv/sifive_e.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c index 4cb9c07ffb..e41f4f99e9 100644 --- a/hw/riscv/sifive_e.c +++ b/hw/riscv/sifive_e.c @@ -178,12 +178,12 @@ type_init(sifive_e_machine_init_register_types) =20 static void sifive_e_soc_init(Object *obj) { - MachineState *ms =3D MACHINE(qdev_get_machine()); SiFiveESoCState *s =3D RISCV_E_SOC(obj); =20 object_initialize_child(obj, "cpus", &s->cpus, TYPE_RISCV_HART_ARRAY); - object_property_set_int(OBJECT(&s->cpus), "num-harts", ms->smp.cpus, - &error_abort); + /* Set the `num-harts` property later as the machine is potentially not + * created yet. + */ object_property_set_int(OBJECT(&s->cpus), "resetvec", 0x1004, &error_a= bort); object_initialize_child(obj, "riscv.sifive.e.gpio0", &s->gpio, TYPE_SIFIVE_GPIO); @@ -200,6 +200,8 @@ static void sifive_e_soc_realize(DeviceState *dev, Erro= r **errp) =20 object_property_set_str(OBJECT(&s->cpus), "cpu-type", ms->cpu_type, &error_abort); + object_property_set_int(OBJECT(&s->cpus), "num-harts", ms->smp.cpus, + &error_abort); sysbus_realize(SYS_BUS_DEVICE(&s->cpus), &error_fatal); =20 /* Mask ROM */ --=20 2.53.0 From nobody Tue Apr 7 18:49:43 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1773290000; cv=none; d=zohomail.com; s=zohoarc; b=klfKZ5ACATj6TSNl3L9DGmaRKPZrBBe323+KbSxD+GyRIQ6jc0xIIc+oHBYDA+NK1EqfUjIecD59Pl/jWpMrUj/bl/airy4ctWggf8Jpcnora5GuJ1LT+HU3lwdIimlyPTmu3BLs0HD8zQfIbyIu8E6aPOa6QzkB6NE+ud6mjV4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773290000; 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=S5bWYpDFMhGnOIHvbiRtGBp6ev0UQZkezNXRRwkOVA0=; b=VEgCgNlWoPXq7NrxEoIfILrdnY0eaq+2wP6V1moMgEGsxeKd2mhJKsm8vyyGKCs4JOosY3Dwk+qSKpkV6bmIaL5jw8xG5k6eGteuRwnLLvuFlFbhJ9jDqIOKFu4fuOCs47DAyBglrIecbILEpoDMtjXZcqkZjITmdGsRvpw1a+U= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773290000929986.7205195148545; Wed, 11 Mar 2026 21:33:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0Xii-0004U1-KJ; Thu, 12 Mar 2026 00:32:24 -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 1w0Xig-0004Ta-ST for qemu-devel@nongnu.org; Thu, 12 Mar 2026 00:32:22 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w0Xif-00042n-7V for qemu-devel@nongnu.org; Thu, 12 Mar 2026 00:32:22 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-2ae50a33ff8so4837515ad.3 for ; Wed, 11 Mar 2026 21:32:20 -0700 (PDT) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:6209:4521:6813:45b7]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2aeae222ab6sm54340785ad.10.2026.03.11.21.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 21:32:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773289939; x=1773894739; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S5bWYpDFMhGnOIHvbiRtGBp6ev0UQZkezNXRRwkOVA0=; b=ZTep3PSPcxvTlHjztedWKx8epejjnU2dEmSNDZXiYIn2vpQF9D4V8m11OX3OpDq88p /qaEHQ8/u6BxwJPw02hixlIXXb0FjUHiVW9PYJNkPiXTohVOOUUKJcQNW8GBejWIWZtK AXHqKv4apbW7+ahH8JkDd9+/smArWJbG3t08IvcAN5XgLm/96AZttTL+iEpqfQ0TYV2o gQYfIYcWM4D2EmZnZZvi5dT431HY4EYZ+rY99gj4cm29M2yH57q4N9A7jsY+s/paL0b2 Gw7aWgnTBMaS1X+ejPR2P00iWtIoo7MHVG1CoWEMB3TgWXpykNCZh0GXdEAvHTcg3qOt phOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773289939; x=1773894739; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=S5bWYpDFMhGnOIHvbiRtGBp6ev0UQZkezNXRRwkOVA0=; b=tkz9kqdttiXvdZHM1m5ZvfPR15vloTbtZkrjiztgvinDJXm4MI7bTlm5teFSTR0O8v 3ASBIugepSMUWhLkI0BGlxtqcwW7+/+ZKYEVq5tbXc0d5Md77qwbe15fPdqWy4FIuywU HTngKAVuoLB5JlQFfQ+jAAtk+M6+oZ1lRfRr3qAmFxIjgJPZiZA2M/knW7rIORGBi3Cq F2m/m+h/O4bm0aFQHy9k8SdNnp1vrHEyUs+ZIIOpR+pQ7Q3nHMrHQyfVk6yIeMSSDkVC wwyKRt+4ztXWf8Oefp/o+JvsQLGcuIPa3T/HfTExRcyEongopOOILNaEvK/MnSy1Hcsf 8dgA== X-Gm-Message-State: AOJu0YwJk984nI8fonmMSKf5xxtzn4QZfnwoC6FskC1hDsoTMXgma8kl xEHVEWC8JePhEfBuN0PBqdZvR6AYgId/S0HckbFnSwhy2NYzqNJhinEsVrOjVXZy X-Gm-Gg: ATEYQzw10Q9D0+eAnSwodzSc03HsJp6W1V2eyPA9hutH7ZJm2pOxxFLPVuInKqMJHHS jcslSwEn1VQxuGl721m76EspHCrcJR+IOYWpCyc/5boV+9ylpPOQrYyme33Q5LlBrII4xcSolNS NumMbFa23EqRpD3oNgfrtsdI+Fj8hgIEz4hKYPYgL9gZ3VLtCvLBK40kavus1yzdURuBUylpXOt gkNCvxmnnCRGxgpkoIIssCmzfB6ig8ic5e2j7VrRVGcYwSMTtyMTxO6SK+i6F7Ko7qdk8M9nlD4 oiuTXKPxxO4LNy6/5OoAfXAvbuLjhzESTpHPfydsOE3w9KxQZlAx68Ckn+lpcupjTZ/EfpTqoXa BtnZUGPX3Dju4crkZPIzOQdiV6fmRTMbvmdN+WW2ytLW8IL3uAXllW84gNeZWYsPPgM77B1tn83 z3TNTh0v+eF334CbWGN33WmHk25pm4O01GJmQCmrHe0w== X-Received: by 2002:a17:902:d541:b0:2ae:8077:b1c1 with SMTP id d9443c01a7336-2aeae89289dmr46255145ad.30.1773289938823; Wed, 11 Mar 2026 21:32:18 -0700 (PDT) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org, armbru@redhat.com, pbonzini@redhat.com, berrange@redhat.com, peterx@redhat.com, philmd@linaro.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH 2/7] hw/riscv: microchip_pfsoc: Don't call qdev_get_machine in soc init Date: Thu, 12 Mar 2026 14:31:53 +1000 Message-ID: <20260312043158.4191378-3-alistair.francis@wdc.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260312043158.4191378-1-alistair.francis@wdc.com> References: <20260312043158.4191378-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::635; envelope-from=alistair23@gmail.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: 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 @gmail.com) X-ZM-MESSAGEID: 1773290002868154100 Content-Type: text/plain; charset="utf-8" From: Alistair Francis Calling qdev_get_machine() in the soc_init function would result in the following assert ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed. when trying to run ./qemu-system-riscv64 -S -display none -M virt -device microchip.pfsoc,= help as the machine wasn't created yet. We call qdev_get_machine() to obtain the number of CPUs in the machine. So instead of setting the CPU num-harts in the init function let's set it in realise where the machine will exist. Signed-off-by: Alistair Francis Tested-by: Markus Armbruster --- hw/riscv/microchip_pfsoc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/riscv/microchip_pfsoc.c b/hw/riscv/microchip_pfsoc.c index 4ff83e4940..73cc229c54 100644 --- a/hw/riscv/microchip_pfsoc.c +++ b/hw/riscv/microchip_pfsoc.c @@ -143,7 +143,6 @@ static const MemMapEntry microchip_pfsoc_memmap[] =3D { =20 static void microchip_pfsoc_soc_instance_init(Object *obj) { - MachineState *ms =3D MACHINE(qdev_get_machine()); MicrochipPFSoCState *s =3D MICROCHIP_PFSOC(obj); =20 object_initialize_child(obj, "e-cluster", &s->e_cluster, TYPE_CPU_CLUS= TER); @@ -162,7 +161,9 @@ static void microchip_pfsoc_soc_instance_init(Object *o= bj) =20 object_initialize_child(OBJECT(&s->u_cluster), "u-cpus", &s->u_cpus, TYPE_RISCV_HART_ARRAY); - qdev_prop_set_uint32(DEVICE(&s->u_cpus), "num-harts", ms->smp.cpus - 1= ); + /* Set the `num-harts` property later as the machine is potentially not + * created yet. + */ qdev_prop_set_uint32(DEVICE(&s->u_cpus), "hartid-base", 1); qdev_prop_set_string(DEVICE(&s->u_cpus), "cpu-type", TYPE_RISCV_CPU_SIFIVE_U54); @@ -204,6 +205,7 @@ static void microchip_pfsoc_soc_realize(DeviceState *de= v, Error **errp) int i; =20 sysbus_realize(SYS_BUS_DEVICE(&s->e_cpus), &error_abort); + qdev_prop_set_uint32(DEVICE(&s->u_cpus), "num-harts", ms->smp.cpus - 1= ); sysbus_realize(SYS_BUS_DEVICE(&s->u_cpus), &error_abort); /* * The cluster must be realized after the RISC-V hart array container, --=20 2.53.0 From nobody Tue Apr 7 18:49:43 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1773289975; cv=none; d=zohomail.com; s=zohoarc; b=SDYyLz8klNCLvIGwiuCwxlutXXblkjWDNTR/bJ0XJk1Vkc4GOOVKUWGRFCKwMSkISsWFMdQOUQHcofXNeFFM+SdAHkHlQBKOewoxIbmWcqNxXW6Gb/CZjwpctSbaRulRVUBxKm9rDvo8+fJMnuV6OGWXyA71wczvwovhRvcUXwY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773289975; 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=epzAj+B6wXCrlYB6AtGb6lNn0V0ohZ2LaB8gM7SskXE=; b=WkEAEkdmXgeJW6UefUzw/Gjck23GNxkEl/hBObhT1YQMMeYekvnDtfblLQQ9apNpgAkszMotIX7g++y3LWccX0IqljM3dSLwvhw8ZGixym17qdevEQsI5QgOFK72PMKGGnOo5mBKImcOC2RaW1CAKTpeCVFJrWM0Uy+ueJBIfkc= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773289975086646.0932292985048; Wed, 11 Mar 2026 21:32:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0Xim-0004UM-UQ; Thu, 12 Mar 2026 00:32:29 -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 1w0Xik-0004U5-Ko for qemu-devel@nongnu.org; Thu, 12 Mar 2026 00:32:27 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w0Xii-00043M-Vl for qemu-devel@nongnu.org; Thu, 12 Mar 2026 00:32:26 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-2ae5423b02aso4350595ad.1 for ; Wed, 11 Mar 2026 21:32:24 -0700 (PDT) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:6209:4521:6813:45b7]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2aeae222ab6sm54340785ad.10.2026.03.11.21.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 21:32:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773289943; x=1773894743; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=epzAj+B6wXCrlYB6AtGb6lNn0V0ohZ2LaB8gM7SskXE=; b=Fe7zACZzi3XhFBUls4/L3kNT9ruTYBM3MP98E7L8eJv3O9fIwGMtYx/JcIMCCCnMO2 qcET7Bvdsz60Kc0BfOFNwEsHJwssMeLLxxZ8cm3YkX91QguLP5Mq37xt+IExrL1RxSoQ CQouYjdHUKrD+Ke9LgDYdAfu0ICKrFV8ze1P9w4sOKfTlKUQLzYxxlFDKgmsyoTjkFpT ES/GsH1BYJLCeqTtKMzNzeJoCDXhLFKPKqbV1mkMshEfR7tqNNDRP1lQYjF2FPJMDakC 3+6GT3wN3Kr5oP9MTMk1kWM2x0CIKwOcxMYmj65SWblvAyXrkdRniL/F4wNVCMeoaT76 wr8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773289943; x=1773894743; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=epzAj+B6wXCrlYB6AtGb6lNn0V0ohZ2LaB8gM7SskXE=; b=XpR/LEqQZoINzBqVHpOFVfFnIJ79bfXdYCf7g56jjShVpen6drCwauIrzUFEuQUJ9k jOmNX3tXpQ2zo6lBA3hCnkVRte/LmJTX3g64XsMnv5ORz3Um/6dwe6+GrkSrAwczPnRB C/iSiMSVTs8ReuNaj5NoPpxz6ysYtLmh2Hs+IfbTvBoQu+FbhLYjVu8C7FB5yMDsNIkt 3o4l0DRbKkVZnxHn6kZFigMC7+2504KncgR74o00iGgfXA35N/S5FJdLqL0qoyN/7ctj lznKamX5iVAwICAM8i+WTy/dF/+bRTmwwqSUJl7o05k4+Nl/3SD+MHRyiquz+Q6g4fho rpXA== X-Gm-Message-State: AOJu0YwTKJfEoiI+eJZcJi+GrgBeeLmOtF+G2bjTx641KuHOxp1Twy5Q ZWe5gKoBAZi2m7OQl5TXH0dU3DreaaTC2B8pUCvgl6Obw6kEU7125MYiPt1EEYCs X-Gm-Gg: ATEYQzzmk6i0cCDYVOYd0ZwvSTHkUTdje+OEM11ObjXSzaqaSr7p4EG/EQ6ZomPNva1 5vCCjhMsX1DvVTMkKqg+x6SuVioEdEtGMT6HImL4ktEaZGrJAILO9uKg+LSx3agTzdubDEyYWWG N6PJQfi8xcX8kTcapul9iyJtQtZtC4IYSwJk8iezqvDpEd9chC5U5n+4mtGOdayjv09LDaRluPw FPlNdC1aPAD/u8csnG93PlDFDPyt+Rz3n5EDcAuLnw/4g+nY67BNwBc1hMKafU3IClfFUhoFVVx 86GIxRBqBuLCVrI3AILuPby/+gXgPpbCCL8NtfpplaP89vphBS0JG6WIaEUGOSESHDwx3XAU7LI 3ZzK1WQ7ywcAMFbS9ZsZwoY2geQvQBXancpWGoxhASwE8nbbxuJMS+h1SK6qo+Vdc+kL52Q2FId gdG92GNvU6v6rUAaipHeZpbV9c5Uu4fQT83zntLIi3PeXfeuuAbP3N X-Received: by 2002:a17:902:d50a:b0:29f:301a:f6cf with SMTP id d9443c01a7336-2aeae890ce6mr49181665ad.35.1773289943102; Wed, 11 Mar 2026 21:32:23 -0700 (PDT) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org, armbru@redhat.com, pbonzini@redhat.com, berrange@redhat.com, peterx@redhat.com, philmd@linaro.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH 3/7] hw/arm: xlnx-zynqmp: Don't call qdev_get_machine in soc init Date: Thu, 12 Mar 2026 14:31:54 +1000 Message-ID: <20260312043158.4191378-4-alistair.francis@wdc.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260312043158.4191378-1-alistair.francis@wdc.com> References: <20260312043158.4191378-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::629; envelope-from=alistair23@gmail.com; helo=mail-pl1-x629.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: 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 @gmail.com) X-ZM-MESSAGEID: 1773289976423154100 Content-Type: text/plain; charset="utf-8" From: Alistair Francis Calling qdev_get_machine() in the soc_init function would result in the following assert ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed. when trying to run ./qemu-system-aarch64 -S -display none -M virt -device xlnx-zynqmp,help as the machine wasn't created yet. We call qdev_get_machine() to obtain the number of CPUs in the machine. So instead of initialising the CPUs in the SoC init let's instead do it in the realise where the machine will exist. Signed-off-by: Alistair Francis Tested-by: Markus Armbruster --- hw/arm/xlnx-zynqmp.c | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index 5f0e34ccec..979e55e305 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -380,30 +380,15 @@ static void xlnx_zynqmp_create_unimp_mmio(XlnxZynqMPS= tate *s) =20 static void xlnx_zynqmp_init(Object *obj) { - MachineState *ms =3D MACHINE(qdev_get_machine()); XlnxZynqMPState *s =3D XLNX_ZYNQMP(obj); int i; - int num_apus =3D MIN(ms->smp.cpus, XLNX_ZYNQMP_NUM_APU_CPUS); - int num_rpus =3D xlnx_zynqmp_get_rpu_number(ms); =20 object_initialize_child(obj, "apu-cluster", &s->apu_cluster, TYPE_CPU_CLUSTER); qdev_prop_set_uint32(DEVICE(&s->apu_cluster), "cluster-id", 0); =20 - for (i =3D 0; i < num_apus; i++) { - object_initialize_child(OBJECT(&s->apu_cluster), "apu-cpu[*]", - &s->apu_cpu[i], - ARM_CPU_TYPE_NAME("cortex-a53")); - } - object_initialize_child(obj, "gic", &s->gic, gic_class_name()); =20 - if (num_rpus) { - /* Do not create the rpu_gic if we don't have rpus */ - object_initialize_child(obj, "rpu_gic", &s->rpu_gic, - gic_class_name()); - } - for (i =3D 0; i < XLNX_ZYNQMP_NUM_GEMS; i++) { object_initialize_child(obj, "gem[*]", &s->gem[i], TYPE_CADENCE_GE= M); object_initialize_child(obj, "gem-irq-orgate[*]", @@ -453,15 +438,6 @@ static void xlnx_zynqmp_init(Object *obj) object_initialize_child(obj, "qspi-irq-orgate", &s->qspi_irq_orgate, TYPE_OR_IRQ); =20 - if (num_rpus) { - for (i =3D 0; i < ARRAY_SIZE(s->splitter); i++) { - g_autofree char *name =3D g_strdup_printf("irq-splitter%d", i); - object_initialize_child(obj, name, &s->splitter[i], TYPE_SPLIT= _IRQ); - } - } - - - for (i =3D 0; i < XLNX_ZYNQMP_NUM_USB; i++) { object_initialize_child(obj, "usb[*]", &s->usb[i], TYPE_USB_DWC3); } @@ -483,6 +459,24 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Erro= r **errp) =20 ram_size =3D memory_region_size(s->ddr_ram); =20 + for (i =3D 0; i < num_apus; i++) { + object_initialize_child(OBJECT(&s->apu_cluster), "apu-cpu[*]", + &s->apu_cpu[i], + ARM_CPU_TYPE_NAME("cortex-a53")); + } + + if (num_rpus) { + /* Do not create the rpu_gic if we don't have rpus */ + object_initialize_child(OBJECT(dev), "rpu_gic", &s->rpu_gic, + gic_class_name()); + + for (i =3D 0; i < ARRAY_SIZE(s->splitter); i++) { + g_autofree char *name =3D g_strdup_printf("irq-splitter%d", i); + object_initialize_child(OBJECT(dev), name, &s->splitter[i], TY= PE_SPLIT_IRQ); + } + } + + /* * Create the DDR Memory Regions. User friendly checks should happen at * the board level --=20 2.53.0 From nobody Tue Apr 7 18:49:43 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1773289980; cv=none; d=zohomail.com; s=zohoarc; b=hmw0BrHLHKZlVxdQ6RB8IApkyVOCy57rZlmhz9tCsEG/YwyQ1UkJA2eWF+xgpeDSw+Xc9Gn9Fz9jUMNr6zg0whQlMHrjBTSpLWyPl/Z5Rd1qNeX4VI8kF4pzltaDGoBpI8XE7rG7YoLbJOmqMiS/+Opdn6rvXMrTFdduba2V+t8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773289980; 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=NziXTQ1sf7fWxugAcH7uSw0+8ApDkk8bxbN24KNdpBI=; b=RW973PDWp5z3tTf9PBm6P/4MoWtriYeOy4N5mscrefV2gXwplkA4vS1fMxn5Evt/nE4G4UDHkupeW05+rNlidtS/v4aPCH2qz7cNBeGNG0l2l88er3GrxNxSs1vq25TtrkOlqUwVZD0/vmc9KcXRWmVwdwFOyoP50y3PfqP23q4= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773289980716821.6089082007699; Wed, 11 Mar 2026 21:33:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0Xis-0004V0-3q; Thu, 12 Mar 2026 00:32:34 -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 1w0Xio-0004Ub-H7 for qemu-devel@nongnu.org; Thu, 12 Mar 2026 00:32:30 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w0Xim-00043n-Sv for qemu-devel@nongnu.org; Thu, 12 Mar 2026 00:32:30 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-2ab46931cf1so13509465ad.0 for ; Wed, 11 Mar 2026 21:32:28 -0700 (PDT) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:6209:4521:6813:45b7]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2aeae222ab6sm54340785ad.10.2026.03.11.21.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 21:32:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773289947; x=1773894747; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NziXTQ1sf7fWxugAcH7uSw0+8ApDkk8bxbN24KNdpBI=; b=TPtvEI4eYPcNP2Ouv5ydhtnV5/C8gqw6eDwtsn+gG0ECI4rwuVFdlphF6Y3Ku6279G 8KFw7xdE1auu/wV+ZqLLp1j2CHF6hTsQxzpw/LUFGWBYAYf+J+eox4nO9Vlr1OPOBnyy XPudJlXSDDEjK8w4gTcLg0kyj9s3b0t1gVbKHMol8YMYtmkIpN/+xPZyTQRxE+R1URRc MbcYh8IJPOHW0YJt62SSl44ZuV7BRRdmLYYQ9MigDmBtshCodOdjbCHm9hlZwEbKt76t oPrUu+Q7pwpQbWYHranUtP/jLd90KmORjo0Yz03GJXVeHTtCdlKBLNKPnUo6knYf8JpL wEyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773289947; x=1773894747; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=NziXTQ1sf7fWxugAcH7uSw0+8ApDkk8bxbN24KNdpBI=; b=N/bVvH5w1R2hEVYsruT8gQujP9jS3XAOnxg7Ag0qU+OnJdB9uaa8e8mb0Imc5fEQCp b88y8+mX9Adhef8qtW+y1yjG6cQQkOacDzzPQy2CIbhF2LMdU9N2KdowYvv76Hpqc2NY 6RE+yYRt7Fkr9MF1RT+cVygUl6ptdBgogeWCUUkWZ3HLrkUHXVsRhDkveGmKGzZWz9qW s7TLOHY34n88HtZz3Vi4LSywSUCpUMLnq4MCuZx7muDSQoRGdq2WPaScYIYshmjLhxxN DNRW9TH7rX2UiXnBIxjhq2+tPSJYAC3Bkb3zRt+MpztKOESO1L6pCKFv41VHcd3RdHeX ZvHQ== X-Gm-Message-State: AOJu0YwdH3sJ2XXgU1t/jy62yt4HG1nJfmriRroq5lym92R3FoMtanId KetMw/ygVs/w5RYlEkh3/pp5mIF37rvlDDOcOK0xe2/+HVkgjlTzGlH90Nx2MXVd X-Gm-Gg: ATEYQzxNka+LX25yXEyoBu7oeHeUFfv7qmKI7N2ueZr/r+ZnmG/NDhPoJJ+HC7OLIPn neh89HEpqpXImWR8WsW0SvfW2T6iKXNpSCPM6Fn3bNmAZdHj6cEUo2phm34WuYzNETz8TT+nHAm BY0eMMpIBbpePrVqD61TxQ/J0Oh7VN6fyFYzXObH0u/cEWG+ABF+nFMlMxu9E1ERRl2m1TAoUl4 JxtIHH5mzm25UIdBP/KyPEj7XtyKR85aQY58FpmF2W3ahvvUVA8xUle045PsCDOH6zkn5WR50l8 snFxNeN3IC6zMJg9gXvGZO/heNHINyPOKbZKi765HY2TM7mKiSE3pGkDk8TG2NhG3OBEYPq9tDD U3/sBYJS37ofzu+qKD8H2mQ39KEy3csHFP8KmGF6tmbIbn7ZVTtiFFMWkE50P3zSUVAYSdg+Zdl 9cabdsxpZ4H5sp125l13UWBYcw0vWwIs1vzQzdtjowvQ== X-Received: by 2002:a17:903:32cc:b0:2ad:b213:feba with SMTP id d9443c01a7336-2aeba4416d2mr18412685ad.5.1773289947113; Wed, 11 Mar 2026 21:32:27 -0700 (PDT) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org, armbru@redhat.com, pbonzini@redhat.com, berrange@redhat.com, peterx@redhat.com, philmd@linaro.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH 4/7] hw/arm: fsl-imx7: Don't call qdev_get_machine in soc init Date: Thu, 12 Mar 2026 14:31:55 +1000 Message-ID: <20260312043158.4191378-5-alistair.francis@wdc.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260312043158.4191378-1-alistair.francis@wdc.com> References: <20260312043158.4191378-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::62e; envelope-from=alistair23@gmail.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: 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 @gmail.com) X-ZM-MESSAGEID: 1773289983039158500 Content-Type: text/plain; charset="utf-8" From: Alistair Francis Calling qdev_get_machine() in the soc_init function would result in the following assert ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed. when trying to run ./qemu-system-aarch64 -S -display none -M virt -device fsl-imx7,help as the machine wasn't created yet. We call qdev_get_machine() to obtain the number of CPUs in the machine. So instead of initialising the CPUs in the SoC init let's instead do it in the realise where the machine will exist. Signed-off-by: Alistair Francis Tested-by: Markus Armbruster --- hw/arm/fsl-imx7.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c index 9a230d222f..2defa498d3 100644 --- a/hw/arm/fsl-imx7.c +++ b/hw/arm/fsl-imx7.c @@ -32,20 +32,10 @@ =20 static void fsl_imx7_init(Object *obj) { - MachineState *ms =3D MACHINE(qdev_get_machine()); FslIMX7State *s =3D FSL_IMX7(obj); char name[NAME_SIZE]; int i; =20 - /* - * CPUs - */ - for (i =3D 0; i < MIN(ms->smp.cpus, FSL_IMX7_NUM_CPUS); i++) { - snprintf(name, NAME_SIZE, "cpu%d", i); - object_initialize_child(obj, name, &s->cpu[i], - ARM_CPU_TYPE_NAME("cortex-a7")); - } - /* * A7MPCORE */ @@ -179,6 +169,15 @@ static void fsl_imx7_realize(DeviceState *dev, Error *= *errp) return; } =20 + /* + * CPUs + */ + for (i =3D 0; i < smp_cpus; i++) { + snprintf(name, NAME_SIZE, "cpu%d", i); + object_initialize_child(OBJECT(dev), name, &s->cpu[i], + ARM_CPU_TYPE_NAME("cortex-a7")); + } + /* * CPUs */ --=20 2.53.0 From nobody Tue Apr 7 18:49:43 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1773290017; cv=none; d=zohomail.com; s=zohoarc; b=XvohhYacEnAaFBliM6eE+hcK1ylBWEXGyK4ulkTop8P3HVPX5yRtbUruh2VPbCerqMlU2UWXwgczKmB3kaUAwSJMDH0O7Xri9IqB5laUn5S23fhMqE1ggyDgwmW5LCBfUP1D/Ye/JPO7qkV6kY/mpJzcy4DBcTNpz/Vuz5BrP4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773290017; 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=jQMrNml6U9cDIhsQ5mDwSAwjyDPFJNp8soUiNVdW58g=; b=FCtSHKmVCdDd+6mSuttFZmVjqzMFXIfxfy9GtbVqNxm6HjOI+TNWuQz9Tzk9byaH/cytYUJl3JMd1xJ64dNNdwbW3PjNhZw249QAJE2VtLcfATuPPPDE8tM9PyurLgzxcepYHyB3nirJ5M3xY/jxZcP/kITxhvzViltVq4Y4nS0= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773290017778727.6121776643171; Wed, 11 Mar 2026 21:33:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0Xiv-0004Vd-F5; Thu, 12 Mar 2026 00:32: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 1w0Xiu-0004VL-2V for qemu-devel@nongnu.org; Thu, 12 Mar 2026 00:32:36 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w0Xir-00044w-SQ for qemu-devel@nongnu.org; Thu, 12 Mar 2026 00:32:35 -0400 Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-c73bbdc01b7so183571a12.2 for ; Wed, 11 Mar 2026 21:32:32 -0700 (PDT) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:6209:4521:6813:45b7]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2aeae222ab6sm54340785ad.10.2026.03.11.21.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 21:32:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773289951; x=1773894751; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jQMrNml6U9cDIhsQ5mDwSAwjyDPFJNp8soUiNVdW58g=; b=T75gldbsIxizLC5v0/XWLQCt4hS43ktucCRos8tmp9s16sSPCXAicoxjwk7FF6dd+q N1L1yWp0ak5U/1j+HxdGFJD+XOZZZl4sjEG4dq9MtG4FghScpB2WXLyVAjdCT9Cky2r/ VxhmliQP74Aj4CmwP+aKxYYpANkRGUJdEGIT7Xi2voIBSpK9dvq6pOy/PyCx92t5hetY 2kiqLhfNQ2hHZIdtqY+edWBwn5Xcz2d5jKFT+yjNJamnOc3PzlO/di/9SzBWPnys9hOl qklPAnrz+cn3EctHRYh/rHzGvAmDB9KgoAoJv5cIro9R9NDF/1qtVIXEFAlb58FUJ6d3 X8Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773289951; x=1773894751; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=jQMrNml6U9cDIhsQ5mDwSAwjyDPFJNp8soUiNVdW58g=; b=s43coq9IZNMO2BaKUn/YmquwRilq/wfI7RzRmAKcMD+EanfzUjbqJM8lBTMb2A278h /jaH5QJW78EdGltoSkZbKNTNb/xgaTkgmpCIxahAN1Bb7K9jvWikjD8SRC3F0UQexcd3 FDC8okl1VQQ4kD0E6vbxW/L9OSNWpQWB50ysQI2cxD+5X8uGx6iiX6utLgf1OfOA5JB6 9vcnARiiON0t8sBqVUEwxJWV0sGmzD33Cwd6WA3QlR0WLQaC+Y5S4eT/GM6wkU0csMy5 K3jVjklnFgf/pZj6M0ZLZuj+pF9dcRC5zZy+TxGhJalP3fxTbR3AKG4O3oIMjs3sFxcj XjgQ== X-Gm-Message-State: AOJu0YxUKPVHHvZIOiACXUTE5vTYyUI3rt3D+VYFlAmkpp2a1cXBiUGT JZZWL8fAhWKQBLDJh3Cl/SP8A8Bk7uXqOg9c3aTaJY60eUY13cwHuMvhWJkhuRWD X-Gm-Gg: ATEYQzyzmp1bpVopD4Fwr2NMMKn5fbVwMJUZUAMNO80AqNwE7volsvI5YQfzv/9S+3L WDSHGQR9NrfPwwyHNpF2l3eWK58IozY3eGVxUffpeFN9K/uUI2pvTDZmqCKzFlc0K9pe1LM7STS m5bQrhSClqT5acW0nybMFZEYvI2PYCYQ3XqURt/7ItWlVn4xqrNuAls1G38TAKzlTVsnPNbsicH pcKhztbmfAG6VFCHsUwPPDxs5IUgHhdtBC6MI2cGIDWVIan9A8O63/JMomfkUraFyBkHftQDYQ5 o2mo9zibYSPjLxBZCrzR3eEC8n2kcX5qGUuG0kwuO2LSgSqjTGfqbt1DowjwdpNO+QHwkapsMJZ SqFVwALefmzjiRwbZGy+YsBM6xhNvVKyo1hunTaF5P+f/CUSbSf9P2Pq/AzWzEYySBlGTv1RJ6d hV9Zr81uI4zkuxbmVbFKxozUJv7XKxYluC8Kquf0chkA== X-Received: by 2002:a17:903:32cf:b0:2ae:50ec:fa34 with SMTP id d9443c01a7336-2aeae8ab700mr51887435ad.46.1773289951108; Wed, 11 Mar 2026 21:32:31 -0700 (PDT) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org, armbru@redhat.com, pbonzini@redhat.com, berrange@redhat.com, peterx@redhat.com, philmd@linaro.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH 5/7] hw/arm: fsl-imx8mp: Don't call qdev_get_machine in soc init Date: Thu, 12 Mar 2026 14:31:56 +1000 Message-ID: <20260312043158.4191378-6-alistair.francis@wdc.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260312043158.4191378-1-alistair.francis@wdc.com> References: <20260312043158.4191378-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::536; envelope-from=alistair23@gmail.com; helo=mail-pg1-x536.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: 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 @gmail.com) X-ZM-MESSAGEID: 1773290019176158500 Content-Type: text/plain; charset="utf-8" From: Alistair Francis Calling qdev_get_machine() in the soc_init function would result in the following assert ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed. when trying to run ./qemu-system-aarch64 -S -display none -M virt -device fsl-imx8mp,help as the machine wasn't created yet. We call qdev_get_machine() to obtain the number of CPUs in the machine. So instead of initialising the CPUs in the SoC init let's instead do it in the realise where the machine will exist. Signed-off-by: Alistair Francis Tested-by: Markus Armbruster --- hw/arm/fsl-imx8mp.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/arm/fsl-imx8mp.c b/hw/arm/fsl-imx8mp.c index 79f9142777..b36df82971 100644 --- a/hw/arm/fsl-imx8mp.c +++ b/hw/arm/fsl-imx8mp.c @@ -193,16 +193,9 @@ static const struct { =20 static void fsl_imx8mp_init(Object *obj) { - MachineState *ms =3D MACHINE(qdev_get_machine()); FslImx8mpState *s =3D FSL_IMX8MP(obj); - const char *cpu_type =3D ms->cpu_type ?: ARM_CPU_TYPE_NAME("cortex-a53= "); int i; =20 - for (i =3D 0; i < MIN(ms->smp.cpus, FSL_IMX8MP_NUM_CPUS); i++) { - g_autofree char *name =3D g_strdup_printf("cpu%d", i); - object_initialize_child(obj, name, &s->cpu[i], cpu_type); - } - object_initialize_child(obj, "gic", &s->gic, gicv3_class_name()); =20 object_initialize_child(obj, "ccm", &s->ccm, TYPE_IMX8MP_CCM); @@ -265,6 +258,7 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error = **errp) MachineState *ms =3D MACHINE(qdev_get_machine()); FslImx8mpState *s =3D FSL_IMX8MP(dev); DeviceState *gicdev =3D DEVICE(&s->gic); + const char *cpu_type =3D ms->cpu_type ?: ARM_CPU_TYPE_NAME("cortex-a53= "); int i; =20 if (ms->smp.cpus > FSL_IMX8MP_NUM_CPUS) { @@ -273,6 +267,11 @@ static void fsl_imx8mp_realize(DeviceState *dev, Error= **errp) return; } =20 + for (i =3D 0; i < ms->smp.cpus; i++) { + g_autofree char *name =3D g_strdup_printf("cpu%d", i); + object_initialize_child(OBJECT(dev), name, &s->cpu[i], cpu_type); + } + /* CPUs */ for (i =3D 0; i < ms->smp.cpus; i++) { /* On uniprocessor, the CBAR is set to 0 */ --=20 2.53.0 From nobody Tue Apr 7 18:49:43 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1773289983; cv=none; d=zohomail.com; s=zohoarc; b=H1nNN8MEJVTt2g8BcAWMI4mAiKkTwJygyDzHtUOpwHkhw2LSxzW7owyp1V+Fl4bqzgUIay3Atu1KBpuhlGZvH3nm56L7a8l1kTmKVBmKI+tBvb752B1HDOjLHEcsWOwo4jF0OWk75lJ1vrLIW5tZmtF2t8EmtogqVqmm1ZoF5zs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773289983; 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=aocj2Vj5R7UmvfH1Q0atiy67oG5ncEAshxWbQyPErH0=; b=XMVpweSyonUd2dHkWucx8/7U3raP9qHqQRnZCJxcYNEbFhAlYIEPm3LPtfpgFm4keUbWXKjeT1wzw0iD3M+onFExb99y6Rmki1tSsdJSeAMQE66zMAfpfFy7RD9CHYaVDKhB31y+NZ+91SP5SU1A8hs6ffe2VFPGpSWQMm2rqkE= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773289983767946.3855223542428; Wed, 11 Mar 2026 21:33:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0Xj2-0004WN-HS; Thu, 12 Mar 2026 00:32:44 -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 1w0Xiy-0004W2-G8 for qemu-devel@nongnu.org; Thu, 12 Mar 2026 00:32:41 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w0Xiv-0004BH-4N for qemu-devel@nongnu.org; Thu, 12 Mar 2026 00:32:39 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-2ae4e538abdso7286795ad.3 for ; Wed, 11 Mar 2026 21:32:36 -0700 (PDT) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:6209:4521:6813:45b7]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2aeae222ab6sm54340785ad.10.2026.03.11.21.32.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 21:32:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773289955; x=1773894755; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aocj2Vj5R7UmvfH1Q0atiy67oG5ncEAshxWbQyPErH0=; b=Ye1iQBumYjLqflJBok9+2h/RlBfunZpn8ZRhBakDKH6SZpu4kjihpZf0fyuukveeD0 tDFIuSakP4lr6c2OGnvQFX8DIsd2JjGU6GcVmusVDCVWBbGM4lRaf86qRXGdgPtMesw+ E9YljSw372K47U7E1kuLI0YLhKO9B7vnwwtGmXhpz7hEh/iZqUDEWDccOiOd+WxgBt9J 0b3NuNnRrhVA4C/UtsTS1emluxUAr1CchrpwDej0DTtYejWj0aHStsT6Q22MYBByY6mU 3JPD9QsxNPl6ZXKsHGI3+8ibqBXy7TwHBLz9rH0AJChIqvblOVFLza7j5/5+tBvB1p+l M2Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773289955; x=1773894755; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=aocj2Vj5R7UmvfH1Q0atiy67oG5ncEAshxWbQyPErH0=; b=KRK2EXQNHjPu4YtRi/t0379GhskAMRqoSc+pmaw5iteKoU2tP4IFXwmnd5dD7UezJE exC3c5yYQG9A8lWXNGVJ/2r1dZHbsJAKAMm8S3CZ59ovkwXsuIoNRNw4PxAm2cGJgrdp K9Ok8SQQOHA9SkSn6J+pzrBTZki2RAR+PnCNb/lyuhwsUdW2fTaT7ou/Ve8YHj96+gC7 lSZaH1Ts6kUw7oUhwSsskbjUhjeDhDwij12vD1E2vdFuaLpYXh275Cr+ZeFhtbq3h7Cs 1ae6WbATTpwP0q+FYqH/Ppjz5TsmZBC1RFc+kqetLuJTv84VJe9mSV98DTzKmCu2dRxT 5k1g== X-Gm-Message-State: AOJu0YzhMkq8IESuKeN+gGNt83hwp2P5qdsdFw58GHt8puOEk1CsdY3H GuM9rntZF3vvVDNUzOKWuAW5cbvqwcYq3g2lND27sQWykNtVOfl6RAsEO25w4t13 X-Gm-Gg: ATEYQzyXV95Vtg1maHBeDxRViFqY9JmCD3rdX+uoIKWgRfIpOPbJcJzHkkU6ar3UO7x JKAGL0h9kcMthbdymTpnQRjheFujgBw7VFQwWgM+wa0Y8Xrz7DzY+n/FiKBWB3hQeV8+pPRgskY YxsamR+HUp/Kc4lHx6Wndk+kQWI5P/ngFl+y2nsstmtQJ+slzqZfwsg7sX0GF/AxZ54Dkuhcpu9 LhHQUGdtqr5MeW6wzh3wOr8xV4Y3wyWjTFd10QGpHkVPGqezEjPY2xlligu96uBE3G3k14PoAye jHJ2tM01/E5SVZLqfYCbp0z/cAPeeckvXQFWP3yoB+KcqcM04QwdM2n0cTXJjasH61dJcbYDV6F FNyXMba7UoOFaJZQ9M53EVAt8hYSn2lar0tn3AdRpDSXaMfTtCQyOBjI1W6fZ2c8WuMCCkyVUoH wxrwKqKfvwhV1Mqq7pvfyIAo0ZXhEXZuUA5HUFUISFUQ== X-Received: by 2002:a17:903:32cd:b0:2ae:aa16:ad09 with SMTP id d9443c01a7336-2aeae7d3ccbmr51238365ad.23.1773289955166; Wed, 11 Mar 2026 21:32:35 -0700 (PDT) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org, armbru@redhat.com, pbonzini@redhat.com, berrange@redhat.com, peterx@redhat.com, philmd@linaro.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH 6/7] hw/arm: fsl-imx6: Don't call qdev_get_machine in soc init Date: Thu, 12 Mar 2026 14:31:57 +1000 Message-ID: <20260312043158.4191378-7-alistair.francis@wdc.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260312043158.4191378-1-alistair.francis@wdc.com> References: <20260312043158.4191378-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::631; envelope-from=alistair23@gmail.com; helo=mail-pl1-x631.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: 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 @gmail.com) X-ZM-MESSAGEID: 1773289984976158500 Content-Type: text/plain; charset="utf-8" From: Alistair Francis Calling qdev_get_machine() in the soc_init function would result in the following assert ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed. when trying to run ./qemu-system-aarch64 -S -display none -M virt -device fsl-imx6,help as the machine wasn't created yet. We call qdev_get_machine() to obtain the number of CPUs in the machine. So instead of initialising the CPUs in the SoC init let's instead do it in the realise where the machine will exist. Signed-off-by: Alistair Francis Tested-by: Markus Armbruster --- hw/arm/fsl-imx6.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index 39667c4a49..f663ddbf0a 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -38,17 +38,10 @@ =20 static void fsl_imx6_init(Object *obj) { - MachineState *ms =3D MACHINE(qdev_get_machine()); FslIMX6State *s =3D FSL_IMX6(obj); char name[NAME_SIZE]; int i; =20 - for (i =3D 0; i < MIN(ms->smp.cpus, FSL_IMX6_NUM_CPUS); i++) { - snprintf(name, NAME_SIZE, "cpu%d", i); - object_initialize_child(obj, name, &s->cpu[i], - ARM_CPU_TYPE_NAME("cortex-a9")); - } - object_initialize_child(obj, "a9mpcore", &s->a9mpcore, TYPE_A9MPCORE_P= RIV); =20 object_initialize_child(obj, "ccm", &s->ccm, TYPE_IMX6_CCM); @@ -119,6 +112,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **= errp) unsigned int smp_cpus =3D ms->smp.cpus; DeviceState *mpcore =3D DEVICE(&s->a9mpcore); DeviceState *gic; + char name[NAME_SIZE]; =20 if (smp_cpus > FSL_IMX6_NUM_CPUS) { error_setg(errp, "%s: Only %d CPUs are supported (%d requested)", @@ -126,6 +120,12 @@ static void fsl_imx6_realize(DeviceState *dev, Error *= *errp) return; } =20 + for (i =3D 0; i < smp_cpus; i++) { + snprintf(name, NAME_SIZE, "cpu%d", i); + object_initialize_child(OBJECT(dev), name, &s->cpu[i], + ARM_CPU_TYPE_NAME("cortex-a9")); + } + for (i =3D 0; i < smp_cpus; i++) { =20 /* On uniprocessor, the CBAR is set to 0 */ --=20 2.53.0 From nobody Tue Apr 7 18:49:43 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1773290007; cv=none; d=zohomail.com; s=zohoarc; b=ke5wpPB3P04mgJ2qpuQ9ZkC/nlp91ARIhN9E+2tAcRnk0jJ9fjLUETsQmCQ1V9kZXjztf8COfstNqN/rsEma2XXFPMeWbPT5iAiIbke3cpAhsyuYbFPyNTCankGGAXC3/LPF/+8WyIe93YajFrfKbBt8VCDK5O2NJjmxIQu0Dro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773290007; 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=cHbr4hEjoQMVlYqOZABZzmZC8L2t+s/8o2sZGPYPLgA=; b=lwMTpi7ykMaFoeKCth2Fu2tKctdfeHfdJDqrb79xXtrx/NPfKQFNB7PCaVKC1sGJtQa+LshnL1g/HxmcH/S1Q1yY4NIs9S4mhqtzprmoThQTK293BixnokhTYDhaJP468zrbdB2CrAlXyyxHX5rROUj9NnrKRULmip7sQmZ8eqw= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773290007089456.5990088549778; Wed, 11 Mar 2026 21:33:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0Xj4-0004Wr-4b; Thu, 12 Mar 2026 00:32: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 1w0Xj2-0004WY-KI for qemu-devel@nongnu.org; Thu, 12 Mar 2026 00:32:44 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w0Xiz-0004HS-Hj for qemu-devel@nongnu.org; Thu, 12 Mar 2026 00:32:43 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-2ab232cc803so3205205ad.3 for ; Wed, 11 Mar 2026 21:32:41 -0700 (PDT) Received: from toolbx.alistair23.me ([2403:581e:fdf9:0:6209:4521:6813:45b7]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2aeae222ab6sm54340785ad.10.2026.03.11.21.32.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 21:32:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773289959; x=1773894759; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cHbr4hEjoQMVlYqOZABZzmZC8L2t+s/8o2sZGPYPLgA=; b=Zv0LoBpFe4D6cwTXQBISwDJWLG+AxuThf5nbn1HKRSLDf0Eile63U+CwVvRl08P5Oj 22QAqZhigoMTMOXKr4DebjbYvS/ZuAb1kEgcefOBtR0Ian83YLsXZFxR1KRTGp687y2Y 2vC/Wlq170ktu9r9+hGknYWS796CRHn0WH5OGZ2s8NDHud50NBPOxcGOkuGBTUKkGHi+ 8V5ZS4EsN+H+K6OC2YuNwE/LdhIXBXc8I9CtGFO3cK+x5PgZ0kUdzxxZswwGeNsNq5dp DyBwT88W7XjC/WC2ewFurUjGQ7i+C5GEOGDy08S1qWdKfzZu3puVQh4QRJMJtY3pimU/ IBXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773289959; x=1773894759; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=cHbr4hEjoQMVlYqOZABZzmZC8L2t+s/8o2sZGPYPLgA=; b=SfStFUIeBOzgY2cIoUxEwUroID4rn0kpvPSDAWDFdgF9DeEnBvbVvbfS/5a0Jrz7Fy MhFpVyhzido2LuHf3hLp+qhabZ/9VoeA2FS7SyQGjPzoe9Ax1MSYrWU+aDZLfj8w9hve F7TrSzND7vda2ZjRtz3kCv39iJh4Ygafd4O+HeROI2LvltT43eK2Bcv/e3WlVn6BwvAq 4w+n06XsXc28d17OnemMaYmj0VfSXSW5W5dx6okQn8TtptLFSxEagjQj8W+iSq55gjm4 cArlgBJaAsWG3fylZOdQGVaqCbPZF9EqST5URbfq2a0CiGE3h+aGY4wB86OCpDiH+SnI MEbw== X-Gm-Message-State: AOJu0YzycFJ6PGZ7MfprColBIoSCMiNwG/m1CQIYPV4ui+z1GykoF7xV OCx2YNPc1NCyhvPyBpyapAq0O+EPwuTsv4b6KEQQTzgkgnON42aWAS1xoe7s9SHh X-Gm-Gg: ATEYQzxoJXv7DCkMOyDlpOaPUdavmYZneBaVKEOJ3fgHnP93Eg6SpmBTrkKufmUyLU5 VQnWPVBnYbvQH+ILVlF090vQaLeVLCOtIJ5jlww5fj4imSCp0wZh2CvtgnTB1PAjL47wgxenRRg 5FdE8fkV8M9RqIv2mFcRIT3NkiaC+1v5W/FiTDV9swMej4TR3yMQ1BNcnBsmOR528/g3K0uCab4 B562mtHzcdUyaLF6itubVNM9bdXcjkvrW5aJDkMQFu6buxKy7w+NxXi88D8w5xpyUMiwj+jV4HE naqbxN/WkIeRkaRpH9CCZRYTPY8QM01SctLDG5NNg3HElA59A9PW6zaAqii0UKeTKeXfx/Ayt7Q WYLbeZbCi+KVmn/ciZuqaQRgzfjJ9J9zleEaj5OUGl+nLPNdjWtK2ViemTP6xXuD3DMp9BK5xD8 SOxcgypPMIpk1Y3bd1eeKbb7hcrXwtCwIZgZLE9s4oEg== X-Received: by 2002:a17:903:2a88:b0:2ae:7f70:b2aa with SMTP id d9443c01a7336-2aeae892fadmr55570035ad.29.1773289959242; Wed, 11 Mar 2026 21:32:39 -0700 (PDT) From: alistair23@gmail.com X-Google-Original-From: alistair.francis@wdc.com To: qemu-devel@nongnu.org, armbru@redhat.com, pbonzini@redhat.com, berrange@redhat.com, peterx@redhat.com, philmd@linaro.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH 7/7] hw/acpi: generic_event_device: Don't call qdev_get_machine in soc init Date: Thu, 12 Mar 2026 14:31:58 +1000 Message-ID: <20260312043158.4191378-8-alistair.francis@wdc.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260312043158.4191378-1-alistair.francis@wdc.com> References: <20260312043158.4191378-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::631; envelope-from=alistair23@gmail.com; helo=mail-pl1-x631.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: 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 @gmail.com) X-ZM-MESSAGEID: 1773290008833154100 Content-Type: text/plain; charset="utf-8" From: Alistair Francis Calling qdev_get_machine() in the soc_init function would result in the following assert ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed. when trying to run ./qemu-system-aarch64 -S -display none -M virt -device acpi-ged,help as the machine wasn't created yet. We call qdev_get_machine() to obtain the ram slots of the machine. So instead of initialising the GED in the init let's instead do it in the realise where the machine will exist. Signed-off-by: Alistair Francis Reviewed-by: Thomas Huth Tested-by: Markus Armbruster --- hw/acpi/generic_event_device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c index 30dab43a00..9e9416d406 100644 --- a/hw/acpi/generic_event_device.c +++ b/hw/acpi/generic_event_device.c @@ -506,6 +506,9 @@ static void acpi_ged_realize(DeviceState *dev, Error **= errp) uint32_t ged_events; int i; =20 + acpi_memory_hotplug_init(&s->container_memhp, OBJECT(dev), + &s->memhp_state, 0); + if (pcihp_state->use_acpi_hotplug_bridge) { s->ged_event_bitmap |=3D ACPI_GED_PCI_HOTPLUG_EVT; } @@ -568,8 +571,6 @@ static void acpi_ged_initfn(Object *obj) memory_region_init(&s->container_memhp, OBJECT(dev), "memhp container", MEMORY_HOTPLUG_IO_LEN); sysbus_init_mmio(sbd, &s->container_memhp); - acpi_memory_hotplug_init(&s->container_memhp, OBJECT(dev), - &s->memhp_state, 0); =20 memory_region_init_io(&ged_st->regs, obj, &ged_regs_ops, ged_st, TYPE_ACPI_GED "-regs", ACPI_GED_REG_COUNT); --=20 2.53.0