From nobody Wed Nov 27 19:38:46 2024 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1697699970; cv=none; d=zohomail.com; s=zohoarc; b=eSSdmFmXJZLdkeF5NAd65gnnoFVtQ8H2rFMc5OMAAdevCtqpqCB8Te/AIjz60wK9WvIYhCdNv9AMzJz6/XmN8sJ9RtEqI36GyJ7unLmCYaSkdnuSK3SUFze37rFjtt3UCRTLHcehJimeQNvgqsvNqqrQIgUCbMynhUGxd0N7qZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697699970; 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=FOncUjOO3yMCwvbdhDakCobkCJgYZJVQZiN+TzHHG2s=; b=LzlXhuT4r8fiScxLtLsJXx0fL9ubqoE2xGCrH7X3k/trTVmO5kBc5uRE/jDhRixiN1oT0rQMAhGsMYXe6Bx7oypJbvb7rDw+7lcGr/7W/OuTJ6t43wQlTPE34LbgUKtiuuZ1D00ccq0cedhwr58687foD/g/Brwme52nQ3QJMsI= 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 1697699969976140.57433776800156; Thu, 19 Oct 2023 00:19:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtNIx-00083j-Pe; Thu, 19 Oct 2023 03:18:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtNIN-0006aV-B2 for qemu-devel@nongnu.org; Thu, 19 Oct 2023 03:18:22 -0400 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtNIL-0003bV-A1 for qemu-devel@nongnu.org; Thu, 19 Oct 2023 03:18:15 -0400 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-507a29c7eefso6972333e87.1 for ; Thu, 19 Oct 2023 00:18:12 -0700 (PDT) Received: from localhost.localdomain (92.red-88-28-12.dynamicip.rima-tde.net. [88.28.12.92]) by smtp.gmail.com with ESMTPSA id y18-20020a5d4712000000b0031984b370f2sm3765991wrq.47.2023.10.19.00.18.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Oct 2023 00:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697699891; x=1698304691; 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=FOncUjOO3yMCwvbdhDakCobkCJgYZJVQZiN+TzHHG2s=; b=hbaqSxf7DxiBTz8M0isdUZq2zoH4UJ4v2ufU/jB/idSIidRMSVez5eFDQX9CZ87EIR wiGQs1QYoxRYt6CN6gno+SsmBAolfmnW9Xm6gOhu9pvLj6tKsxk1H/ZUQO0UJaxXwN1y WL40oyLBJhFI2DLlSuJT0uDcXV1OrMG2NH44FgjUKlHmlj1kB+WWWCficl0AQmtZwd9R 3jj94LFrygDDBdulRwf65xAorfHU/N/kgugCBxGSooVz+AyGhHR6UhLgrKh+768CR8pL 0VmaHBRurVEG/51gf2yxZWxF2aeokl65M21jUNWlMz2j1M2y5FCnXamxV7dUqlTMca5T suow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697699891; x=1698304691; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FOncUjOO3yMCwvbdhDakCobkCJgYZJVQZiN+TzHHG2s=; b=cuURaCpbA6bn52BVMu8h+ZDoA6BPLli6Rf68sm6muQrudjg2XBhagWFfMHcds5D2k8 0Cl5mCGPzKErGmxFPGutsDCrd1mmkDfmkIdBJMUgtIN62CMqSdAeSfRQO13YRY/PhXvf FSAg8ex9JJLBXuHwioWVjnNLRWTpAyaa924CHuFjVuhTO3tgvdITcDVbvVRusuxyV/7d NtBaMN4HYhRAcp84DrS9WdkhqC29RkoPNZODAz3RmETmFqRvM4m/uqILxfpBCdCMy0H/ Bmj08dd/EyCaoLqYaPnFOvZPpWdxMKo+u0q+kRnyCByeDZRN0VILIBd3AiQOwelDlsde xGCQ== X-Gm-Message-State: AOJu0YyKSBzO/1qKLYpV9GywDJlWVq32yt3KojkQCDNGisAZlnBfpOXg kdtGZ99DkiKQxn+rl3sTUEtqxVb4AvEuVDRpd8LSGg== X-Google-Smtp-Source: AGHT+IHED09FfRm185EjV8WIWXxbgD1kOMHDpgktRWcJ721G8Q6BLQD5bIfbXneGD15WhyHt+omDdQ== X-Received: by 2002:a19:f013:0:b0:4ff:7046:984a with SMTP id p19-20020a19f013000000b004ff7046984amr730479lfc.7.1697699891125; Thu, 19 Oct 2023 00:18:11 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Ilya Leoshkevich , Halil Pasic , Huacai Chen , Beniamino Galvani , Thomas Huth , Jiaxun Yang , Marcel Apfelbaum , qemu-arm@nongnu.org, Mark Cave-Ayland , Eric Farman , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-s390x@nongnu.org, Strahinja Jankovic , Richard Henderson , Markus Armbruster , Song Gao , Eduardo Habkost , Peter Xu , Sergio Lopez , Christian Borntraeger , David Hildenbrand , Peter Maydell , "Michael S. Tsirkin" , Jason Wang Subject: [PATCH v2 11/12] hw/sysbus: Ensure device is not realized before adding MMIO region Date: Thu, 19 Oct 2023 09:16:09 +0200 Message-ID: <20231019071611.98885-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231019071611.98885-1-philmd@linaro.org> References: <20231019071611.98885-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::134; envelope-from=philmd@linaro.org; helo=mail-lf1-x134.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1697699982444100002 sysbus_init_mmio() should not be called on realized device. Reviewed-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/sysbus.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 35f902b582..8f53cb926b 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/module.h" +#include "qemu/error-report.h" #include "hw/sysbus.h" #include "monitor/monitor.h" #include "exec/address-spaces.h" @@ -192,6 +193,11 @@ void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion = *memory) int n; =20 assert(dev->num_mmio < QDEV_MAX_MMIO); + if (DEVICE(dev)->realized) { + error_report("sysbus_init_mmio(type:%s) but object is realized", + object_get_typename(OBJECT(dev))); + abort(); + } n =3D dev->num_mmio++; dev->mmio[n].addr =3D -1; dev->mmio[n].memory =3D memory; --=20 2.41.0