From nobody Sun Apr 28 16:58:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500309527354749.3907561581416; Mon, 17 Jul 2017 09:38:47 -0700 (PDT) Received: from localhost ([::1]:51478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX92h-0000li-5c for importer@patchew.org; Mon, 17 Jul 2017 12:38:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX91n-0000Og-Lx for qemu-devel@nongnu.org; Mon, 17 Jul 2017 12:37:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX91m-0005Pb-VB for qemu-devel@nongnu.org; Mon, 17 Jul 2017 12:37:47 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:37642) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dX91m-0005Om-Nr for qemu-devel@nongnu.org; Mon, 17 Jul 2017 12:37:46 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1dX91j-0003lf-S4; Mon, 17 Jul 2017 17:37:43 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 17:37:42 +0100 Message-Id: <1500309462-12792-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH for-2.10] hw/display/sm501: Don't use vmstate_register_ram_global() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The sm501 device uses vmstate_register_ram_global() to register its memory region for migration. This means it gets a name that is assumed to be global to the whole system, which in turn means that if you create two of the device we assert because of the duplication: qemu-system-ppc -device sm501 -device sm501 RAMBlock "sm501.local" already registered, abort! Aborted (core dumped) Changing this to just use memory_region_init_ram()'s automatic registration of the memory region with a device-local name fixes this. The downside is that it breaks migration compatibility, but luckily we only added migration support to this device in the 2.10 release cycle so we haven't released a QEMU version with the broken implementation. Signed-off-by: Peter Maydell Reviewed-by: Dr. David Alan Gilbert --- Recent refactoring that renamed the old "memory_region_init_ram" to memory_region_init_ram_nomigrate" made this bug a bit easier to find via grep... hw/display/sm501.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index af792c5..9aa515b 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -1578,9 +1578,8 @@ static void sm501_init(SM501State *s, DeviceState *de= v, s->local_mem_size_index); =20 /* local memory */ - memory_region_init_ram_nomigrate(&s->local_mem_region, OBJECT(dev), "s= m501.local", + memory_region_init_ram(&s->local_mem_region, OBJECT(dev), "sm501.local= ", get_local_mem_size(s), &error_fatal); - vmstate_register_ram_global(&s->local_mem_region); memory_region_set_log(&s->local_mem_region, true, DIRTY_MEMORY_VGA); s->local_mem =3D memory_region_get_ram_ptr(&s->local_mem_region); =20 --=20 2.7.4