From nobody Thu Nov 13 20:40:39 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582579785; cv=none; d=zohomail.com; s=zohoarc; b=bD7DKuVl6rKfyJHkI1DM05YXxsF+5YM0ZBTfMgk49HMhMES28wUsebSpVYFIoa5FAz5o71SlVxlwpws0LgzoZRxhXsV3c7ib4PPKP4TLVu5dcfcsjhF2+gsjssHLEEuJW1zMSCBnyf5TL7rnxpAqS6waQ/+28fPzc1+at+RVABQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582579785; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1VSR9kygTTReaCRIBAeG2Orj1G8eqxnIXlzuyJCEoZ4=; b=mA90UUXyfYmjji7LqIDcDPco8Cjf0V++RG9ZuB6Avh+8ZJ6PjeFnSVIirko0yA9EC35pn3cPafwlBBXHIImq21Oh5lJYSl38FcWDSL8TY/qwLJsv/AjJcd57Sv4QPjwdJ/8vEhrthbsyvMnK+fMu03IZMX3gEiEF6vkyiRuWr98= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1582579785569940.2638663674903; Mon, 24 Feb 2020 13:29:45 -0800 (PST) Received: from localhost ([::1]:43954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LIO-00050Z-GI for importer@patchew.org; Mon, 24 Feb 2020 16:29:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53374) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KrY-0007CT-Uc for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:02:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KrX-0007fs-RV for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:02:00 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:49945 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6KrX-0007fS-LX for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:59 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-64-KtlOQdrDNIqNkAe5mYpYMw-1; Mon, 24 Feb 2020 16:01:55 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0F682800D50; Mon, 24 Feb 2020 21:01:51 +0000 (UTC) Received: from x1w.redhat.com (ovpn-205-162.brq.redhat.com [10.40.205.162]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B8005C297; Mon, 24 Feb 2020 21:01:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578119; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1VSR9kygTTReaCRIBAeG2Orj1G8eqxnIXlzuyJCEoZ4=; b=B2X1L++BEQctj/a4pfjIJO48EcV4w20W0dzyZlZ2z/DmSnifSgq5+pqcuSnz3Q5vZk6vgE en/UUDK2rikn5RFc7eSsrBChfkiVB6NnSoj+8wlazYW38J/QtVgi9NUKSbKXZ4KkboGLqJ mt4UVypmOP1cO6MYfeC32oUu/WEN8DA= X-MC-Unique: KtlOQdrDNIqNkAe5mYpYMw-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 26/32] hw/display: Let devices own the MemoryRegion they create Date: Mon, 24 Feb 2020 21:55:27 +0100 Message-Id: <20200224205533.23798-27-philmd@redhat.com> In-Reply-To: <20200224205533.23798-1-philmd@redhat.com> References: <20200224205533.23798-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sagar Karandikar , "Michael S. Tsirkin" , Jason Wang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , KONRAD Frederic , Alistair Francis , "Edgar E. Iglesias" , Subbaraya Sundeep , qemu-block@nongnu.org, Magnus Damm , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Joel Stanley , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Aleksandar Rikalo , David Gibson , Artyom Tarasenko , Eduardo Habkost , Jean-Christophe Dubois , Alistair Francis , Fabien Chouteau , qemu-arm@nongnu.org, Peter Chubb , Palmer Dabbelt , Richard Henderson , Kevin Wolf , qemu-riscv@nongnu.org, Igor Mitsyanko , Bastian Koppelmann , Laurent Vivier , Max Reitz , Michael Walle , qemu-ppc@nongnu.org, Aleksandar Markovic , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Avoid orphan memory regions being added in the /unattached QOM container. This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/display/g364fb.c | 3 ++- hw/display/macfb.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c index 55185c95c6..adcba96e34 100644 --- a/hw/display/g364fb.c +++ b/hw/display/g364fb.c @@ -477,7 +477,8 @@ static void g364fb_init(DeviceState *dev, G364State *s) =20 s->con =3D graphic_console_init(dev, 0, &g364fb_ops, s); =20 - memory_region_init_io(&s->mem_ctrl, NULL, &g364fb_ctrl_ops, s, "ctrl",= 0x180000); + memory_region_init_io(&s->mem_ctrl, OBJECT(dev), &g364fb_ctrl_ops, s, + "ctrl", 0x180000); memory_region_init_ram_ptr(&s->mem_vram, NULL, "vram", s->vram_size, s->vram); vmstate_register_ram(&s->mem_vram, dev); diff --git a/hw/display/macfb.c b/hw/display/macfb.c index 8bff16d535..b68faff4bb 100644 --- a/hw/display/macfb.c +++ b/hw/display/macfb.c @@ -362,8 +362,8 @@ static void macfb_common_realize(DeviceState *dev, Macf= bState *s, Error **errp) return; } =20 - memory_region_init_io(&s->mem_ctrl, NULL, &macfb_ctrl_ops, s, "macfb-c= trl", - 0x1000); + memory_region_init_io(&s->mem_ctrl, OBJECT(dev), &macfb_ctrl_ops, s, + "macfb-ctrl", 0x1000); =20 memory_region_init_ram_nomigrate(&s->mem_vram, OBJECT(s), "macfb-vram", MACFB_VRAM_SIZE, errp); --=20 2.21.1