From patchwork Mon Jul 17 16:37:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 108021 Delivered-To: patches@linaro.org Received: by 10.140.101.44 with SMTP id t41csp4738617qge; Mon, 17 Jul 2017 09:37:45 -0700 (PDT) X-Received: by 10.28.148.67 with SMTP id w64mr5058579wmd.55.1500309465765; Mon, 17 Jul 2017 09:37:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500309465; cv=none; d=google.com; s=arc-20160816; b=lhToEBolq/WYlYsAzkY69oq12ig/cC5rWqt1oamcrVdRFWAbpMlKtoJB6tdVeKEB3R z0mSVGgKjuMHRVvl7ZatvOseUInDOtBaiiE2oem4750MHJe+hg6QEYKdBDadK/cmmhCj TKaZJmkevUmnUKLKBL42fZW9YNeARd806leK0nnKSI2V/F00SCtz6OG1Bl7L3oc9ydJu cGxFWkCWkcTjTl2lT4Wsn3lflRZbL1kVDk77MitjSWfTgUGyXX5ebE+DEMvXrgkM/LFU 4kIpmfcXgKojTvIjgbaK97TN4qt4lUp/giJnwNronHAU9dyH4eY1WcSzQPzhcMTCZYcy ityQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=+nSGGR0YWe8vZjGQdVoEOoXgoi43efeDGTgNuDVq5iU=; b=Luxu4S6GREh/B+Ums7HIz/kXq02A4XJWMR3uwwYtLGSymjSZW0dbaITmgr0cTedEkT v4kyIKdXta5teTdwUGRx0Q+gW6n3QeEsJPALTcW7WMG79mZfa9Ez4LP1fv7emZbyKpS2 oQv3FAenKVtWu6H8ZcYvfH9yZA8Zv2moqW0fJqMnWAx+0/bDkB+UVCa7xVZL2LBpWNjk /W2MHrLKAt7GxCuzQX/5pHDmuGKU5cH3IVc5exrRF5w9b1/JFLDioGeZnI/LFEnvFRWb SRdYsW6E/oFVmt5L5gXxUKJR13UbNJ68Zk2dT2+hIlc/x6vZFQC0mz3NDSW/e9+bgact tp1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id k18si2994003wre.315.2017.07.17.09.37.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 09:37:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 Cc: patches@linaro.org, qemu-trivial@nongnu.org Subject: [PATCH for-2.10] hw/display/sm501: Don't use vmstate_register_ram_global() 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 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 --- 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(-) -- 2.7.4 Reviewed-by: Dr. David Alan Gilbert 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 *dev, s->local_mem_size_index); /* local memory */ - memory_region_init_ram_nomigrate(&s->local_mem_region, OBJECT(dev), "sm501.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 = memory_region_get_ram_ptr(&s->local_mem_region);