From nobody Thu Nov 13 19:20:31 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=1582578053; cv=none; d=zohomail.com; s=zohoarc; b=Jb7w0ZuoRCKhYE+8x7i6xc/6DBOzU1mYo+Ox0J9hYYNlseNF/nEFGqopqK1l3IYJjpKFiCC53hFJBIgYeFKjbHUUilucErY4qEdltdDN5sRzgsfmElmqxRk1iFiPRjj3le6y9g3aNXujnNkwLtJGLtjwO3FMLEnM1BJE6/PqJMQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582578053; 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=aBf1Nz3dO7lmnq6x8HgckUD4/9P7/UEzlUI+mgbV/5Q=; b=iCEPJQal79QQXghYR/ovkhNbpxltnhpjgGIK4X/xAqt+k8XgZdzVD963KVtfqih6DKe2I+YL4OEFbk/rgXJIKB5oEZERBF0yeuL9FlbQZ0fK5/hTZixu5s7i31V1ub89bDEDJl4/yVRqtdzQIFPvtYHA+x4MSctllni1xIfJkmU= 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 1582578053082539.002409200686; Mon, 24 Feb 2020 13:00:53 -0800 (PST) Received: from localhost ([::1]:43032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KqR-0005KF-Qr for importer@patchew.org; Mon, 24 Feb 2020 16:00:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50187) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Km4-00063N-MG for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:56:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Km2-0002xu-KL for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:56:20 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:48018 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 1j6Km2-0002wv-Dm for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:56:18 -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-268-vv3vpfscMoS28J8ygPcnhA-1; Mon, 24 Feb 2020 15:56:15 -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 E001B107ACC4; Mon, 24 Feb 2020 20:56:10 +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 C390B5C883; Mon, 24 Feb 2020 20:55:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577777; 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=aBf1Nz3dO7lmnq6x8HgckUD4/9P7/UEzlUI+mgbV/5Q=; b=Z7IFn7uMULPt+eEx54eV8f1N9jpH0HtqbV/jXBGsuPXv2eqlqXjaJP/arRvd559dcfotUJ SpWvpQM4SwpnHK3GgYRe0Jo1RXXLlp4saq37BttCMSee1NnHQW9gHpDBr8kJ7uom03lYHk jKC4UKb5LHddmKs5AUnaSDXe6MXxLi8= X-MC-Unique: vv3vpfscMoS28J8ygPcnhA-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 01/32] memory: Correctly return alias region type Date: Mon, 24 Feb 2020 21:55:02 +0100 Message-Id: <20200224205533.23798-2-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, qemu-trivial@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" Since memory region aliases are neither rom nor ram, they are described as i/o, which is often incorrect. Return instead the type of the original region we are aliasing. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- Cc: qemu-trivial@nongnu.org memory.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/memory.c b/memory.c index aeaa8dcc9e..ce1179874e 100644 --- a/memory.c +++ b/memory.c @@ -2818,6 +2818,9 @@ void address_space_destroy(AddressSpace *as) =20 static const char *memory_region_type(MemoryRegion *mr) { + if (mr->alias) { + return memory_region_type(mr->alias); + } if (memory_region_is_ram_device(mr)) { return "ramd"; } else if (memory_region_is_romd(mr)) { --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582578676; cv=none; d=zohomail.com; s=zohoarc; b=HQZzljFvqv6tc8mUoVpNdeAoGsca0MVUiU3848/U8ZVC3xaQMYzDMcsdAgiNfYRwYowCt5r0Zv9+WBUlI9JxkwHz8jaIZsJWRu6a/MBNINycSPWDQewhShhE6cxUaee5pws87ZvtS7c/jAXPFEoojJi1DWMENZNP7bi606GLYAA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582578676; 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=FHdRJiFy2+sRYmNBB/Zm10M7PeGOon/0i7FrH36WST8=; b=X32839Xc/jTy3uAEcJ40RYNE6vleuWhMO+lPEhHhP6SdAm1P3z8/hIP6Z+lAC4AeWY1b090llgL8MK97btnPxC60KBvCK6gmxOw211ZBC3F8xyplIg8nryWkNdAFnoCLUZqb1oKQrWBWQ6ReFRZ5kF7WE38O4z8oUyakS0joZh4= 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 1582578676620244.25822875957624; Mon, 24 Feb 2020 13:11:16 -0800 (PST) Received: from localhost ([::1]:43416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6L0T-0005CP-LN for importer@patchew.org; Mon, 24 Feb 2020 16:11:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50338) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KmC-0006Ld-4Y for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:56:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KmB-00037J-0o for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:56:27 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:45375 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6KmA-00036f-SK for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:56:26 -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-90-RETixul5O6-YeTanaLpfrg-1; Mon, 24 Feb 2020 15:56:24 -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 81726800D50; Mon, 24 Feb 2020 20:56:20 +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 5EDC95C21B; Mon, 24 Feb 2020 20:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577786; 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=FHdRJiFy2+sRYmNBB/Zm10M7PeGOon/0i7FrH36WST8=; b=Yx2g4ZaM0Gm8cjug/fJBtqZg3EeOsPg8f9U+z1u3+crPu4Ba6QSfIYuN3e3+mKwut5q+2n lNjZSlq9AJUw/AQjrwKAA+LOMXWlPQiCejhRJvDJhkmPo0cwm6HGLwbjp7wv6lBKdVQM/Y 4KoIe8b231GsvVmPWU/0uPrzWkkbxSw= X-MC-Unique: RETixul5O6-YeTanaLpfrg-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 02/32] memory: Simplify memory_region_init_rom_nomigrate() to ease review Date: Mon, 24 Feb 2020 21:55:03 +0100 Message-Id: <20200224205533.23798-3-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.120 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" memory_region_init_rom_nomigrate() has the same content than memory_region_init_ram_shared_nomigrate(), with setting the readonly mode. The code is easier to review as creating a readonly ram/shared/nomigrate region. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alistair Francis --- memory.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/memory.c b/memory.c index ce1179874e..6a327a54ed 100644 --- a/memory.c +++ b/memory.c @@ -1659,19 +1659,8 @@ void memory_region_init_rom_nomigrate(MemoryRegion *= mr, uint64_t size, Error **errp) { - Error *err =3D NULL; - memory_region_init(mr, owner, name, size); - mr->ram =3D true; + memory_region_init_ram_shared_nomigrate(mr, owner, name, size, false, = errp); mr->readonly =3D true; - mr->terminates =3D true; - mr->destructor =3D memory_region_destructor_ram; - mr->ram_block =3D qemu_ram_alloc(size, false, mr, &err); - mr->dirty_log_mask =3D tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0; - if (err) { - mr->size =3D int128_zero(); - object_unparent(OBJECT(mr)); - error_propagate(errp, err); - } } =20 void memory_region_init_rom_device_nomigrate(MemoryRegion *mr, --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582578859; cv=none; d=zohomail.com; s=zohoarc; b=WzRAN9Mrd8+F+yZQHcQACMUzqSbSxh/224HqJFlVU4K8wl1gC2esb/2OVToJESMb0tnT6w1h5pLGmJN7irZ5KTNe/J0jJJxeH7XF1FUwSvGBggU+yL4fNajNwd+t9ji0fQqFk4K/zFIT1doyQ77P1WYe5JI5XXtYsBC25I8yb+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582578859; 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=pxC+1Wm7lZTcIVTNIaK8R7xk0TXOBYBpGoQjSWP/PII=; b=ZUdPWX19kggeNHd7nkdWmtYeOKhqspzyi/hDRHpnfdjXfVtZphBDxGx/RjO9oBQZ5nUdvmZSbeO3XKrN2Flkt+ftTqfwmVNsjF8wcqRpT5U1eIk4dFOni4qyctXZYo/LZg+cuNWzG6N45PAlC+ABYFrQd3I8Vpz307LWY60htBc= 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 1582578859485891.1424704443654; Mon, 24 Feb 2020 13:14:19 -0800 (PST) Received: from localhost ([::1]:43508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6L3S-0002uS-C3 for importer@patchew.org; Mon, 24 Feb 2020 16:14:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50575) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KmS-0006zx-IG for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:56:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KmR-0003VA-Dt for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:56:44 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:26012 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6KmR-0003Ty-7k for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:56:43 -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-171-sOX200VyNxifcfS9zL5_kw-1; Mon, 24 Feb 2020 15:56:40 -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 C6FD6801A10; Mon, 24 Feb 2020 20:56:36 +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 EF3215C21B; Mon, 24 Feb 2020 20:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577802; 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=pxC+1Wm7lZTcIVTNIaK8R7xk0TXOBYBpGoQjSWP/PII=; b=SRhIM+TgDp2i5P0dJi6aik0JN29ICMtBUxNYDUrBhLhjX9w5mbkNtjbyfl71eFwDs1dXwT /WEKoTIUtThtVFflbItb7/oEuSjdggbSb6n/omcMag3/UqZSRJd0nLzhlKosjObP5pMQm5 WPqZqYiPozSvtxsYyjrEMr8bT98/RFk= X-MC-Unique: sOX200VyNxifcfS9zL5_kw-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 03/32] scripts/cocci: Rename memory-region-{init-ram -> housekeeping} Date: Mon, 24 Feb 2020 21:55:04 +0100 Message-Id: <20200224205533.23798-4-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] [fuzzy] X-Received-From: 207.211.31.120 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" As we are going to add various semantic changes related to the memory region API, rename this script to be more generic. Add a 'usage' header, and an entry in MAINTAINERS to avoid checkpatch warning. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- ...t-ram.cocci =3D> memory-region-housekeeping.cocci} | 13 +++++++++++++ MAINTAINERS | 1 + 2 files changed, 14 insertions(+) rename scripts/coccinelle/{memory-region-init-ram.cocci =3D> memory-region= -housekeeping.cocci} (84%) diff --git a/scripts/coccinelle/memory-region-init-ram.cocci b/scripts/cocc= inelle/memory-region-housekeeping.cocci similarity index 84% rename from scripts/coccinelle/memory-region-init-ram.cocci rename to scripts/coccinelle/memory-region-housekeeping.cocci index d290150872..3699c1017e 100644 --- a/scripts/coccinelle/memory-region-init-ram.cocci +++ b/scripts/coccinelle/memory-region-housekeeping.cocci @@ -1,3 +1,16 @@ +/* + Usage: + + spatch \ + --macro-file scripts/cocci-macro-file.h \ + --sp-file scripts/coccinelle/memory-region-housekeeping.cocci \ + --keep-comments \ + --in-place \ + --dir . + +*/ + + // Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram // code sequences with use of the new memory_region_init_ram function. // Similarly for the _rom and _rom_device functions. diff --git a/MAINTAINERS b/MAINTAINERS index 195dd58cac..316a8edbb6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1998,6 +1998,7 @@ F: include/exec/ramblock.h F: memory.c F: include/exec/memory-internal.h F: exec.c +F: scripts/coccinelle/memory-region-housekeeping.cocci =20 SPICE M: Gerd Hoffmann --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582579973; cv=none; d=zohomail.com; s=zohoarc; b=lSIBCERkLN9OqgKDDuqgOB9XXkKaQrrDaBRtykOhUNgXf5mc7UpzqcLoywfm+2f/ZLMgThDEP4tFTl3KkbbSxbKAaGVyaUrnjmjc4w1K/EUiMhVbb+9+mBCFc4R4MHzAi6rKoENUTvhD5b8/hEjLTAY3dKzXXKQu/udYR0MqWbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582579973; 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=KKIXWkZQ88WTduFFFkbsC3MYjrqzYmU5aP3tKw4s+ro=; b=WP5RBz0ihXE/NFc84iwkFvNljq7xHgic65/Q/nc+t4WtdzOIXrRpT+CR4KINx7tLKJCepMjSWtP616YZQNL3GuD317V/gwEQLFewnK33LkXprXBKHZCWtZEDPuJvjFB0OJy5k9kv3KDw2W8gusYUDm0MIMLnEW8S+MMrTyR8e9U= 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 1582579973051670.8210114735791; Mon, 24 Feb 2020 13:32:53 -0800 (PST) Received: from localhost ([::1]:44050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LLP-0001lv-TD for importer@patchew.org; Mon, 24 Feb 2020 16:32:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51344) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Knc-00015P-7J for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:57:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KnZ-0004fZ-8Y for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:57:54 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:37883 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6KnZ-0004fM-3V for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:57:53 -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-153-ApolAFJKPmSPJtMxhx_p5A-1; Mon, 24 Feb 2020 15:57:14 -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 B59881882CCC; Mon, 24 Feb 2020 20:57:09 +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 463715C578; Mon, 24 Feb 2020 20:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577872; 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=KKIXWkZQ88WTduFFFkbsC3MYjrqzYmU5aP3tKw4s+ro=; b=guT+fWixqMy03zZ+3nvTZ/Tw9YyasJQ2yyojJz30HWg+oqhkFYDX4n6E1/Fn0n1R6xW7vM NFsk2G/77jL+Vtgg3VjMqNRS0T2ANlC1cfiZa3CnG8vkgY04H4FAHUv+AOC18622OR4oFm oXrc9hxbkEGF374XwGUm/Lh0nMPFp7A= X-MC-Unique: ApolAFJKPmSPJtMxhx_p5A-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 04/32] scripts/cocci: Patch to replace memory_region_init_{ram, readonly -> rom} Date: Mon, 24 Feb 2020 21:55:05 +0100 Message-Id: <20200224205533.23798-5-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] [fuzzy] X-Received-From: 207.211.31.120 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" Add a semantic patch to replace memory_region_init_ram(readonly) by memory_region_init_rom(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- .../memory-region-housekeeping.cocci | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/coccinelle/memory-region-housekeeping.cocci b/scripts/= coccinelle/memory-region-housekeeping.cocci index 3699c1017e..ee3923d369 100644 --- a/scripts/coccinelle/memory-region-housekeeping.cocci +++ b/scripts/coccinelle/memory-region-housekeeping.cocci @@ -11,6 +11,24 @@ */ =20 =20 +// Replace memory_region_init_ram(readonly) by memory_region_init_rom() +@@ +expression E1, E2, E3, E4, E5; +symbol true; +@@ +( +- memory_region_init_ram(E1, E2, E3, E4, E5); ++ memory_region_init_rom(E1, E2, E3, E4, E5); + ... WHEN !=3D E1 +- memory_region_set_readonly(E1, true); +| +- memory_region_init_ram_nomigrate(E1, E2, E3, E4, E5); ++ memory_region_init_rom_nomigrate(E1, E2, E3, E4, E5); + ... WHEN !=3D E1 +- memory_region_set_readonly(E1, true); +) + + // Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram // code sequences with use of the new memory_region_init_ram function. // Similarly for the _rom and _rom_device functions. --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582579657; cv=none; d=zohomail.com; s=zohoarc; b=bVQkxrTJQi6apjkd/X6iDFIT4jzr+YaXbp0OIPY5SsW7M/GnbPdz1e0u4allVRoaBpG9LgeZqpPxzFs9kQFuSwlIERB58FiHzLuyAAooZf6TjqHQdb09eENbc019Gsmp1ru2nvEMf/PZ+McluxfTkiJGnjPf/exF3Z8z78OlzxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582579657; 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=shskCEX2uYtXc4beNl78HPxrHEcrnngUbNyRlJDIBE8=; b=d6DdOGWF0K8g4Ohwxgj6qPscScHHut5LoEwUQIeeu5WvaBqgssRy62OcOLqZBOBsaGyAT/DvPZB+hZKKhCm/6jHmpQTRbsfzb+gzRxc+z2zrGsOelNGoxRpAJNTqXcnn+P2/+1JKblv1KELeZDf/5ZL1ixl2sFrp2bqvTg198fY= 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 1582579657747515.5374329946155; Mon, 24 Feb 2020 13:27:37 -0800 (PST) Received: from localhost ([::1]:43894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LGK-0001E7-JL for importer@patchew.org; Mon, 24 Feb 2020 16:27:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51215) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KnJ-0000T8-5x for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:57:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KnH-0004LZ-II for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:57:36 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:23218 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6KnH-0004L4-4z for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:57:35 -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-384-ZTrULF2jMiO5BKSC1h24ow-1; Mon, 24 Feb 2020 15:57:32 -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 A39B3801FA7; Mon, 24 Feb 2020 20:57:28 +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 3C9995C241; Mon, 24 Feb 2020 20:57:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577854; 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=shskCEX2uYtXc4beNl78HPxrHEcrnngUbNyRlJDIBE8=; b=B9WtCZnehnMS9NX1zocgB3+Jsk3Kg9uQIHatKr7Qdvt+7doKuJYvEYdx5+xPbrkGG4050+ UXvGYvet3D2gVBYlmLc3YOpPAj/LopuS79engnX11Rl4OmpqmJlXLPWv6RJPdSlz2XE97I 9DXgVR/nOezge5eWVarAzXN5KQ7nvjI= X-MC-Unique: ZTrULF2jMiO5BKSC1h24ow-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 05/32] hw/arm: Use memory_region_init_rom() with read-only regions Date: Mon, 24 Feb 2020 21:55:06 +0100 Message-Id: <20200224205533.23798-6-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.120 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" This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/exynos4210.c | 3 +-- hw/arm/mainstone.c | 3 +-- hw/arm/omap_sx1.c | 6 ++---- hw/arm/palm.c | 3 +-- hw/arm/spitz.c | 3 +-- hw/arm/stellaris.c | 3 +-- hw/arm/tosa.c | 3 +-- 7 files changed, 8 insertions(+), 16 deletions(-) diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 59a27bdd68..3af6502a5e 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -311,9 +311,8 @@ static void exynos4210_realize(DeviceState *socdev, Err= or **errp) &s->chipid_mem); =20 /* Internal ROM */ - memory_region_init_ram(&s->irom_mem, NULL, "exynos4210.irom", + memory_region_init_rom(&s->irom_mem, NULL, "exynos4210.irom", EXYNOS4210_IROM_SIZE, &error_fatal); - memory_region_set_readonly(&s->irom_mem, true); memory_region_add_subregion(system_mem, EXYNOS4210_IROM_BASE_ADDR, &s->irom_mem); /* mirror of iROM */ diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c index 6e64dfab50..05a806b422 100644 --- a/hw/arm/mainstone.c +++ b/hw/arm/mainstone.c @@ -125,9 +125,8 @@ static void mainstone_common_init(MemoryRegion *address= _space_mem, /* Setup CPU & memory */ mpu =3D pxa270_init(address_space_mem, mainstone_binfo.ram_size, machine->cpu_type); - memory_region_init_ram(rom, NULL, "mainstone.rom", MAINSTONE_ROM, + memory_region_init_rom(rom, NULL, "mainstone.rom", MAINSTONE_ROM, &error_fatal); - memory_region_set_readonly(rom, true); memory_region_add_subregion(address_space_mem, 0, rom); =20 #ifdef TARGET_WORDS_BIGENDIAN diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c index be245714db..6c3fd1b271 100644 --- a/hw/arm/omap_sx1.c +++ b/hw/arm/omap_sx1.c @@ -126,9 +126,8 @@ static void sx1_init(MachineState *machine, const int v= ersion) mpu =3D omap310_mpu_init(dram, machine->cpu_type); =20 /* External Flash (EMIFS) */ - memory_region_init_ram(flash, NULL, "omap_sx1.flash0-0", flash_size, + memory_region_init_rom(flash, NULL, "omap_sx1.flash0-0", flash_size, &error_fatal); - memory_region_set_readonly(flash, true); memory_region_add_subregion(address_space, OMAP_CS0_BASE, flash); =20 memory_region_init_io(&cs[0], NULL, &static_ops, &cs0val, @@ -168,9 +167,8 @@ static void sx1_init(MachineState *machine, const int v= ersion) if ((version =3D=3D 1) && (dinfo =3D drive_get(IF_PFLASH, 0, fl_idx)) !=3D NULL) { MemoryRegion *flash_1 =3D g_new(MemoryRegion, 1); - memory_region_init_ram(flash_1, NULL, "omap_sx1.flash1-0", + memory_region_init_rom(flash_1, NULL, "omap_sx1.flash1-0", flash1_size, &error_fatal); - memory_region_set_readonly(flash_1, true); memory_region_add_subregion(address_space, OMAP_CS1_BASE, flash_1); =20 memory_region_init_io(&cs[1], NULL, &static_ops, &cs1val, diff --git a/hw/arm/palm.c b/hw/arm/palm.c index 72eca8cc55..265d5891a6 100644 --- a/hw/arm/palm.c +++ b/hw/arm/palm.c @@ -206,9 +206,8 @@ static void palmte_init(MachineState *machine) mpu =3D omap310_mpu_init(dram, machine->cpu_type); =20 /* External Flash (EMIFS) */ - memory_region_init_ram(flash, NULL, "palmte.flash", flash_size, + memory_region_init_rom(flash, NULL, "palmte.flash", flash_size, &error_fatal); - memory_region_set_readonly(flash, true); memory_region_add_subregion(address_space_mem, OMAP_CS0_BASE, flash); =20 memory_region_init_io(&cs[0], NULL, &static_ops, &cs0val, "palmte-cs0", diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index e001088103..1d27399721 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -924,8 +924,7 @@ static void spitz_common_init(MachineState *machine, =20 sl_flash_register(mpu, (model =3D=3D spitz) ? FLASH_128M : FLASH_1024M= ); =20 - memory_region_init_ram(rom, NULL, "spitz.rom", SPITZ_ROM, &error_fatal= ); - memory_region_set_readonly(rom, true); + memory_region_init_rom(rom, NULL, "spitz.rom", SPITZ_ROM, &error_fatal= ); memory_region_add_subregion(address_space_mem, 0, rom); =20 /* Setup peripherals */ diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 221a78674e..d136ba1a92 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -1300,9 +1300,8 @@ static void stellaris_init(MachineState *ms, stellari= s_board_info *board) sram_size =3D ((board->dc0 >> 18) + 1) * 1024; =20 /* Flash programming is done via the SCU, so pretend it is ROM. */ - memory_region_init_ram(flash, NULL, "stellaris.flash", flash_size, + memory_region_init_rom(flash, NULL, "stellaris.flash", flash_size, &error_fatal); - memory_region_set_readonly(flash, true); memory_region_add_subregion(system_memory, 0, flash); =20 memory_region_init_ram(sram, NULL, "stellaris.sram", sram_size, diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c index 4d95a1f3e2..5dee2d76c6 100644 --- a/hw/arm/tosa.c +++ b/hw/arm/tosa.c @@ -226,8 +226,7 @@ static void tosa_init(MachineState *machine) =20 mpu =3D pxa255_init(address_space_mem, tosa_binfo.ram_size); =20 - memory_region_init_ram(rom, NULL, "tosa.rom", TOSA_ROM, &error_fatal); - memory_region_set_readonly(rom, true); + memory_region_init_rom(rom, NULL, "tosa.rom", TOSA_ROM, &error_fatal); memory_region_add_subregion(address_space_mem, 0, rom); =20 tmio =3D tc6393xb_init(address_space_mem, 0x10000000, --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582579276; cv=none; d=zohomail.com; s=zohoarc; b=Ei1WBH7Y84CjUdQb9uFdbMY0uL9//jL0co2PhwA9mu2VhMiDVWhK8JIgsdQB82/zSv0aRx4dr7FKTfU4s+jG/4hligUc2X2JOliHA+CBKkMILCEBt+HJPY1f1kRSPQY/oIybans6zYAZWtLdtpNTOJvj6niT+L6TrcK7waw5Tj4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582579276; 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=DAKyL7Tqa+fBdxrFOnKvFsx39GH2EjqIV6ZKoapzE/Q=; b=SzfInpKc6TS+iw+ipTMZ0vOACRpUFXRcNG+zQJersH3mhqfXGQNzXOwqwb8GuVTD5TW8aUW1zzDEIfpsHIfv8+nvkXq1r+UtXbmTYyrZbbbFDmHGo7kxGnjZvQfBCVVFKS6C0Ub/EeNuxIJhVzBIrf6BK1Ob3VCXKIn8NUK0m3c= 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 1582579276614159.30178976356888; Mon, 24 Feb 2020 13:21:16 -0800 (PST) Received: from localhost ([::1]:43702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LAB-0005pL-9Q for importer@patchew.org; Mon, 24 Feb 2020 16:21:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51315) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KnT-0000rh-QP for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:57:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KnS-0004Zp-Pz for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:57:47 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:34974 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 1j6KnR-0004XD-M4 for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:57:46 -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-92-WEuuKmVzO9K1-WgNWVdffA-1; Mon, 24 Feb 2020 15:57:43 -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 17FC6800D53; Mon, 24 Feb 2020 20:57:39 +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 2364C5C651; Mon, 24 Feb 2020 20:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577865; 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=DAKyL7Tqa+fBdxrFOnKvFsx39GH2EjqIV6ZKoapzE/Q=; b=JRs2QhDPrB+Zgz0xB54Bkj7P+WmgAyBM0/cg9Ffq48VaVkhigOp0fHqfp4oJ1Kb6fFAxv1 Uj8RgmYynhKpdgAVB7P+EISYLg/eNT7n5wqUrVyipSIoj5DaEz1IHAdXfK1Gse2+IgMvdv XLjAenVhPBa3UPqCue+rZ7bczOMFWA8= X-MC-Unique: WEuuKmVzO9K1-WgNWVdffA-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 06/32] hw/display: Use memory_region_init_rom() with read-only regions Date: Mon, 24 Feb 2020 21:55:07 +0100 Message-Id: <20200224205533.23798-7-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" This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/display/cg3.c | 5 ++--- hw/display/tcx.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/display/cg3.c b/hw/display/cg3.c index 4fb67c6b1c..a1ede10394 100644 --- a/hw/display/cg3.c +++ b/hw/display/cg3.c @@ -287,9 +287,8 @@ static void cg3_initfn(Object *obj) SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); CG3State *s =3D CG3(obj); =20 - memory_region_init_ram_nomigrate(&s->rom, obj, "cg3.prom", FCODE_MAX_R= OM_SIZE, - &error_fatal); - memory_region_set_readonly(&s->rom, true); + memory_region_init_rom_nomigrate(&s->rom, obj, "cg3.prom", + FCODE_MAX_ROM_SIZE, &error_fatal); sysbus_init_mmio(sbd, &s->rom); =20 memory_region_init_io(&s->reg, obj, &cg3_reg_ops, s, "cg3.reg", diff --git a/hw/display/tcx.c b/hw/display/tcx.c index ca458f94fe..76de16e8ea 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -755,9 +755,8 @@ static void tcx_initfn(Object *obj) SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); TCXState *s =3D TCX(obj); =20 - memory_region_init_ram_nomigrate(&s->rom, obj, "tcx.prom", FCODE_MAX_R= OM_SIZE, - &error_fatal); - memory_region_set_readonly(&s->rom, true); + memory_region_init_rom_nomigrate(&s->rom, obj, "tcx.prom", + FCODE_MAX_ROM_SIZE, &error_fatal); sysbus_init_mmio(sbd, &s->rom); =20 /* 2/STIP : Stippler */ --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582579817; cv=none; d=zohomail.com; s=zohoarc; b=nVH2CNYJqxYEoQuz3DYMQuFmrl5dEC9GD/ks++DRuryfrVQeKoNR8H+7KrUa+6mKyXKzH2ZvuNobBkJX8CNf7uL8+a4B9+V4MlIoRtU1FVBioHRWG4PnF8GuqVVLkCep5+yOvTEyy1F9SN4yCjdH7wFxY/B6KoGjtq+ApKU0p+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582579817; 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=EimZBb/wTLnnIdXn4hxLBCiwdZq9+sATqGkFdsLXgrs=; b=NiCDGQRIoM/lRTLZIQh9izHIaIYHXTak8oIrOaHX9kV3rYA0qpqc4P3t3MMVIafWbuPj0h+aeRKV2Xh76PbZbqNWOG+n4Qhp3xLu8GF0gCEMcoEdi1BZDBQwfooX6f/iEChd7g02KuHIyW44vYo5ndKaC2AEBzxdd/kETQ5NxAU= 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 1582579817736298.40380471375613; Mon, 24 Feb 2020 13:30:17 -0800 (PST) Received: from localhost ([::1]:43956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LIu-0005dT-KR for importer@patchew.org; Mon, 24 Feb 2020 16:30:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51414) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Knh-0001GT-PE for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Kng-0004jb-Eo for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:01 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:37899 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 1j6Kng-0004j6-Aw for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:00 -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-255-Uo2-Nbj1PWqzfAAFdLsOig-1; Mon, 24 Feb 2020 15:57:58 -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 42A6C189F760; Mon, 24 Feb 2020 20:57:54 +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 8B02A5C54A; Mon, 24 Feb 2020 20:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577879; 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=EimZBb/wTLnnIdXn4hxLBCiwdZq9+sATqGkFdsLXgrs=; b=YOhV4u2ZGJGL/D8Vj/E1TraHTGHYCG6LexYypjybsWeUKnCcMl9w9n4oy5ezw8sCOGIpV2 fsWyTz/AGFQ/Y32Edkv52hCX19/B/RKs7XtBS1P4SVnqa6yL95d+rq9CChJ5GKuJ4ypb8c 7vEEItH8pm8gq+FkWi5TEGoErzKWFQs= X-MC-Unique: Uo2-Nbj1PWqzfAAFdLsOig-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 07/32] hw/mips: Use memory_region_init_rom() with read-only regions Date: Mon, 24 Feb 2020 21:55:08 +0100 Message-Id: <20200224205533.23798-8-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] [fuzzy] X-Received-From: 207.211.31.81 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" This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Aleksandar Markovic --- hw/mips/mips_fulong2e.c | 3 +-- hw/mips/mips_jazz.c | 6 ++---- hw/mips/mips_mipssim.c | 3 +-- hw/mips/mips_r4k.c | 3 +-- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 2e043cbb98..547a7d3a45 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -319,9 +319,8 @@ static void mips_fulong2e_init(MachineState *machine) =20 /* allocate RAM */ memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram", ram_si= ze); - memory_region_init_ram(bios, NULL, "fulong2e.bios", BIOS_SIZE, + memory_region_init_rom(bios, NULL, "fulong2e.bios", BIOS_SIZE, &error_fatal); - memory_region_set_readonly(bios, true); =20 memory_region_add_subregion(address_space_mem, 0, ram); memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios); diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 66fd4d867d..cf47335ea5 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -195,9 +195,8 @@ static void mips_jazz_init(MachineState *machine, machine->ram_size); memory_region_add_subregion(address_space, 0, ram); =20 - memory_region_init_ram(bios, NULL, "mips_jazz.bios", MAGNUM_BIOS_SIZE, + memory_region_init_rom(bios, NULL, "mips_jazz.bios", MAGNUM_BIOS_SIZE, &error_fatal); - memory_region_set_readonly(bios, true); memory_region_init_alias(bios2, NULL, "mips_jazz.bios", bios, 0, MAGNUM_BIOS_SIZE); memory_region_add_subregion(address_space, 0x1fc00000LL, bios); @@ -263,9 +262,8 @@ static void mips_jazz_init(MachineState *machine, { /* Simple ROM, so user doesn't have to provide one */ MemoryRegion *rom_mr =3D g_new(MemoryRegion, 1); - memory_region_init_ram(rom_mr, NULL, "g364fb.rom", 0x80000, + memory_region_init_rom(rom_mr, NULL, "g364fb.rom", 0x80000, &error_fatal); - memory_region_set_readonly(rom_mr, true); uint8_t *rom =3D memory_region_get_ram_ptr(rom_mr); memory_region_add_subregion(address_space, 0x60000000, rom_mr); rom[0] =3D 0x10; /* Mips G364 */ diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c index b934ca9d51..3fdbb21680 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -169,9 +169,8 @@ mips_mipssim_init(MachineState *machine) /* Allocate RAM. */ memory_region_allocate_system_memory(ram, NULL, "mips_mipssim.ram", ram_size); - memory_region_init_ram(bios, NULL, "mips_mipssim.bios", BIOS_SIZE, + memory_region_init_rom(bios, NULL, "mips_mipssim.bios", BIOS_SIZE, &error_fatal); - memory_region_set_readonly(bios, true); =20 memory_region_add_subregion(address_space_mem, 0, ram); =20 diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index b2aec434c3..54b286ceee 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -241,9 +241,8 @@ void mips_r4k_init(MachineState *machine) dinfo =3D drive_get(IF_PFLASH, 0, 0); if ((bios_size > 0) && (bios_size <=3D BIOS_SIZE)) { bios =3D g_new(MemoryRegion, 1); - memory_region_init_ram(bios, NULL, "mips_r4k.bios", BIOS_SIZE, + memory_region_init_rom(bios, NULL, "mips_r4k.bios", BIOS_SIZE, &error_fatal); - memory_region_set_readonly(bios, true); memory_region_add_subregion(get_system_memory(), 0x1fc00000, bios); =20 load_image_targphys(filename, 0x1fc00000, BIOS_SIZE); --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580096; cv=none; d=zohomail.com; s=zohoarc; b=J8YiArOIpc/62skbKhNmbgcTauB9oXmtrG3u2AtZErJlTxsX+J56Hzct8JLyM6bQjIGS+ap4wOdtI0KXs5McyLe+3nr4TTxMBbfqypmHeGIidP8HR1PUkOIGtfjk9luiyiVvPt0w2X19Jzd4+LSQecaPgmv+ShiljRgu4HBVUzE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580096; 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=AksPoeIdaQJuU1Oxkwgd0bzdhJ7x56x3M7zV8fEB+j0=; b=jwuk0y1Sa/RDzOx9oSJcTrXU/PzYvDzSjS63S+mFNtT1CtcTLfyB2yPjkZ3d8GWf+H5pfW+xJN6dfVqr6Hf4vzXnAdO39Fsy5MUR7EI2Y9YEMsDbnCT2UGblVaNEgEcZ9FOQ1GuXlMAw/CmmhZQypT2HJUe0cafWt4qq8YavLiM= 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 1582580096351433.7835442009309; Mon, 24 Feb 2020 13:34:56 -0800 (PST) Received: from localhost ([::1]:44132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LNP-0005iZ-61 for importer@patchew.org; Mon, 24 Feb 2020 16:34:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51520) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Knw-0001Rw-5A for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Knr-0004rV-6M for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:16 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:29831 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 1j6Knr-0004qt-2R for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:11 -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-387-By03AjPXPKavwCoPGL_ANw-1; Mon, 24 Feb 2020 15:58:07 -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 D7866107B7E0; Mon, 24 Feb 2020 20:58:03 +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 B66195C651; Mon, 24 Feb 2020 20:57:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577890; 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=AksPoeIdaQJuU1Oxkwgd0bzdhJ7x56x3M7zV8fEB+j0=; b=Z2j9fXT6e+srkbP5Pa/EjG2G92NrUAjxovUImGpGuXMjNKSgg3uP7ntEbRe+jJV/mICJlH bwrB5LQ7KZCuBjZOCaKQIyVLNuQYrbFpWDkoX9IxwmRFpHEIwYPRUFtrJZK2GAU8B6LC3L sN/hXIJIiivHdTvoFCVIjYTFrVMcoTM= X-MC-Unique: By03AjPXPKavwCoPGL_ANw-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 08/32] hw/m68k: Use memory_region_init_rom() with read-only regions Date: Mon, 24 Feb 2020 21:55:09 +0100 Message-Id: <20200224205533.23798-9-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] [fuzzy] X-Received-From: 207.211.31.81 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" This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/m68k/q800.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 1e32363688..8083326d37 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -402,13 +402,12 @@ static void q800_init(MachineState *machine) uint8_t *ptr; /* allocate and load BIOS */ rom =3D g_malloc(sizeof(*rom)); - memory_region_init_ram(rom, NULL, "m68k_mac.rom", MACROM_SIZE, + memory_region_init_rom(rom, NULL, "m68k_mac.rom", MACROM_SIZE, &error_abort); if (bios_name =3D=3D NULL) { bios_name =3D MACROM_FILENAME; } filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); - memory_region_set_readonly(rom, true); memory_region_add_subregion(get_system_memory(), MACROM_ADDR, rom); =20 /* Load MacROM binary */ --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580193; cv=none; d=zohomail.com; s=zohoarc; b=OfcE+pGhIreWS4oe3eziYMnhMNoIIorpglgTi//Wohl77FwhHKfemz138PQWgE4PSd6P7+Iuu/TkWFqb+iZ48lnJRH+PVR7gRrN+aMPuiAtHibGxaiHnC3DHcz5nYQlJrAeFk5VpEExhQPzqncXRvskgIUz1Q4uyokthkjS74dc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580193; 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=knz40dufUs4PWVQeKdVgAiRIsXbEKuPQ/ZeRVaC47yU=; b=cYcoLDIUbQZPk1EXS6NT1STlh0uKJ5Rq9kQR1AjpLMJqemsFCsdmgM+V+6NMe7D3qNcJuwAA4vohNSFRWWeArHLQ8pqK4aXKeind1pPioYozFZ7X+TZTxps9WbrBEfraqzjB15rTTsyRvqZKWMmRPydb/xZawTR9WDVW92LWAVU= 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 15825801934541002.4812541059619; Mon, 24 Feb 2020 13:36:33 -0800 (PST) Received: from localhost ([::1]:44196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LOy-0000V2-9y for importer@patchew.org; Mon, 24 Feb 2020 16:36:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51606) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Ko5-0001n7-SZ for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Ko4-00050d-Qq for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:25 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:56489 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 1j6Ko4-000504-L8 for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:24 -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-37-efIsC7Q1Ptedi1Yt4ObfpQ-1; Mon, 24 Feb 2020 15:58:22 -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 BAE978C7EA0; Mon, 24 Feb 2020 20:58:18 +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 50A2E5C883; Mon, 24 Feb 2020 20:58:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577904; 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=knz40dufUs4PWVQeKdVgAiRIsXbEKuPQ/ZeRVaC47yU=; b=DaAjxF90YT0QoFFguLqPPrir2/eO8wyQ/AEZTqonXWJcjHzYEq4nhTiYejXmfWRwOOrSam 34dy1LVgjNkM/xNjkHjwNUEXUrar53b6sagY7LraUHqGt8QRk+6HcxnofFGeev47E9JmYC chSsPaiL5ZhX1wN1XxhvcPq1fi+O4rc= X-MC-Unique: efIsC7Q1Ptedi1Yt4ObfpQ-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 09/32] hw/net: Use memory_region_init_rom() with read-only regions Date: Mon, 24 Feb 2020 21:55:10 +0100 Message-Id: <20200224205533.23798-10-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] [fuzzy] X-Received-From: 207.211.31.81 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" This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/dp8393x.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index a134d431ae..6bcdfe1a35 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -916,13 +916,12 @@ static void dp8393x_realize(DeviceState *dev, Error *= *errp) s->watchdog =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, dp8393x_watchdog, s); s->regs[SONIC_SR] =3D 0x0004; /* only revision recognized by Linux */ =20 - memory_region_init_ram(&s->prom, OBJECT(dev), - "dp8393x-prom", SONIC_PROM_SIZE, &local_err); + memory_region_init_rom(&s->prom, OBJECT(dev), "dp8393x-prom", + SONIC_PROM_SIZE, &local_err); if (local_err) { error_propagate(errp, local_err); return; } - memory_region_set_readonly(&s->prom, true); prom =3D memory_region_get_ram_ptr(&s->prom); checksum =3D 0; for (i =3D 0; i < 6; i++) { --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580313; cv=none; d=zohomail.com; s=zohoarc; b=ggxSZfFKOqhkmJfJ0/i3yWtGgivOQtmUJWkLYOE4ccMHNiZ312w+u5rscZwCcHZcve8R1oVy3RznK4Vh1HfIRr6bVy1ZLE1AFJngrWwdvTgnJvEq0yppJvq3iCVi3zuUaCRXkQb/DMr9aZqFnpxUTgEW0GlPNrK0wWj+ZbmSWu8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580313; 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=dr08go/2YrQpr64iTe2NKgIJYkg6wpcV7MJXPAVLFyo=; b=nB4sUQC9TGDBsK79k8ZPiVSF4wE3TvMbULFn+SLk9Rnz7Mj0LYoF7UjIqnE5Qoo66o74ha3mPypLeEjuBtwVrGXWDvBeuOzBOjdoXj/hV5cQ4lsgCRh15RmlzvLrP7LuTtbi7myFjiIpO4/013Fi7wlVGMVhxm2VsUJndkcFfYY= 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 1582580313678774.1018812150826; Mon, 24 Feb 2020 13:38:33 -0800 (PST) Received: from localhost ([::1]:44218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LQu-0003ST-H9 for importer@patchew.org; Mon, 24 Feb 2020 16:38:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51689) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KoF-0001yx-VA for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KoE-00056Y-TG for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:35 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:40494 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 1j6KoE-000561-Om for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:34 -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-403-Gnpu7LidMyms5mntC0aeZg-1; Mon, 24 Feb 2020 15:58:32 -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 6BABB107ACC7; Mon, 24 Feb 2020 20:58:28 +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 37FAB5C297; Mon, 24 Feb 2020 20:58:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577914; 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=dr08go/2YrQpr64iTe2NKgIJYkg6wpcV7MJXPAVLFyo=; b=Z/I1sDunlFRRnuSeerHB53LGebiUWQIGH+3iiikcW3vclZZdWTWVuB1xW6yQ4blYJTNckr +jNd6Y5RfrM+8sF3vysEdbBKvbb/CFxSZ6//Eo7QDSE6VD4WevVlSsazIipOTgfb2qNoLu 2g5FxycS8VyUleW5QGVac8wvO3lMIHg= X-MC-Unique: Gnpu7LidMyms5mntC0aeZg-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 10/32] hw/pci-host: Use memory_region_init_rom() with read-only regions Date: Mon, 24 Feb 2020 21:55:11 +0100 Message-Id: <20200224205533.23798-11-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] [fuzzy] X-Received-From: 207.211.31.81 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" This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: David Gibson --- hw/pci-host/prep.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c index 1aff72bec6..1a02e9a670 100644 --- a/hw/pci-host/prep.c +++ b/hw/pci-host/prep.c @@ -325,9 +325,8 @@ static void raven_realize(PCIDevice *d, Error **errp) d->config[0x0D] =3D 0x10; // latency_timer d->config[0x34] =3D 0x00; // capabilities_pointer =20 - memory_region_init_ram_nomigrate(&s->bios, OBJECT(s), "bios", BIOS_SIZ= E, - &error_fatal); - memory_region_set_readonly(&s->bios, true); + memory_region_init_rom_nomigrate(&s->bios, OBJECT(s), "bios", BIOS_SIZ= E, + &error_fatal); memory_region_add_subregion(get_system_memory(), (uint32_t)(-BIOS_SIZE= ), &s->bios); if (s->bios_name) { --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580460; cv=none; d=zohomail.com; s=zohoarc; b=COimBwSXH4BtIkNOxXSMmfeFOR0DZ0gXbYkTNv8wUCOwRAjr3l7qmWMsAbcONj3TaJGPyJtlaCmoWInRFaB7jvWByXnIlbXZWqxq9SMZhRRQ39OugOCy9GzrpYjW35lrxOc05oP+xE+QbOGx9cIqnv1KpAT7/BaJVIWczKvr0DY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580460; 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=g4lGHk6QRHeMqJdDVZg1X6stDT6EwWnjYxVVB4qV32g=; b=cl4RDjYwcp5uHUTKHcjoezQE17FEkMVGGQ5TK/az9hzUS1lAzq2D6GSkpZcSjL70fMd9GgvMWs4a5yglWTStWjneikN3k1IMlC2td2mhbl+4NAYCLwxX3FbuXvIJjGWWatIMvO9ebqNBDzV42NyvNIyD6cgp6EctP74+HVZjgFU= 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 158258046063869.56684806688008; Mon, 24 Feb 2020 13:41:00 -0800 (PST) Received: from localhost ([::1]:44292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LTH-0007wI-59 for importer@patchew.org; Mon, 24 Feb 2020 16:40:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51834) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KoV-0002Zi-2u for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KoT-0005ID-TW for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:50 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:54998 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 1j6KoT-0005HS-MZ for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:58:49 -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-204-4jvavk5APjisH5JRlTDLgA-1; Mon, 24 Feb 2020 15:58:47 -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 3F65A5EB; Mon, 24 Feb 2020 20:58:43 +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 DD36F5C241; Mon, 24 Feb 2020 20:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577929; 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=g4lGHk6QRHeMqJdDVZg1X6stDT6EwWnjYxVVB4qV32g=; b=izzDagO0HYrU2/OFidNsfEOITktLcFsloEtlYdGYkYzTFCAUg1Om3eC6FWfxE9R+mJC0CG cbj+oW5KrtBt6BiPuljiJtABUieCa+ppe4Eyx/1emtDFANg0+rvZkCzZWrn71xkDDrHzBA v7EiWh1QNbsPR6hen26Fy/U7ANB8L+8= X-MC-Unique: 4jvavk5APjisH5JRlTDLgA-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 11/32] hw/ppc: Use memory_region_init_rom() with read-only regions Date: Mon, 24 Feb 2020 21:55:12 +0100 Message-Id: <20200224205533.23798-12-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" This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: David Gibson --- hw/ppc/mac_newworld.c | 3 +-- hw/ppc/mac_oldworld.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 464d012103..566413e479 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -156,13 +156,12 @@ static void ppc_core99_init(MachineState *machine) memory_region_add_subregion(get_system_memory(), 0, ram); =20 /* allocate and load BIOS */ - memory_region_init_ram(bios, NULL, "ppc_core99.bios", BIOS_SIZE, + memory_region_init_rom(bios, NULL, "ppc_core99.bios", BIOS_SIZE, &error_fatal); =20 if (bios_name =3D=3D NULL) bios_name =3D PROM_FILENAME; filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); - memory_region_set_readonly(bios, true); memory_region_add_subregion(get_system_memory(), PROM_ADDR, bios); =20 /* Load OpenBIOS (ELF) */ diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 7318d7e9b4..8b22ff60b8 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -132,13 +132,12 @@ static void ppc_heathrow_init(MachineState *machine) memory_region_add_subregion(sysmem, 0, ram); =20 /* allocate and load BIOS */ - memory_region_init_ram(bios, NULL, "ppc_heathrow.bios", BIOS_SIZE, + memory_region_init_rom(bios, NULL, "ppc_heathrow.bios", BIOS_SIZE, &error_fatal); =20 if (bios_name =3D=3D NULL) bios_name =3D PROM_FILENAME; filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); - memory_region_set_readonly(bios, true); memory_region_add_subregion(sysmem, PROM_ADDR, bios); =20 /* Load OpenBIOS (ELF) */ --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580009; cv=none; d=zohomail.com; s=zohoarc; b=EZf956xjdfGu3Yh3tRfN++f+sr11XYYD/lRC6ka9EU2z1sVGiqeBjgmp9tDkTZi93WUHlPOmXcWIobw762wYVosPTHyiM+MtdVrvqkIq6/V8K5xvRUtaHPjjWb0D5Ea50STAxRCelJ9t8XEqQfvpX5qEwdkmqWRDp+P5MSCganc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580009; 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=P3w8ivNIF4UpJrLwaBVmXn62pv0y3fxnEFqqunnHBT8=; b=DmcMJJjKgfUp+bq4uAuSWZM9UDqPKhc6kzoq3tnQV7bH1i03Sjm23KYyBBUZ5eE+bybwpXsiUM8r2yIBn6T3G5B5AgsbcIVQ/gNM2gErNF68UNOKm/ye6k42Sqw+gnBe8VI3aVDY5VVCBgG5A/rTShYmrK+RNAlaMtxZXN8qPPc= 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 1582580009954583.4998952571999; Mon, 24 Feb 2020 13:33:29 -0800 (PST) Received: from localhost ([::1]:44070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LM0-0002zF-Rq for importer@patchew.org; Mon, 24 Feb 2020 16:33:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51943) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Kof-0002n3-RK for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Koe-0005VH-R1 for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:01 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:27195 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 1j6Koe-0005Uc-Mp for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:00 -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-74-dY66F7eDPRuLuatE5Zg2QQ-1; Mon, 24 Feb 2020 15:58:56 -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 C7DA91005512; Mon, 24 Feb 2020 20:58:52 +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 AD7EE5C651; Mon, 24 Feb 2020 20:58:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577940; 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=P3w8ivNIF4UpJrLwaBVmXn62pv0y3fxnEFqqunnHBT8=; b=i6E+PNIqZJ53z2wrj7vhj9+ZHzJUvWn14pM0iHtV+5TVqmTUDBtos43kF1G4VuBQGjKpo5 I6ypgjr/FeCs49DHX9cAytF3eldmes/cM2qg94PaAv1YT0i/LGtxUeHHWv2Jx4elLO4OqK S3jWFNr8EZcN0mXuyJxDdPlGBK4KDRM= X-MC-Unique: dY66F7eDPRuLuatE5Zg2QQ-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 12/32] hw/riscv: Use memory_region_init_rom() with read-only regions Date: Mon, 24 Feb 2020 21:55:13 +0100 Message-Id: <20200224205533.23798-13-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" This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/riscv/sifive_e.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c index 8a6b0348df..6f6360a619 100644 --- a/hw/riscv/sifive_e.c +++ b/hw/riscv/sifive_e.c @@ -208,9 +208,8 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev= , Error **errp) memmap[SIFIVE_E_PWM2].base, memmap[SIFIVE_E_PWM2].size); =20 /* Flash memory */ - memory_region_init_ram(&s->xip_mem, NULL, "riscv.sifive.e.xip", - memmap[SIFIVE_E_XIP].size, &error_fatal); - memory_region_set_readonly(&s->xip_mem, true); + memory_region_init_rom(&s->xip_mem, NULL, "riscv.sifive.e.xip", + memmap[SIFIVE_E_XIP].size, &error_fatal); memory_region_add_subregion(sys_mem, memmap[SIFIVE_E_XIP].base, &s->xip_mem); } --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580092; cv=none; d=zohomail.com; s=zohoarc; b=iExUeNby3gkt3eqC7+f19Nilazwdyoa45xZWWF5mm+NCCK/922hZkjHCvzNmRPbYTl5TgYa7L+rAccmS7WtvWC/XjGSWaYHEV5jXpdgOyrS0LoGz7d2jNRljGc0rxPoVca++XFO2zzxmQtDsqH1/kLl8/gL/nBiWwgBq+1iTDDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580092; 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=eENF83ZsU8Q/JST+/cnBMiYrotiX2pVY6D2cp7zhmT8=; b=QSx+dGFgAOV2cb+u7c21HBJabdtY1BTIxCJ1QCBkN490rmz8PEJNlIYReoAeUjqNiZ/NqJItcUGWoDGJjQj3pVEpUooTWunu/OCwxm8KD9wcHXxb+QuZ8RNQQ/YZdL31uHMluelZof9LCHrqlyhbZhyUF3q9Rve233uWLRuowrA= 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 1582580092820311.607520769599; Mon, 24 Feb 2020 13:34:52 -0800 (PST) Received: from localhost ([::1]:44130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LNK-0005VO-OT for importer@patchew.org; Mon, 24 Feb 2020 16:34:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52065) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Kos-0003Fl-Qj for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Kor-0005fU-R4 for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:14 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:47451 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6Kor-0005ex-Nc for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:13 -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-279-2zt37Q_CPcWfs3VWnHI3yQ-1; Mon, 24 Feb 2020 15:59:11 -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 925A313F8; Mon, 24 Feb 2020 20:59:07 +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 46F675C54A; Mon, 24 Feb 2020 20:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577953; 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=eENF83ZsU8Q/JST+/cnBMiYrotiX2pVY6D2cp7zhmT8=; b=ZJAycAb0LUDPq5CoG703B+88A3uDWrRD2eY8xf0VSEfZ8bcrd/nlLFF1bK3L16wzljUes/ LztPnn+fjQ0nVjqWBmiMn2FHzIuxuPL4wgAtw10NyV87aAPciHsuxBfUjZ5SZMRseDg7jk +7EwIlubx3KENDVF1i6xijGMB1jMaSg= X-MC-Unique: 2zt37Q_CPcWfs3VWnHI3yQ-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 13/32] hw/sh4: Use memory_region_init_rom() with read-only regions Date: Mon, 24 Feb 2020 21:55:14 +0100 Message-Id: <20200224205533.23798-14-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] [fuzzy] X-Received-From: 207.211.31.120 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" This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sh4/shix.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c index 2fc2915428..56c7d29bf5 100644 --- a/hw/sh4/shix.c +++ b/hw/sh4/shix.c @@ -53,8 +53,7 @@ static void shix_init(MachineState *machine) cpu =3D SUPERH_CPU(cpu_create(machine->cpu_type)); =20 /* Allocate memory space */ - memory_region_init_ram(rom, NULL, "shix.rom", 0x4000, &error_fatal); - memory_region_set_readonly(rom, true); + memory_region_init_rom(rom, NULL, "shix.rom", 0x4000, &error_fatal); memory_region_add_subregion(sysmem, 0x00000000, rom); memory_region_init_ram(&sdram[0], NULL, "shix.sdram1", 0x01000000, &error_fatal); --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582579430; cv=none; d=zohomail.com; s=zohoarc; b=EEdl1Bx+xBg7taAA0MwcJ2Gx9jxmMQuP1Z91RMsrr4xWXIrnQMnGYQ+XEhmbEyjPbkA2XsmiOQ2pgazPdQUglgGLXGxmLWTFLt6wUvSA8Un4B9pNEcyC3kCFiGCFjjNFD6cVv6it3wwfOWh8lQCrVYIp6zpBxlCsI05X+MznkYg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582579430; 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=Obnhgnn3k+TYUgOPS2vdiwScp7uLQL+D7VUoN9TWrvw=; b=ls6nzeNX6rGoFK6WkjEHuK3BvE/AGSiySJ20SEXp7doMjRv/nYNPCQdYD1iz8WE8SVcBiIS01x8scx2ES7uN3ygcznfg2QyQR8550u2YeT6ovSC/u0BArGXs87+pK95qLRPtcOdwYir9/GZ/hG9yVhBoMzUi2hwowK0Sr4m3Pmw= 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 1582579430798791.9939495496823; Mon, 24 Feb 2020 13:23:50 -0800 (PST) Received: from localhost ([::1]:43780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LCf-0002G5-Gv for importer@patchew.org; Mon, 24 Feb 2020 16:23:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52171) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Kp7-0003dU-00 for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Kp1-0005pX-JF for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:28 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:29441 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 1j6Kp1-0005oS-Fg for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:23 -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-340-E2INLCuiP026s5fU3mRTyg-1; Mon, 24 Feb 2020 15:59:21 -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 42DCD107ACC7; Mon, 24 Feb 2020 20:59:17 +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 164F95C241; Mon, 24 Feb 2020 20:59:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577963; 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=Obnhgnn3k+TYUgOPS2vdiwScp7uLQL+D7VUoN9TWrvw=; b=SMZluYH2B0aCSPlfvIvzPPRRgW7WW85soLI3JF8GeJ4T4rASGgcQXjRcPFnHLfV3toP1H8 dZUU7pLFc3BHuoUCFpztUSusQulabRo5NiNUH/+VlR1PPoVsSlc6/rRXpGJRXSyaNVIKPy lR3Es7fiBQ2+18RsltpAIt2CHB/5C90= X-MC-Unique: E2INLCuiP026s5fU3mRTyg-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 14/32] hw/sparc: Use memory_region_init_rom() with read-only regions Date: Mon, 24 Feb 2020 21:55:15 +0100 Message-Id: <20200224205533.23798-15-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" This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: KONRAD Frederic --- hw/sparc/leon3.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index f5a087dd86..23d0bdbd71 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -256,8 +256,7 @@ static void leon3_generic_hw_init(MachineState *machine) =20 /* Allocate BIOS */ prom_size =3D 8 * MiB; - memory_region_init_ram(prom, NULL, "Leon3.bios", prom_size, &error_fat= al); - memory_region_set_readonly(prom, true); + memory_region_init_rom(prom, NULL, "Leon3.bios", prom_size, &error_fat= al); memory_region_add_subregion(address_space_mem, LEON3_PROM_OFFSET, prom= ); =20 /* Load boot prom */ --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582579567; cv=none; d=zohomail.com; s=zohoarc; b=FkDtXc4vWy0N4l7Q4JVsQbuZucSEJLWzalGAwVqEOKRLT+GEnjdbjmFpASG9/IoWJvRq3hgSDI3Cu4w+49VIVqCPqdzycbWlHMyqQkpPXPjFrthwFhC6bYZw6g6CjpJ2T2HtCYnWtUbeyTsCJoITDxGK1Es/ObwyEFR/OQ2u390= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582579567; 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=I6SdkZkbHtZbpGj30/TNvSyK6rwDYnvFekTs4gXk1Gs=; b=RVfFc6zs15lPafKMPeEMYqul4WBeUoRWLZZcPoc+oF+IogtOhqTSU8CAUJhBFGAwVc/HGhslPkRjv/X3+D2NF11KJxYZdC2DhJhdMvdDh/5auQnHnbLLfstQ72zc7r9f+LibM3501AFg/DnRqR5rwOY6nYfH5NdvKEXEMQdBlmo= 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 1582579567238760.5525458901736; Mon, 24 Feb 2020 13:26:07 -0800 (PST) Received: from localhost ([::1]:43844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LEs-0006Zd-40 for importer@patchew.org; Mon, 24 Feb 2020 16:26:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52283) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KpH-0003yh-Lz for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KpG-00063E-L9 for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:39 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:52757 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6KpG-00062m-Fj for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:38 -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-493-MKBC_ZuIO0i3O8O_6e9F3g-1; Mon, 24 Feb 2020 15:59:36 -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 0E7AC189F760; Mon, 24 Feb 2020 20:59:32 +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 B01135C651; Mon, 24 Feb 2020 20:59:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577978; 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=I6SdkZkbHtZbpGj30/TNvSyK6rwDYnvFekTs4gXk1Gs=; b=M7oSuD3s4Y8EEhZDHwPLEqCdCH3jX0k2xvW4KZaATgIRRe/5Y/iXwG+ljKJbO94U1kDexE uN7LLUvFz21/s/8DfSxommH0HGJbZP/rjHgqEpTsZ8HNV2vvCbykD/vGGO+bZM3IesHBj9 vCRBM0eCha8pzga6UlV1OqFD6X5XiRU= X-MC-Unique: MKBC_ZuIO0i3O8O_6e9F3g-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 15/32] scripts/cocci: Patch to detect potential use of memory_region_init_rom Date: Mon, 24 Feb 2020 21:55:16 +0100 Message-Id: <20200224205533.23798-16-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] [fuzzy] X-Received-From: 207.211.31.120 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" Add a semantic patch to detect potential replacement of memory_region_init_ram(readonly) by memory_region_init_rom(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- .../memory-region-housekeeping.cocci | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/coccinelle/memory-region-housekeeping.cocci b/scripts/= coccinelle/memory-region-housekeeping.cocci index ee3923d369..9cdde71bb1 100644 --- a/scripts/coccinelle/memory-region-housekeeping.cocci +++ b/scripts/coccinelle/memory-region-housekeeping.cocci @@ -29,6 +29,25 @@ symbol true; ) =20 =20 +@possible_memory_region_init_rom@ +expression E1, E2, E3, E4, E5; +position p; +@@ +( + memory_region_init_ram@p(E1, E2, E3, E4, E5); + ... + memory_region_set_readonly(E1, true); +| + memory_region_init_ram_nomigrate@p(E1, E2, E3, E4, E5); + ... + memory_region_set_readonly(E1, true); +) +@script:python@ +p << possible_memory_region_init_rom.p; +@@ +cocci.print_main("potential use of memory_region_init_rom*() in ", p) + + // Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram // code sequences with use of the new memory_region_init_ram function. // Similarly for the _rom and _rom_device functions. --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580228; cv=none; d=zohomail.com; s=zohoarc; b=crxLKx+d0Pb7rhWwSDlaiCh9VcPtnLNFBEL4sNbUgAvPh9cHifBnXHaQ7bdTCLc1Nj7SegMQ9kH8uvjDby7j1TcRwWjDGwLbd/z9GV16e8zq/61owZl1w9AMKHuXHKUQb/wgw5u+vayChokihB6RYalvJKiShXDlIg2pt7Gn86c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580228; 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=lSVtvfrX1T1hW1+GelbNbTHoIYbtGWi72bTWri8Gs/8=; b=ervCS2qW7nAEJqakm7Hus3yQHmpXIHaPDW854v7JEWpRhO+pLu4BQHyL998qOps+401Mnb5h9/UmjmjIx4xeQlbwZ/RpRbknYM5fPrmpn7fjUh226MrZg9DqnXDSsQh8ZWNz+PFtkvOcgvouGbadxHRdjEBJf0Yu85tv+e4UdeE= 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 1582580228098613.4990023106959; Mon, 24 Feb 2020 13:37:08 -0800 (PST) Received: from localhost ([::1]:44198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LPW-0001JX-VA for importer@patchew.org; Mon, 24 Feb 2020 16:37:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52392) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KpR-00049a-Pt for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KpP-0006Dm-Vs for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:49 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:29162 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 1j6KpP-0006D1-S6 for qemu-devel@nongnu.org; Mon, 24 Feb 2020 15:59:47 -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-177-21bPmpMIOFiU2zTeKeBseA-1; Mon, 24 Feb 2020 15:59:45 -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 9FD12107ACC4; Mon, 24 Feb 2020 20:59:41 +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 84E005C21B; Mon, 24 Feb 2020 20:59:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582577987; 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=lSVtvfrX1T1hW1+GelbNbTHoIYbtGWi72bTWri8Gs/8=; b=XSBCnjIyEIp9IlPSCn6Sz8L+ECXAxZfbt0LRLc5Uf9Ir8uQatXufNndjF1T48QGSaNbiYv 19VmFHV/s+lNxRQjbM74rL3dm7y3YbADYdeZ3FfJxIGmwQacHg5TEUc56XrUNAJKwSCiua pU5POEzX6FddBS/K18+yVToJUeoBAFU= X-MC-Unique: 21bPmpMIOFiU2zTeKeBseA-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 16/32] hw/arm/stm32: Use memory_region_init_rom() with read-only regions Date: Mon, 24 Feb 2020 21:55:17 +0100 Message-Id: <20200224205533.23798-17-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] [fuzzy] X-Received-From: 207.211.31.81 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" The scripts/coccinelle/memory-region-housekeeping.cocci reported: * TODO [[view:./hw/arm/stm32f205_soc.c::face=3Dovl-face1::linb=3D96::colb= =3D4::cole=3D26][potential use of memory_region_init_rom*() in ./hw/arm/st= m32f205_soc.c::96]] * TODO [[view:./hw/arm/stm32f405_soc.c::face=3Dovl-face1::linb=3D98::colb= =3D4::cole=3D26][potential use of memory_region_init_rom*() in ./hw/arm/st= m32f405_soc.c::98]] We can indeed replace the memory_region_init_ram() and memory_region_set_readonly() calls by memory_region_init_rom(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/stm32f205_soc.c | 4 +--- hw/arm/stm32f405_soc.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c index 627fd446f5..2de56275b7 100644 --- a/hw/arm/stm32f205_soc.c +++ b/hw/arm/stm32f205_soc.c @@ -93,12 +93,10 @@ static void stm32f205_soc_realize(DeviceState *dev_soc,= Error **errp) MemoryRegion *flash =3D g_new(MemoryRegion, 1); MemoryRegion *flash_alias =3D g_new(MemoryRegion, 1); =20 - memory_region_init_ram(flash, NULL, "STM32F205.flash", FLASH_SIZE, + memory_region_init_rom(flash, NULL, "STM32F205.flash", FLASH_SIZE, &error_fatal); memory_region_init_alias(flash_alias, NULL, "STM32F205.flash.alias", flash, 0, FLASH_SIZE); - - memory_region_set_readonly(flash, true); memory_region_set_readonly(flash_alias, true); =20 memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash); diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c index 9bcad97853..b8fca13f95 100644 --- a/hw/arm/stm32f405_soc.c +++ b/hw/arm/stm32f405_soc.c @@ -95,7 +95,7 @@ static void stm32f405_soc_realize(DeviceState *dev_soc, E= rror **errp) Error *err =3D NULL; int i; =20 - memory_region_init_ram(&s->flash, NULL, "STM32F405.flash", FLASH_SIZE, + memory_region_init_rom(&s->flash, NULL, "STM32F405.flash", FLASH_SIZE, &err); if (err !=3D NULL) { error_propagate(errp, err); @@ -103,8 +103,6 @@ static void stm32f405_soc_realize(DeviceState *dev_soc,= Error **errp) } memory_region_init_alias(&s->flash_alias, NULL, "STM32F405.flash.alias= ", &s->flash, 0, FLASH_SIZE); - - memory_region_set_readonly(&s->flash, true); memory_region_set_readonly(&s->flash_alias, true); =20 memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, &s->fla= sh); --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580579; cv=none; d=zohomail.com; s=zohoarc; b=cOUeOCu1JaRXXPJ13Bj3qfgjyg+6T8LsVxPhzHld8EcUEB9lUvdoZjVxEVcrbAmtgLvNfHZxP5owqgbTTV+ae8B5VVdWjs9zwr5tYVEpLCjBY5Q96/pceD/AEA+KpwArSc3nGK5m4QeBxYrQd1+6nXGCr1mFNkyx3DPWTtgFaCs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580579; 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=EJ6nybCOc2PUBAOje33aa01DAeFm33Ptzm0BhXgaMB8=; b=jB4f0hpuPIY8FW5ODD3nh4BLeTWHrJeQAmmNyDApy/HzZ/IZaoCfWQxeYSOFpvxYt7wVD+jZ4oX0/hRu2Mh0pugZOfnybatSlFSqh4bSJ0NODCydbTW43AkqRkeiX7yeYxN1UYM0Swr/ZWvuu3y/Bip6h2iHxz3yszb2dnZ4s+c= 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 1582580579085355.88875776919576; Mon, 24 Feb 2020 13:42:59 -0800 (PST) Received: from localhost ([::1]:44344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LVB-00034j-Po for importer@patchew.org; Mon, 24 Feb 2020 16:42:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52490) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Kpg-0004bH-DF for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:00:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Kpf-0006Nn-5K for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:00:04 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:54330 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 1j6Kpf-0006Lu-0w for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:00:03 -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-463-MenuiiyUMWeXQD373e_pzQ-1; Mon, 24 Feb 2020 16:00:00 -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 605D08017CC; Mon, 24 Feb 2020 20:59:56 +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 1A50C5C651; Mon, 24 Feb 2020 20:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578002; 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=EJ6nybCOc2PUBAOje33aa01DAeFm33Ptzm0BhXgaMB8=; b=OqVAlVD+OJAqW9z/CJhV5mJS+8BrQoC8dzLepMtlf52ypYYQrhAPMUUopBmjdVT6lQOmX3 fiK6lHucEs1VunppfwTTnCSHIYQMISFZjWQfrrfvJp05EDPhGlHkNt7fzeu6stmFlp/4+z UkXksqI6ZhME7V9a4MROrcygAZOy7lc= X-MC-Unique: MenuiiyUMWeXQD373e_pzQ-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 17/32] hw/ppc/ppc405: Use memory_region_init_rom() with read-only regions Date: Mon, 24 Feb 2020 21:55:18 +0100 Message-Id: <20200224205533.23798-18-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] [fuzzy] X-Received-From: 207.211.31.81 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" The scripts/coccinelle/memory-region-housekeeping.cocci reported: * TODO [[view:./hw/ppc/ppc405_boards.c::face=3Dovl-face1::linb=3D195::colb= =3D8::cole=3D30][potential use of memory_region_init_rom*() in ./hw/ppc/pp= c405_boards.c::195]] * TODO [[view:./hw/ppc/ppc405_boards.c::face=3Dovl-face1::linb=3D464::colb= =3D8::cole=3D30][potential use of memory_region_init_rom*() in ./hw/ppc/pp= c405_boards.c::464]] We can indeed replace the memory_region_init_ram() and memory_region_set_readonly() calls by memory_region_init_rom(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: David Gibson --- hw/ppc/ppc405_boards.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index 1f721feed6..5afe023253 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -192,7 +192,7 @@ static void ref405ep_init(MachineState *machine) #endif { bios =3D g_new(MemoryRegion, 1); - memory_region_init_ram(bios, NULL, "ef405ep.bios", BIOS_SIZE, + memory_region_init_rom(bios, NULL, "ef405ep.bios", BIOS_SIZE, &error_fatal); =20 if (bios_name =3D=3D NULL) @@ -216,7 +216,6 @@ static void ref405ep_init(MachineState *machine) /* Avoid an uninitialized variable warning */ bios_size =3D -1; } - memory_region_set_readonly(bios, true); } /* Register FPGA */ ref405ep_fpga_init(sysmem, 0xF0300000); @@ -461,7 +460,7 @@ static void taihu_405ep_init(MachineState *machine) if (bios_name =3D=3D NULL) bios_name =3D BIOS_FILENAME; bios =3D g_new(MemoryRegion, 1); - memory_region_init_ram(bios, NULL, "taihu_405ep.bios", BIOS_SIZE, + memory_region_init_rom(bios, NULL, "taihu_405ep.bios", BIOS_SIZE, &error_fatal); filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { @@ -479,7 +478,6 @@ static void taihu_405ep_init(MachineState *machine) error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } - memory_region_set_readonly(bios, true); } /* Register Linux flash */ dinfo =3D drive_get(IF_PFLASH, 0, fl_idx); --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580141; cv=none; d=zohomail.com; s=zohoarc; b=AaYuhnC+rCYbqtpklbDSpUk+O8iNOnmSNq0f0zSIYh+9om5/KMAgh2r3z3DWK5kkoUo2v8eNOujFtGsp7yWRh+/ilVdAKyvg/u2N+3HNB8r9KbJTX5wk4Vk2zRnUgUcu97mpTm1UNXLfilo2kseqmgqMlXW8Wg7/t/IVqepeqBs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580141; 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=GBNzuBX+l+LuROYmtlMct7VCTnb/r/o0TNqAlSU1sE8=; b=mFdYDxLkXwHIqRP2tsK2O+SlqiW4iXKPkgGWyboFfqcS8vQUA0v4lEburKce2AHxA8Mpl+nO9tSPCgawcnSfEngEG3nDhkdKeaoAMuM5a8G6l8lta83dNZjFU/K3dpIC3A1cqFQ4oD4NkT/hwN3cjEDiQeaNeSwI9Wo/uh/ZxyQ= 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 1582580141813232.61242259648554; Mon, 24 Feb 2020 13:35:41 -0800 (PST) Received: from localhost ([::1]:44166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LO8-0007MJ-HF for importer@patchew.org; Mon, 24 Feb 2020 16:35:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52659) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Kpx-00051u-Em for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:00:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Kpw-0006an-0D for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:00:21 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:20259 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6Kpv-0006aP-RD for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:00:19 -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-13-5sQM0hkiO1O7hIVqfdrbZQ-1; Mon, 24 Feb 2020 16:00:15 -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 298FC8018A4; Mon, 24 Feb 2020 21:00:11 +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 2D05B5C54A; Mon, 24 Feb 2020 20:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578019; 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=GBNzuBX+l+LuROYmtlMct7VCTnb/r/o0TNqAlSU1sE8=; b=NYWYdq638vLw1UySYVSXgYs5hb2ilS5AYmowNfJfhxQAqGMwkrL8vKIJSX/kzje8C027Ui 3SP3ZXd79/jiJE1L9WkAuE9y5cjKvcDzrCT+wxQwxFKHq7NbdhxfezrnNn4ZR7ZUiSQiKC 3om/MKDQ17Zh7MLPNiQ7byxDxtvwTEE= X-MC-Unique: 5sQM0hkiO1O7hIVqfdrbZQ-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 18/32] hw/i386/pc_sysfw: Simplify using memory_region_init_alias() Date: Mon, 24 Feb 2020 21:55:19 +0100 Message-Id: <20200224205533.23798-19-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] [fuzzy] X-Received-From: 207.211.31.120 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" The scripts/coccinelle/memory-region-housekeeping.cocci reported: * TODO [[view:hw/i386/pc_sysfw.c::face=3Dovl-face1::linb=3D67::colb=3D4::co= le=3D26][potential use of memory_region_init_rom*() in hw/i386/pc_sysfw.c:= :67]] pc_isa_bios_init() does a manual copy of a part of the BIOS, from a read-only region. We can simplify by directly aliasing the same part. Before: (qemu) info mtree memory-region: system 0000000000000000-ffffffffffffffff (prio 0, i/o): system 0000000000000000-0000000007ffffff (prio 0, ram): alias ram-below-4g @= pc.ram 0000000000000000-0000000007ffffff 0000000000000000-ffffffffffffffff (prio -1, i/o): pci 00000000000a0000-00000000000bffff (prio 1, i/o): vga-lowmem 00000000000c0000-00000000000dffff (prio 1, rom): pc.rom 00000000000e0000-00000000000fffff (prio 1, rom): isa-bios ... 00000000fff00000-00000000ffffffff (prio 0, romd): system.flash0 After: (qemu) info mtree memory-region: system 0000000000000000-ffffffffffffffff (prio 0, i/o): system 0000000000000000-0000000007ffffff (prio 0, ram): alias ram-below-4g @= pc.ram 0000000000000000-0000000007ffffff 0000000000000000-ffffffffffffffff (prio -1, i/o): pci 00000000000a0000-00000000000bffff (prio 1, i/o): vga-lowmem 00000000000c0000-00000000000dffff (prio 1, rom): pc.rom 00000000000e0000-00000000000fffff (prio 1, romd): alias isa-bios @s= ystem.flash0 00000000000e0000-00000000000fffff ... 00000000fff00000-00000000ffffffff (prio 0, romd): system.flash0 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc_sysfw.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index f5f3f466b0..e864c09ea8 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -54,31 +54,19 @@ static void pc_isa_bios_init(MemoryRegion *rom_memory, MemoryRegion *flash_mem, int ram_size) { - int isa_bios_size; - MemoryRegion *isa_bios; - uint64_t flash_size; - void *flash_ptr, *isa_bios_ptr; - - flash_size =3D memory_region_size(flash_mem); + uint64_t isa_bios_size; + MemoryRegion *isa_bios =3D g_new(MemoryRegion, 1); + uint64_t flash_size =3D memory_region_size(flash_mem); =20 /* map the last 128KB of the BIOS in ISA space */ isa_bios_size =3D MIN(flash_size, 128 * KiB); - isa_bios =3D g_malloc(sizeof(*isa_bios)); - memory_region_init_ram(isa_bios, NULL, "isa-bios", isa_bios_size, - &error_fatal); + memory_region_init_alias(isa_bios, NULL, "isa-bios", flash_mem, + flash_size - isa_bios_size, + isa_bios_size); memory_region_add_subregion_overlap(rom_memory, 0x100000 - isa_bios_size, isa_bios, 1); - - /* copy ISA rom image from top of flash memory */ - flash_ptr =3D memory_region_get_ram_ptr(flash_mem); - isa_bios_ptr =3D memory_region_get_ram_ptr(isa_bios); - memcpy(isa_bios_ptr, - ((uint8_t*)flash_ptr) + (flash_size - isa_bios_size), - isa_bios_size); - - memory_region_set_readonly(isa_bios, true); } =20 static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms, --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580242; cv=none; d=zohomail.com; s=zohoarc; b=WKYxVqqJq1/7NGU/9FP5vBW34n4wmgbTF65Xs/wpiIfxOHrjhe9M4hBbp4ZkUY/4JwFvODtvlaaXxCuJabCLxsPFupvJoegPQqsKnwBl4hroNBvnwphGDiq4hc0g3AWwmCII5HzaC6fobA0dBsiV5ceZKMNBBvcjBQIsRQezemc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580242; 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=EyHoT0Qb2y3urabGTzLY9V8OCntZ8ljZmUDxRnm6IFA=; b=d6XiuojjNrE8ZScESU+QAKd5WlzLMe8kfZ32CW2txE3HCllGI3JfSPAa2+VpEROkCWvT3V7uGArYYaYJR1rMjlzhJF1ksnS+UySWH6IcfkW6OT5LNdsedzjB8HL1TXUITrQfAu9wg/s4u95uAzU0GTsqQGIX37NLJ5wzMv1JUNg= 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 158258024291093.34496789586444; Mon, 24 Feb 2020 13:37:22 -0800 (PST) Received: from localhost ([::1]:44200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LPl-0001ck-Q2 for importer@patchew.org; Mon, 24 Feb 2020 16:37:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52700) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KqA-0005VW-0k for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:00:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Kq8-0006h7-Ul for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:00:33 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:31822 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6Kq8-0006gb-Qc for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:00:32 -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-137-a_m10qtTNKiPziwI6xmWdQ-1; Mon, 24 Feb 2020 16:00:30 -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 5BD60DBA6; Mon, 24 Feb 2020 21:00:26 +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 9F76F5C241; Mon, 24 Feb 2020 21:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578032; 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=EyHoT0Qb2y3urabGTzLY9V8OCntZ8ljZmUDxRnm6IFA=; b=CTKJMnNhTNZWpA982mq0hXkzIDRAvEcfIZgTOTWhK0yCKk0Pg1H+0b/x7n9OW9vbE5817w gZpZQkS6NsCPEaYrx7EugMg7LlazGVj0Z3UfvQu6XrkdbBD5RSeKaGLk1CsmwrW8NYdyoI UPWRg9xrI5QFAbMJCzEKFNIvCPPThNE= X-MC-Unique: a_m10qtTNKiPziwI6xmWdQ-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 19/32] hw/i386/pc_sysfw: Remove unused 'ram_size' argument Date: Mon, 24 Feb 2020 21:55:20 +0100 Message-Id: <20200224205533.23798-20-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] [fuzzy] X-Received-From: 207.211.31.120 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, qemu-trivial@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" While named 'ram_size', this argument holds the size of the flash. Since it is unused, remove it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- Cc: qemu-trivial@nongnu.org hw/i386/pc_sysfw.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index e864c09ea8..07b35ee9d9 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -51,8 +51,7 @@ #define FLASH_SECTOR_SIZE 4096 =20 static void pc_isa_bios_init(MemoryRegion *rom_memory, - MemoryRegion *flash_mem, - int ram_size) + MemoryRegion *flash_mem) { uint64_t isa_bios_size; MemoryRegion *isa_bios =3D g_new(MemoryRegion, 1); @@ -182,7 +181,7 @@ static void pc_system_flash_map(PCMachineState *pcms, =20 if (i =3D=3D 0) { flash_mem =3D pflash_cfi01_get_memory(system_flash); - pc_isa_bios_init(rom_memory, flash_mem, size); + pc_isa_bios_init(rom_memory, flash_mem); =20 /* Encrypt the pflash boot ROM */ if (kvm_memcrypt_enabled()) { --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580371; cv=none; d=zohomail.com; s=zohoarc; b=MgWx4kmd1Es24t8CIEUdcueWr1VXkZCYa7BkrJ2IDGrJuq2grwHALoNIsKQzl0GNBscP6zbqh2XHTH4/n/zScSdtHfsNwVnSgmn4R6vse26x7dgmO3D5OLET+F7cBqgEABhbZzR8VPLdKptp6PTISHeH3gz2JgLUAPkEBlRA1rw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580371; 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=MiaNZR/YFUXbUQr2CW30itYe2jJLit5uoKbrlDDb9zo=; b=PwEnEG0J3PziqNMGBgviGmFpXlrJ/d4yd0bN0eeEr2GoUB/IBUHIaJx+XWXiYRa6JNhIsunKjqRzoaP1H0OThUP0efc8YuodEJht2Te2cy0qoqII80EysA4jeUq/Jd6CpkoKHA0y92MhbWDOA5t27okqN2qUA0qsysC4k+m6QxA= 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 1582580371703819.466185648468; Mon, 24 Feb 2020 13:39:31 -0800 (PST) Received: from localhost ([::1]:44242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LRq-0005Ia-Lx for importer@patchew.org; Mon, 24 Feb 2020 16:39:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52814) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KqJ-0005sL-Py for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:00:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KqI-0006oX-OM for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:00:43 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:29595 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6KqI-0006nz-JH for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:00:42 -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-316-Rmd8_EK5OM2HmLO6EDe3Rw-1; Mon, 24 Feb 2020 16:00:40 -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 01584801E6C; Mon, 24 Feb 2020 21:00:36 +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 D09C25C883; Mon, 24 Feb 2020 21:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578042; 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=MiaNZR/YFUXbUQr2CW30itYe2jJLit5uoKbrlDDb9zo=; b=bTy5V6vw3UbHZIJxp+OG2TpLDNf0RizhStPVbBSZymFhJ13y0CfEbCdj1Dcc8vJpMw8NR2 NsGwTHpSXS8Ck+tLCD9Sk/Q3M94fREfe0x6VaACImiZdQPUC/6Zjrjpl0nBR5VTy95pWQm N9kTIIXZ7ZyKcCVvUBQ/CMHfSPmaiaw= X-MC-Unique: Rmd8_EK5OM2HmLO6EDe3Rw-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 20/32] scripts/cocci: Patch to remove unnecessary memory_region_set_readonly() Date: Mon, 24 Feb 2020 21:55:21 +0100 Message-Id: <20200224205533.23798-21-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.120 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" Add a semantic patch to remove memory_region_set_readonly() calls on ROM memory regions. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- .../coccinelle/memory-region-housekeeping.cocci | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/coccinelle/memory-region-housekeeping.cocci b/scripts/= coccinelle/memory-region-housekeeping.cocci index 9cdde71bb1..5e6b31d8ba 100644 --- a/scripts/coccinelle/memory-region-housekeeping.cocci +++ b/scripts/coccinelle/memory-region-housekeeping.cocci @@ -48,6 +48,21 @@ p << possible_memory_region_init_rom.p; cocci.print_main("potential use of memory_region_init_rom*() in ", p) =20 =20 +// Do not call memory_region_set_readonly() on ROM alias +@@ +expression ROM, E1, E2, E3, E4; +expression ALIAS, E5, E6, E7, E8; +@@ +( + memory_region_init_rom(ROM, E1, E2, E3, E4); +| + memory_region_init_rom_nomigrate(ROM, E1, E2, E3, E4); +) + ... + memory_region_init_alias(ALIAS, E5, E6, ROM, E7, E8); +- memory_region_set_readonly(ALIAS, true); + + // Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram // code sequences with use of the new memory_region_init_ram function. // Similarly for the _rom and _rom_device functions. --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580470; cv=none; d=zohomail.com; s=zohoarc; b=I6rdVsX3donttp0StGtWvCQoG+AttUF7WBOKDVdM/jaFm6t83mjvRI5qWZT5BC+kWASkU9zPUm/gCAR3UXeQSZQT497fYRTRQ8k7uNjMnzTl2Dfmj+zCxEQHQTXC6/ChqxkvCcIky4ACIw3g8SvycSCjzofsowFjnN8ki3VgtiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580470; 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=AR3d9nNMRFmjviCA9QeiC7WRyBhxuQ8IV0t5Cc30NxA=; b=kbh887h8rzH4tb1cXZn4eZu26jGInaFh84T1v3Ezg/kt6YIdM4hDPyOmklUH4pBQ3MwXMlDeEc+nl6f7j9FLlu9QOPx1isnC6avOVcHkZ6XZU9c1yrWZYRDjXK1Ac2wtVFqeQoPfM+YjP6e9VdGWksu0Q+RrS+pRPjZWYZquR+s= 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 1582580470217254.7696475146089; Mon, 24 Feb 2020 13:41:10 -0800 (PST) Received: from localhost ([::1]:44300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LTR-0008F0-0M for importer@patchew.org; Mon, 24 Feb 2020 16:41:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52918) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Kqa-0006Q0-5m for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KqZ-0006xB-2j for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:00 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:33991 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6KqY-0006wh-VH for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:00: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-446-s20lJErAMzO7qprPBkpHUQ-1; Mon, 24 Feb 2020 16:00:54 -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 E2F93107ACC4; Mon, 24 Feb 2020 21:00:50 +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 7400B5C54A; Mon, 24 Feb 2020 21:00:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578058; 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=AR3d9nNMRFmjviCA9QeiC7WRyBhxuQ8IV0t5Cc30NxA=; b=Tw/ez23+anWkQ6DnSNH2oldW8g49glc6w5660oaug/+acnCtDig+6ncZPiSUq9S8EV4AR/ yupTTi4hlmKcp9Uwyqjvfkpggv0EmAwjLxq1lx1qe8Xhb2coNhug7X8tcyBOZ3vCuRgMu8 Zu+Lk/iMb3eRnvrD5ffi+57YEi93yHQ= X-MC-Unique: s20lJErAMzO7qprPBkpHUQ-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 21/32] hw/arm: Remove unnecessary memory_region_set_readonly() on ROM alias Date: Mon, 24 Feb 2020 21:55:22 +0100 Message-Id: <20200224205533.23798-22-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.120 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" This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/exynos4210.c | 1 - hw/arm/stm32f205_soc.c | 1 - hw/arm/stm32f405_soc.c | 1 - 3 files changed, 3 deletions(-) diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 3af6502a5e..4e1fd7edb3 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -320,7 +320,6 @@ static void exynos4210_realize(DeviceState *socdev, Err= or **errp) &s->irom_mem, 0, EXYNOS4210_IROM_SIZE); - memory_region_set_readonly(&s->irom_alias_mem, true); memory_region_add_subregion(system_mem, EXYNOS4210_IROM_MIRROR_BASE_AD= DR, &s->irom_alias_mem); =20 diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c index 2de56275b7..6e93726d45 100644 --- a/hw/arm/stm32f205_soc.c +++ b/hw/arm/stm32f205_soc.c @@ -97,7 +97,6 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, E= rror **errp) &error_fatal); memory_region_init_alias(flash_alias, NULL, "STM32F205.flash.alias", flash, 0, FLASH_SIZE); - memory_region_set_readonly(flash_alias, true); =20 memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash); memory_region_add_subregion(system_memory, 0, flash_alias); diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c index b8fca13f95..d590cd040d 100644 --- a/hw/arm/stm32f405_soc.c +++ b/hw/arm/stm32f405_soc.c @@ -103,7 +103,6 @@ static void stm32f405_soc_realize(DeviceState *dev_soc,= Error **errp) } memory_region_init_alias(&s->flash_alias, NULL, "STM32F405.flash.alias= ", &s->flash, 0, FLASH_SIZE); - memory_region_set_readonly(&s->flash_alias, true); =20 memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, &s->fla= sh); memory_region_add_subregion(system_memory, 0, &s->flash_alias); --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580562; cv=none; d=zohomail.com; s=zohoarc; b=DQt8T2BAx4FxjqI8A5VbovCzpnOAAmghVHUWdnJB0TBWGFLOD+AxUAz27dhXjR3TUS4NWaHPM6m+G1T0xs5+hj1wc0BrpDyE39E1QQU1MQk3nLRHXfR+8rNP5JoIBkpAtdgOjFyydv6m/h6Q/+u6D1zqgaRGpwJC9DFjRDJfVEc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580562; 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=rmrQdlXnA/jIW2pFbe6JSKjkAJeY5OyoEuZkOnpt8X8=; b=LYM2YpcxDqiYuhml9s17I+mqAHtbl9jPGJwcWPsTp0rUj4S7YspO2AesAm2Qyy6xO9T+yoFNye6syHh28mRllfb8O9iOk+0gmPqUD+6twzh6EiCidxep2XgRxIRvIRGXAmF/HtH8U4P/9Ro18aylujvcqHzYvani4VCWkc0sYBg= 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 1582580562520993.8137395541268; Mon, 24 Feb 2020 13:42:42 -0800 (PST) Received: from localhost ([::1]:44336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LUu-0002Vf-Qi for importer@patchew.org; Mon, 24 Feb 2020 16:42:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52986) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Kqk-0006Xm-KC for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Kqi-00072Q-Pu for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:10 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:25959 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6Kqi-000715-EF for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:08 -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-68-IQ06hTSpOlaokjmfvr9NAA-1; Mon, 24 Feb 2020 16:01:04 -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 CFA458010F0; Mon, 24 Feb 2020 21:01:00 +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 595675C651; Mon, 24 Feb 2020 21:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578066; 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=rmrQdlXnA/jIW2pFbe6JSKjkAJeY5OyoEuZkOnpt8X8=; b=BRH70wyoK4VLBI1cLFv5KTSI9QrMKRE6Q+afir6qf5OZPAcB5x94EWN8h7t0vnnOHXlz/x bQv6+XPN2Rai7A6SHRRP6AD2GfG12GDmm8IefPp/whRc9YQiqVy9hJqS42Ll+d23HaI3eS W6WPbqPzKX036g5WbEnGqSXQ9bEj8oQ= X-MC-Unique: IQ06hTSpOlaokjmfvr9NAA-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 22/32] scripts/cocci: Patch to let devices own their MemoryRegions Date: Mon, 24 Feb 2020 21:55:23 +0100 Message-Id: <20200224205533.23798-23-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.120 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" When a device creates a MemoryRegion without setting its ownership, the MemoryRegion is added to the machine "/unattached" container in the QOM tree. Example with the Samsung SMDKC210 board: $ arm-softmmu/qemu-system-arm -M smdkc210 -S -monitor stdio (qemu) info qom-tree /machine (smdkc210-machine) /unattached (container) /io[0] (qemu:memory-region) /exynos4210.dram0[0] (qemu:memory-region) /exynos4210.irom[0] (qemu:memory-region) /exynos4210.iram[0] (qemu:memory-region) /exynos4210.chipid[0] (qemu:memory-region) ... /device[26] (exynos4210.uart) /exynos4210.uart[0] (qemu:memory-region) /soc (exynos4210) ^ \__ [*] The irom/iram/chipid regions should go under 'soc' at [*]. Add a semantic patch to let the device own the memory region. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- v2: Remove memory_region_init_ram() change which might break migration (Peter Maydell) --- .../memory-region-housekeeping.cocci | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/scripts/coccinelle/memory-region-housekeeping.cocci b/scripts/= coccinelle/memory-region-housekeeping.cocci index 5e6b31d8ba..c768d8140a 100644 --- a/scripts/coccinelle/memory-region-housekeeping.cocci +++ b/scripts/coccinelle/memory-region-housekeeping.cocci @@ -101,3 +101,59 @@ expression ERRP; +memory_region_init_rom_device(MR, NULL, OPS, OPAQUE, NAME, SIZE, ERRP); ... -vmstate_register_ram_global(MR); + + +// Device is owner +@@ +typedef DeviceState; +identifier device_fn, dev, obj; +expression E1, E2, E3, E4, E5; +@@ +static void device_fn(DeviceState *dev, ...) +{ + ... + Object *obj =3D OBJECT(dev); + <+... +( +- memory_region_init(E1, NULL, E2, E3); ++ memory_region_init(E1, obj, E2, E3); +| +- memory_region_init_io(E1, NULL, E2, E3, E4, E5); ++ memory_region_init_io(E1, obj, E2, E3, E4, E5); +| +- memory_region_init_alias(E1, NULL, E2, E3, E4, E5); ++ memory_region_init_alias(E1, obj, E2, E3, E4, E5); +| +- memory_region_init_rom(E1, NULL, E2, E3, E4); ++ memory_region_init_rom(E1, obj, E2, E3, E4); +| +- memory_region_init_ram_shared_nomigrate(E1, NULL, E2, E3, E4, E5); ++ memory_region_init_ram_shared_nomigrate(E1, obj, E2, E3, E4, E5); +) + ...+> +} +@@ +identifier device_fn, dev; +expression E1, E2, E3, E4, E5; +@@ +static void device_fn(DeviceState *dev, ...) +{ + <+... +( +- memory_region_init(E1, NULL, E2, E3); ++ memory_region_init(E1, OBJECT(dev), E2, E3); +| +- memory_region_init_io(E1, NULL, E2, E3, E4, E5); ++ memory_region_init_io(E1, OBJECT(dev), E2, E3, E4, E5); +| +- memory_region_init_alias(E1, NULL, E2, E3, E4, E5); ++ memory_region_init_alias(E1, OBJECT(dev), E2, E3, E4, E5); +| +- memory_region_init_rom(E1, NULL, E2, E3, E4); ++ memory_region_init_rom(E1, OBJECT(dev), E2, E3, E4); +| +- memory_region_init_ram_shared_nomigrate(E1, NULL, E2, E3, E4, E5); ++ memory_region_init_ram_shared_nomigrate(E1, OBJECT(dev), E2, E3, E4, E5); +) + ...+> +} --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580697; cv=none; d=zohomail.com; s=zohoarc; b=FqZ3YtQDaTsMaJh+uRIcWWAZ4hxLSFVrxg0BwD4ATDfEi/0I8c4hzVnckmt56Onxitn6henWFmbwY5lEkLqpoHFi556MLc30N+ayWArqkPIH9Q+alQ1ptCvcsSBZsxEJFkoHZbAP+H84izGunG3DNvuJ49njwpMNy3jqrL8aBZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580697; 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=bKmzrDzCP3CHZZoaY+XwEe6zXXagucHV9nyh6xOHbq4=; b=TP/b1sIhENw6w7obOj3XlHj63nx+xvoW3hExpAn1ydnnrRssU36UozJkQvZ/BFuT9e6AeoOx/ou+10Y97/+YRkX0DozlKOkspF2UyPtnN39eRUoUOX6w4+K9ABDwFyOpkB8Rg1ZViWUealQZpYJBbMVTdmy2CuoBh4/TAjhi2kA= 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 158258069781533.15078960269352; Mon, 24 Feb 2020 13:44:57 -0800 (PST) Received: from localhost ([::1]:44404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LX6-0006I9-G6 for importer@patchew.org; Mon, 24 Feb 2020 16:44:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53107) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Kr3-0006fw-3l for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Kr1-0007CS-1L for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:29 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:54048 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6Kqw-0007Af-If for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:26 -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-493-u_6tkaW2MGeUpA4NqY-6Qg-1; Mon, 24 Feb 2020 16:01:20 -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 30EE98017CC; Mon, 24 Feb 2020 21:01:16 +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 571AC5C21B; Mon, 24 Feb 2020 21:01:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578082; 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=bKmzrDzCP3CHZZoaY+XwEe6zXXagucHV9nyh6xOHbq4=; b=IDLPUefObRGMRPw7y0pnJmA7QQBTREWMvjpAtpkaGJQWmSUPH9BOSknqDRF+xfAbALWjJg ZwBs6xZcqyuygHtVaXIGW1/ak1yUUZtapcm9f8s4rW7PHDOnz6GGtcklMTe2s7Q7RdDMTE Rpi8+TEQfXniHG5R9hSQ0xe95YJm4mI= X-MC-Unique: u_6tkaW2MGeUpA4NqY-6Qg-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 23/32] hw/arm: Let devices own the MemoryRegion they create Date: Mon, 24 Feb 2020 21:55:24 +0100 Message-Id: <20200224205533.23798-24-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] [fuzzy] X-Received-From: 207.211.31.120 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/arm/exynos4210.c | 12 ++++++------ hw/arm/fsl-imx25.c | 10 +++++----- hw/arm/fsl-imx31.c | 6 +++--- hw/arm/fsl-imx6.c | 6 +++--- hw/arm/fsl-imx6ul.c | 9 +++++---- hw/arm/msf2-soc.c | 6 +++--- hw/arm/nrf51_soc.c | 2 +- hw/arm/stm32f205_soc.c | 8 ++++---- hw/arm/stm32f405_soc.c | 9 +++++---- hw/arm/xlnx-zynqmp.c | 11 +++++------ 10 files changed, 40 insertions(+), 39 deletions(-) diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 4e1fd7edb3..1f7253ef6f 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -305,20 +305,20 @@ static void exynos4210_realize(DeviceState *socdev, E= rror **errp) /*** Memory ***/ =20 /* Chip-ID and OMR */ - memory_region_init_io(&s->chipid_mem, NULL, &exynos4210_chipid_and_omr= _ops, - NULL, "exynos4210.chipid", sizeof(chipid_and_omr)); + memory_region_init_io(&s->chipid_mem, OBJECT(socdev), + &exynos4210_chipid_and_omr_ops, NULL, + "exynos4210.chipid", sizeof(chipid_and_omr)); memory_region_add_subregion(system_mem, EXYNOS4210_CHIPID_ADDR, &s->chipid_mem); =20 /* Internal ROM */ - memory_region_init_rom(&s->irom_mem, NULL, "exynos4210.irom", + memory_region_init_rom(&s->irom_mem, OBJECT(socdev), "exynos4210.irom", EXYNOS4210_IROM_SIZE, &error_fatal); memory_region_add_subregion(system_mem, EXYNOS4210_IROM_BASE_ADDR, &s->irom_mem); /* mirror of iROM */ - memory_region_init_alias(&s->irom_alias_mem, NULL, "exynos4210.irom_al= ias", - &s->irom_mem, - 0, + memory_region_init_alias(&s->irom_alias_mem, OBJECT(socdev), + "exynos4210.irom_alias", &s->irom_mem, 0, EXYNOS4210_IROM_SIZE); memory_region_add_subregion(system_mem, EXYNOS4210_IROM_MIRROR_BASE_AD= DR, &s->irom_alias_mem); diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c index da3471b395..104bff6d61 100644 --- a/hw/arm/fsl-imx25.c +++ b/hw/arm/fsl-imx25.c @@ -247,16 +247,16 @@ static void fsl_imx25_realize(DeviceState *dev, Error= **errp) } =20 /* initialize 2 x 16 KB ROM */ - memory_region_init_rom(&s->rom[0], NULL, - "imx25.rom0", FSL_IMX25_ROM0_SIZE, &err); + memory_region_init_rom(&s->rom[0], OBJECT(dev), "imx25.rom0", + FSL_IMX25_ROM0_SIZE, &err); if (err) { error_propagate(errp, err); return; } memory_region_add_subregion(get_system_memory(), FSL_IMX25_ROM0_ADDR, &s->rom[0]); - memory_region_init_rom(&s->rom[1], NULL, - "imx25.rom1", FSL_IMX25_ROM1_SIZE, &err); + memory_region_init_rom(&s->rom[1], OBJECT(dev), "imx25.rom1", + FSL_IMX25_ROM1_SIZE, &err); if (err) { error_propagate(errp, err); return; @@ -275,7 +275,7 @@ static void fsl_imx25_realize(DeviceState *dev, Error *= *errp) &s->iram); =20 /* internal RAM (128 KB) is aliased over 128 MB - 128 KB */ - memory_region_init_alias(&s->iram_alias, NULL, "imx25.iram_alias", + memory_region_init_alias(&s->iram_alias, OBJECT(dev), "imx25.iram_alia= s", &s->iram, 0, FSL_IMX25_IRAM_ALIAS_SIZE); memory_region_add_subregion(get_system_memory(), FSL_IMX25_IRAM_ALIAS_= ADDR, &s->iram_alias); diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c index 55e90d104b..8472d2e911 100644 --- a/hw/arm/fsl-imx31.c +++ b/hw/arm/fsl-imx31.c @@ -206,7 +206,7 @@ static void fsl_imx31_realize(DeviceState *dev, Error *= *errp) } =20 /* On a real system, the first 16k is a `secure boot rom' */ - memory_region_init_rom(&s->secure_rom, NULL, "imx31.secure_rom", + memory_region_init_rom(&s->secure_rom, OBJECT(dev), "imx31.secure_rom", FSL_IMX31_SECURE_ROM_SIZE, &err); if (err) { error_propagate(errp, err); @@ -216,7 +216,7 @@ static void fsl_imx31_realize(DeviceState *dev, Error *= *errp) &s->secure_rom); =20 /* There is also a 16k ROM */ - memory_region_init_rom(&s->rom, NULL, "imx31.rom", + memory_region_init_rom(&s->rom, OBJECT(dev), "imx31.rom", FSL_IMX31_ROM_SIZE, &err); if (err) { error_propagate(errp, err); @@ -236,7 +236,7 @@ static void fsl_imx31_realize(DeviceState *dev, Error *= *errp) &s->iram); =20 /* internal RAM (16 KB) is aliased over 256 MB - 16 KB */ - memory_region_init_alias(&s->iram_alias, NULL, "imx31.iram_alias", + memory_region_init_alias(&s->iram_alias, OBJECT(dev), "imx31.iram_alia= s", &s->iram, 0, FSL_IMX31_IRAM_ALIAS_SIZE); memory_region_add_subregion(get_system_memory(), FSL_IMX31_IRAM_ALIAS_= ADDR, &s->iram_alias); diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index ecc62855f2..9c09f71435 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -405,7 +405,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **= errp) } =20 /* ROM memory */ - memory_region_init_rom(&s->rom, NULL, "imx6.rom", + memory_region_init_rom(&s->rom, OBJECT(dev), "imx6.rom", FSL_IMX6_ROM_SIZE, &err); if (err) { error_propagate(errp, err); @@ -415,7 +415,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **= errp) &s->rom); =20 /* CAAM memory */ - memory_region_init_rom(&s->caam, NULL, "imx6.caam", + memory_region_init_rom(&s->caam, OBJECT(dev), "imx6.caam", FSL_IMX6_CAAM_MEM_SIZE, &err); if (err) { error_propagate(errp, err); @@ -435,7 +435,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **= errp) &s->ocram); =20 /* internal OCRAM (256 KB) is aliased over 1 MB */ - memory_region_init_alias(&s->ocram_alias, NULL, "imx6.ocram_alias", + memory_region_init_alias(&s->ocram_alias, OBJECT(dev), "imx6.ocram_ali= as", &s->ocram, 0, FSL_IMX6_OCRAM_ALIAS_SIZE); memory_region_add_subregion(get_system_memory(), FSL_IMX6_OCRAM_ALIAS_= ADDR, &s->ocram_alias); diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c index c405b68d1d..f4a9ed6c4f 100644 --- a/hw/arm/fsl-imx6ul.c +++ b/hw/arm/fsl-imx6ul.c @@ -543,7 +543,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error = **errp) /* * ROM memory */ - memory_region_init_rom(&s->rom, NULL, "imx6ul.rom", + memory_region_init_rom(&s->rom, OBJECT(dev), "imx6ul.rom", FSL_IMX6UL_ROM_SIZE, &error_abort); memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_ROM_ADDR, &s->rom); @@ -551,7 +551,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error = **errp) /* * CAAM memory */ - memory_region_init_rom(&s->caam, NULL, "imx6ul.caam", + memory_region_init_rom(&s->caam, OBJECT(dev), "imx6ul.caam", FSL_IMX6UL_CAAM_MEM_SIZE, &error_abort); memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_CAAM_MEM_A= DDR, &s->caam); @@ -568,8 +568,9 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error = **errp) /* * internal OCRAM (128 KB) is aliased over 512 KB */ - memory_region_init_alias(&s->ocram_alias, NULL, "imx6ul.ocram_alias", - &s->ocram, 0, FSL_IMX6UL_OCRAM_ALIAS_SIZE); + memory_region_init_alias(&s->ocram_alias, OBJECT(dev), + "imx6ul.ocram_alias", &s->ocram, 0, + FSL_IMX6UL_OCRAM_ALIAS_SIZE); memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_OCRAM_ALIAS_ADDR, &s->ocram_ali= as); } diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c index 8f84692e64..588d643b8d 100644 --- a/hw/arm/msf2-soc.c +++ b/hw/arm/msf2-soc.c @@ -96,7 +96,7 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Erro= r **errp) MemoryRegion *nvm_alias =3D g_new(MemoryRegion, 1); MemoryRegion *sram =3D g_new(MemoryRegion, 1); =20 - memory_region_init_rom(nvm, NULL, "MSF2.eNVM", s->envm_size, + memory_region_init_rom(nvm, OBJECT(dev_soc), "MSF2.eNVM", s->envm_size, &error_fatal); /* * On power-on, the eNVM region 0x60000000 is automatically @@ -104,8 +104,8 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Er= ror **errp) * start address (0x0). We do not support remapping other eNVM, * eSRAM and DDR regions by guest(via Sysreg) currently. */ - memory_region_init_alias(nvm_alias, NULL, "MSF2.eNVM", - nvm, 0, s->envm_size); + memory_region_init_alias(nvm_alias, OBJECT(dev_soc), "MSF2.eNVM", nvm,= 0, + s->envm_size); =20 memory_region_add_subregion(system_memory, ENVM_BASE_ADDRESS, nvm); memory_region_add_subregion(system_memory, 0, nvm_alias); diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c index 4817a76ae0..57eff63f0d 100644 --- a/hw/arm/nrf51_soc.c +++ b/hw/arm/nrf51_soc.c @@ -165,7 +165,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Err= or **errp) } =20 /* STUB Peripherals */ - memory_region_init_io(&s->clock, NULL, &clock_ops, NULL, + memory_region_init_io(&s->clock, OBJECT(dev_soc), &clock_ops, NULL, "nrf51_soc.clock", 0x1000); memory_region_add_subregion_overlap(&s->container, NRF51_IOMEM_BASE, &s->clock, -1); diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c index 6e93726d45..118c342559 100644 --- a/hw/arm/stm32f205_soc.c +++ b/hw/arm/stm32f205_soc.c @@ -93,10 +93,10 @@ static void stm32f205_soc_realize(DeviceState *dev_soc,= Error **errp) MemoryRegion *flash =3D g_new(MemoryRegion, 1); MemoryRegion *flash_alias =3D g_new(MemoryRegion, 1); =20 - memory_region_init_rom(flash, NULL, "STM32F205.flash", FLASH_SIZE, - &error_fatal); - memory_region_init_alias(flash_alias, NULL, "STM32F205.flash.alias", - flash, 0, FLASH_SIZE); + memory_region_init_rom(flash, OBJECT(dev_soc), "STM32F205.flash", + FLASH_SIZE, &error_fatal); + memory_region_init_alias(flash_alias, OBJECT(dev_soc), + "STM32F205.flash.alias", flash, 0, FLASH_SIZE= ); =20 memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash); memory_region_add_subregion(system_memory, 0, flash_alias); diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c index d590cd040d..4f10ce6176 100644 --- a/hw/arm/stm32f405_soc.c +++ b/hw/arm/stm32f405_soc.c @@ -95,14 +95,15 @@ static void stm32f405_soc_realize(DeviceState *dev_soc,= Error **errp) Error *err =3D NULL; int i; =20 - memory_region_init_rom(&s->flash, NULL, "STM32F405.flash", FLASH_SIZE, - &err); + memory_region_init_rom(&s->flash, OBJECT(dev_soc), "STM32F405.flash", + FLASH_SIZE, &err); if (err !=3D NULL) { error_propagate(errp, err); return; } - memory_region_init_alias(&s->flash_alias, NULL, "STM32F405.flash.alias= ", - &s->flash, 0, FLASH_SIZE); + memory_region_init_alias(&s->flash_alias, OBJECT(dev_soc), + "STM32F405.flash.alias", &s->flash, 0, + FLASH_SIZE); =20 memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, &s->fla= sh); memory_region_add_subregion(system_memory, 0, &s->flash_alias); diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index cab0160ae9..49f1c8d0de 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -318,9 +318,9 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error= **errp) ddr_low_size =3D XLNX_ZYNQMP_MAX_LOW_RAM_SIZE; ddr_high_size =3D ram_size - XLNX_ZYNQMP_MAX_LOW_RAM_SIZE; =20 - memory_region_init_alias(&s->ddr_ram_high, NULL, - "ddr-ram-high", s->ddr_ram, - ddr_low_size, ddr_high_size); + memory_region_init_alias(&s->ddr_ram_high, OBJECT(dev), + "ddr-ram-high", s->ddr_ram, ddr_low_size, + ddr_high_size); memory_region_add_subregion(get_system_memory(), XLNX_ZYNQMP_HIGH_RAM_START, &s->ddr_ram_high); @@ -330,9 +330,8 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error= **errp) ddr_low_size =3D ram_size; } =20 - memory_region_init_alias(&s->ddr_ram_low, NULL, - "ddr-ram-low", s->ddr_ram, - 0, ddr_low_size); + memory_region_init_alias(&s->ddr_ram_low, OBJECT(dev), "ddr-ram-low", + s->ddr_ram, 0, ddr_low_size); memory_region_add_subregion(get_system_memory(), 0, &s->ddr_ram_low); =20 /* Create the four OCM banks */ --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580814; cv=none; d=zohomail.com; s=zohoarc; b=bS10Hb9JGXi1srtS8fPXeP0cGfPBWi59Ad1z2Y7dnFcJvjjY/xjcgyTGzJ8dt7aKolqdIHzQlYX0t2juLPQTumM9oSAKol8p1XsV3MqZNQfpn1IQs0Y1LxHlNkMbYbhx538gS2T7J41V2D5yCAIl8EXbEzNhBHR3rhY2YexxoDw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580814; 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=7saW0lUMlIpBkC9nkeABH78vi2gIhiCg17Oi76zLWlE=; b=Awi+9dVwvBDbdLXJCD+Y6l8yZPCkWQoot0nQnjtfkoMwWor3tVsU14jRpYW7DS6zjDMort8JUVFmoWsDgIvmyLrCIJS29DVxXXGlfak0pAsOXglVRXerAzoIgt3/NrZaT5Y4+oJzYttsnFFJtM2bmEZ8WTTLXTpHzLxPsozYn6Y= 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 1582580814804815.7498887311244; Mon, 24 Feb 2020 13:46:54 -0800 (PST) Received: from localhost ([::1]:44468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LYz-0000hH-Cf for importer@patchew.org; Mon, 24 Feb 2020 16:46:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53168) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Kr7-0006jd-J1 for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Kr6-0007Go-Jb for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:33 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:47936 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6Kr6-0007GF-FM for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:32 -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-289-M1AD5Pb4OvK-RNGG5JgPPg-1; Mon, 24 Feb 2020 16:01:30 -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 E06CADBA5; Mon, 24 Feb 2020 21:01:25 +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 A5E225C651; Mon, 24 Feb 2020 21:01:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578092; 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=7saW0lUMlIpBkC9nkeABH78vi2gIhiCg17Oi76zLWlE=; b=ZZqxv46VMKdcpEyXTx0t4+ifjeyWSgqo37NUapuPVJbeeY/85YUUQ0kM80im+oDkEPDX/p cSDOuLZrAGXVsevO2xrO25LSJX+9FFPL4Qs7pGwDgsff2YaHIEaAwy06fBFbGxZQZ/jyTG BO2VgHCsahuuN4QI1B5PqwkTXsp91eQ= X-MC-Unique: M1AD5Pb4OvK-RNGG5JgPPg-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 24/32] hw/char: Let devices own the MemoryRegion they create Date: Mon, 24 Feb 2020 21:55:25 +0100 Message-Id: <20200224205533.23798-25-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] [fuzzy] X-Received-From: 207.211.31.120 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/char/serial.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index 9298881af9..2ab8b69e03 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -997,7 +997,7 @@ static void serial_io_realize(DeviceState *dev, Error *= *errp) return; } =20 - memory_region_init_io(&s->io, NULL, &serial_io_ops, s, "serial", 8); + memory_region_init_io(&s->io, OBJECT(dev), &serial_io_ops, s, "serial"= , 8); sysbus_init_mmio(SYS_BUS_DEVICE(sio), &s->io); sysbus_init_irq(SYS_BUS_DEVICE(sio), &s->irq); } @@ -1106,8 +1106,9 @@ static void serial_mm_realize(DeviceState *dev, Error= **errp) return; } =20 - memory_region_init_io(&s->io, NULL, &serial_mm_ops[smm->endianness], s= mm, - "serial", 8 << smm->regshift); + memory_region_init_io(&s->io, OBJECT(dev), + &serial_mm_ops[smm->endianness], smm, "serial", + 8 << smm->regshift); sysbus_init_mmio(SYS_BUS_DEVICE(smm), &s->io); sysbus_init_irq(SYS_BUS_DEVICE(smm), &smm->serial.irq); } --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580846; cv=none; d=zohomail.com; s=zohoarc; b=jPgAmIcrg7YyGaRS1s2xgCByci7gnU4qKmnX5Q8oFr4ZJvlLJULyTn5GjwhR1P5IvnSh3kL4Eq8Rt3fhIWK/yo9KH1GeVLfsM2M7baGBVVJ97cKyGYN7i3fRJJPQuOVdcReD079WZYG+UtiNTzIIskoIsDH53cjdyvMCKNV8eZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580846; 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=d82MUeKk+/4B02rjdl6yI9CuL1FxqpOnif29vr+0CBA=; b=fNLQil4H1/HYLPh16Xmc6DFeq6j8yhhFcLOdBQHFbzDLTcpv8Z3rMXtTOZsNt0IYBPQQmCL5bD8NFDd48vAN587LpHDUt1x4AaojVuG7v66seJWz6LHheyyMWWQogJ7tjlMAy3T+9EoxIpzhwaNPNNyMOiZ38PHiCXfXBso3RcA= 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 1582580846649109.3970246076201; Mon, 24 Feb 2020 13:47:26 -0800 (PST) Received: from localhost ([::1]:44478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LZV-0001V2-HF for importer@patchew.org; Mon, 24 Feb 2020 16:47:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53259) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KrO-0006zi-1q for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KrM-0007Xb-Re for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:49 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:24431 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6KrM-0007W3-Hf for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:01:48 -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-243-B2jLMgkmPbOAS-FuawXTqw-1; Mon, 24 Feb 2020 16:01:45 -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 09EEB1005512; Mon, 24 Feb 2020 21:01:41 +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 588485C54A; Mon, 24 Feb 2020 21:01:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578108; 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=d82MUeKk+/4B02rjdl6yI9CuL1FxqpOnif29vr+0CBA=; b=XCWLZKaaeOk/lAcvUL2fZQSXiRaMHsKj4eG2GR2WAdb5N4+YocVZFkya8NbIDuepZX1RlR 3faClZixKRIWybCvl3u5kku6CYfdAvjvpRtHMfT3me+p95qOsPKMIC94fuD8/dE6I6E1xP Q0oaluHA9Ou86BgKhIXWtBOwdbi//Bg= X-MC-Unique: B2jLMgkmPbOAS-FuawXTqw-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 25/32] hw/core: Let devices own the MemoryRegion they create Date: Mon, 24 Feb 2020 21:55:26 +0100 Message-Id: <20200224205533.23798-26-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] [fuzzy] X-Received-From: 207.211.31.120 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/core/platform-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/core/platform-bus.c b/hw/core/platform-bus.c index 22c5f76dd0..d494e5cec1 100644 --- a/hw/core/platform-bus.c +++ b/hw/core/platform-bus.c @@ -187,7 +187,8 @@ static void platform_bus_realize(DeviceState *dev, Erro= r **errp) d =3D SYS_BUS_DEVICE(dev); pbus =3D PLATFORM_BUS_DEVICE(dev); =20 - memory_region_init(&pbus->mmio, NULL, "platform bus", pbus->mmio_size); + memory_region_init(&pbus->mmio, OBJECT(dev), "platform bus", + pbus->mmio_size); sysbus_init_mmio(d, &pbus->mmio); =20 pbus->used_irqs =3D bitmap_new(pbus->num_irqs); --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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 From nobody Thu Nov 13 19:20:31 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=1582580897; cv=none; d=zohomail.com; s=zohoarc; b=j4hOmSneaKEW4ydEMk471CtOyW9yPWzF68MW596E4RLUi3EOk/D3EJ310lInqeDeCJMuaBLgSqE4EWhjF3KUFt90WaiaKGHHabdECoKGyoY0zEoW2eHqe3kAy7ttCDtc9ShZcKsCL8c3jhr3wG7X/zun+ohToopLsMPOcB7wFm0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580897; 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=fz4RL4GQNxQ7AL6EJheq8m8lRXs+9KDO1fv0pwDQ6ZM=; b=eQNaZxyP8lULyQBxL3PLapV5B0LNLDL1oaSxI8Wfw98O0QMTZLB4CBMZ7lmxkeEJESznDWHaHWNUt9Kss28pHlIC8QdD49V94RY9i6cu+UM85Z9qLERL1jAGQXMWzEIn6JIZ25k2zPaPwYlMIJioHzGIJXDfABZLPZLKIXz86gY= 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 1582580897051814.1895180814377; Mon, 24 Feb 2020 13:48:17 -0800 (PST) Received: from localhost ([::1]:44494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LaJ-0002eH-Vs for importer@patchew.org; Mon, 24 Feb 2020 16:48:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53455) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Krp-0007kI-I8 for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:02:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Kro-0007tE-DQ for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:02:17 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:41053 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 1j6Kro-0007sp-7J for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:02:16 -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-423-kuzCGZ-OP76fTPXm_0eVkA-1; Mon, 24 Feb 2020 16:02:10 -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 E8306800EB4; Mon, 24 Feb 2020 21:02:05 +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 80E5E5C6DC; Mon, 24 Feb 2020 21:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578135; 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=fz4RL4GQNxQ7AL6EJheq8m8lRXs+9KDO1fv0pwDQ6ZM=; b=J5wnbVYHyY6jERH5K0N9I7KVk06nA+EbLw1UeLkbIvi6weUbDqtzd0gig7T8UyuFilNoat n+Y2vfe4MR2CmkelAM5BWV1aYFnZLI8vomCgrqfh8C9o4werchyyFpq4xtaKUZ4zFMicD1 Tc8PW0I85mhE6BbZrR6BbFZXXg4fH7Y= X-MC-Unique: kuzCGZ-OP76fTPXm_0eVkA-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 27/32] hw/dma: Let devices own the MemoryRegion they create Date: Mon, 24 Feb 2020 21:55:28 +0100 Message-Id: <20200224205533.23798-28-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] [fuzzy] X-Received-From: 207.211.31.81 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/dma/i8257.c | 2 +- hw/dma/rc4030.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c index bad8debae4..ef15c06d77 100644 --- a/hw/dma/i8257.c +++ b/hw/dma/i8257.c @@ -553,7 +553,7 @@ static void i8257_realize(DeviceState *dev, Error **err= p) I8257State *d =3D I8257(dev); int i; =20 - memory_region_init_io(&d->channel_io, NULL, &channel_io_ops, d, + memory_region_init_io(&d->channel_io, OBJECT(dev), &channel_io_ops, d, "dma-chan", 8 << d->dshift); memory_region_add_subregion(isa_address_space_io(isa), d->base, &d->channel_io); diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c index c4cf8236f4..f62eb3d2a3 100644 --- a/hw/dma/rc4030.c +++ b/hw/dma/rc4030.c @@ -679,9 +679,9 @@ static void rc4030_realize(DeviceState *dev, Error **er= rp) s->periodic_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, rc4030_periodic_timer, s); =20 - memory_region_init_io(&s->iomem_chipset, NULL, &rc4030_ops, s, + memory_region_init_io(&s->iomem_chipset, o, &rc4030_ops, s, "rc4030.chipset", 0x300); - memory_region_init_io(&s->iomem_jazzio, NULL, &jazzio_ops, s, + memory_region_init_io(&s->iomem_jazzio, o, &jazzio_ops, s, "rc4030.jazzio", 0x00001000); =20 memory_region_init_iommu(&s->dma_mr, sizeof(s->dma_mr), --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582580991; cv=none; d=zohomail.com; s=zohoarc; b=BGkGD8QL9P+foPZrUW25EomSATb0Z7xzNErRnU0i9IUeI1fe7SEkADt5v+9PhszsubfC2qkO20CoML1kOFwKEfEnIVF49NmlSB79Cqbmr2jZNR4Ko6ocpT3XulyVYX0gtWJkapabDAs6cEFEWXOLSNWAn/eDedkRzFTk2wt9VVg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582580991; 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=qbvEgfMPFn79RezIvzFb5QHqmDpXn9VCeMrP2Hw3cM4=; b=mk6NeHxUZn92kCjczcDbF+obo5eDP7KLNNIMHPAhVJ9hw97KXM5rPuA7uiv/Wt4dN71F39YwbX9UnocT0eTtfq+mkJXX4jvFmLWnihtO6e7DBXU1uL7S+X7O9BXnA3w+Lcoa5qD9wiHP0HziM7dZnqmTtBj4lXGH046k094ygrc= 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 1582580991597513.6859002044715; Mon, 24 Feb 2020 13:49:51 -0800 (PST) Received: from localhost ([::1]:44522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Lbq-0004mq-9S for importer@patchew.org; Mon, 24 Feb 2020 16:49:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53559) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Krz-00083O-1k for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:02:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Krv-0007zd-TX for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:02:26 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:43932 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 1j6Krv-0007zH-Pk for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:02:23 -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-384-5ze8_Kv6Nt2muSzsp6ULlQ-1; Mon, 24 Feb 2020 16:02:19 -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 96BC51005512; Mon, 24 Feb 2020 21:02:15 +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 679565C54A; Mon, 24 Feb 2020 21:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578143; 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=qbvEgfMPFn79RezIvzFb5QHqmDpXn9VCeMrP2Hw3cM4=; b=hfSw3FyEAZzXAq8C0a0Da5JczWIHURI2+CqnasU9nB3D7cyQqLIXEI8pOo4lVd4VXUrIDG 1Vh9YXLKRm+nU8L21w232I6C9yMOQPzrnQ7LY4tsOVIvnUQ6pZtrYxVg15inzLCu0SerP4 /oxovRupSESwvfwpIvu7+QpupxK+3wc= X-MC-Unique: 5ze8_Kv6Nt2muSzsp6ULlQ-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 28/32] hw/riscv: Let devices own the MemoryRegion they create Date: Mon, 24 Feb 2020 21:55:29 +0100 Message-Id: <20200224205533.23798-29-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/riscv/sifive_e.c | 6 +++--- hw/riscv/sifive_u.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c index 6f6360a619..64eb8ce536 100644 --- a/hw/riscv/sifive_e.c +++ b/hw/riscv/sifive_e.c @@ -145,8 +145,8 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev= , Error **errp) &error_abort); =20 /* Mask ROM */ - memory_region_init_rom(&s->mask_rom, NULL, "riscv.sifive.e.mrom", - memmap[SIFIVE_E_MROM].size, &error_fatal); + memory_region_init_rom(&s->mask_rom, OBJECT(dev), "riscv.sifive.e.mrom= ", + memmap[SIFIVE_E_MROM].size, &error_fatal); memory_region_add_subregion(sys_mem, memmap[SIFIVE_E_MROM].base, &s->mask_rom); =20 @@ -208,7 +208,7 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev= , Error **errp) memmap[SIFIVE_E_PWM2].base, memmap[SIFIVE_E_PWM2].size); =20 /* Flash memory */ - memory_region_init_rom(&s->xip_mem, NULL, "riscv.sifive.e.xip", + memory_region_init_rom(&s->xip_mem, OBJECT(dev), "riscv.sifive.e.xip", memmap[SIFIVE_E_XIP].size, &error_fatal); memory_region_add_subregion(sys_mem, memmap[SIFIVE_E_XIP].base, &s->xip_mem); diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 0e12b3ccef..be7d438db1 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -497,7 +497,7 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev= , Error **errp) &error_abort); =20 /* boot rom */ - memory_region_init_rom(mask_rom, NULL, "riscv.sifive.u.mrom", + memory_region_init_rom(mask_rom, OBJECT(dev), "riscv.sifive.u.mrom", memmap[SIFIVE_U_MROM].size, &error_fatal); memory_region_add_subregion(system_memory, memmap[SIFIVE_U_MROM].base, mask_rom); --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582579937; cv=none; d=zohomail.com; s=zohoarc; b=MmWV0Kp3T9h07YpxWUgt9C98w5uDh2CwI4n89KweCa9f+lfVwk8ueVGR+DBaISWXH5euPRvmSpH8VVoTFK3oLUAWdZN9E5+nv7LlqWTBcwEqJh2baQrImMFkJkmB5kFaBOthTMjhEQbhl8mvz8H4V2ssEtTdE8Afnd6kt6ZO9AQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582579937; 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=/3GrB8c7DkAm0kiddLZXfSUHCAUPp481BLnEWDg9hQc=; b=kreSEL3R6gD6hzr4OD0Gqa/6qXj22v+zTQIK4v25DnlKvoEaQTUbbmMamsZGL/zNONLjAsQ1IGFgkIpXHOuhGVlIYWjIPeLGXwm5IdzEzmCvB6xXhyVWMEH/axNFBHVjgMnjTlXNYciVpRe0iUXs98Qgmu6o6fjfhU4it8BqVFA= 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 1582579937824628.6260517008081; Mon, 24 Feb 2020 13:32:17 -0800 (PST) Received: from localhost ([::1]:44032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LKq-0000k9-IB for importer@patchew.org; Mon, 24 Feb 2020 16:32:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53624) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KsC-00006l-3n for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:02:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KsA-00088t-V2 for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:02:39 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:45616 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 1j6KsA-000884-Q4 for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:02:38 -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-254-DYwcZOF1Pre-MduPNxcMaA-1; Mon, 24 Feb 2020 16:02:36 -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 EA8C11005512; Mon, 24 Feb 2020 21:02:31 +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 15C435C651; Mon, 24 Feb 2020 21:02:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578158; 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=/3GrB8c7DkAm0kiddLZXfSUHCAUPp481BLnEWDg9hQc=; b=eNnSDm7dOBYjZ3RzC15l4tC9H5qFFFMxXi9GfKlqku0QM6ns2tAaPNAsaReqYdsb+Z1aDW IGqCFBoRZbTf0FyizwuQoM6d37x9xi12yNsfmk54aGPrdbUM/XlYdVSHY5ti2OVieu5cAB A4NdN5UGkVIx87X8uAwnlO5WxP7HUXM= X-MC-Unique: DYwcZOF1Pre-MduPNxcMaA-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [PATCH RESEND v2 29/32] hw/input/milkymist-softusb: Remove unused 'pmem_ptr' field Date: Mon, 24 Feb 2020 21:55:30 +0100 Message-Id: <20200224205533.23798-30-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, qemu-trivial@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" In commit 029ad4bcf3 we removed softusb_{read, write}_pmem(), we can also remove the 'pmem_ptr' field. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- Cc: qemu-trivial@nongnu.org hw/input/milkymist-softusb.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c index 3e0a7eb0bd..7deeb1294f 100644 --- a/hw/input/milkymist-softusb.c +++ b/hw/input/milkymist-softusb.c @@ -64,7 +64,6 @@ struct MilkymistSoftUsbState { MemoryRegion dmem; qemu_irq irq; =20 - void *pmem_ptr; void *dmem_ptr; =20 /* device properties */ @@ -263,7 +262,6 @@ static void milkymist_softusb_realize(DeviceState *dev,= Error **errp) memory_region_init_ram_nomigrate(&s->pmem, OBJECT(s), "milkymist-softu= sb.pmem", s->pmem_size, &error_fatal); vmstate_register_ram_global(&s->pmem); - s->pmem_ptr =3D memory_region_get_ram_ptr(&s->pmem); sysbus_init_mmio(sbd, &s->pmem); memory_region_init_ram_nomigrate(&s->dmem, OBJECT(s), "milkymist-softu= sb.dmem", s->dmem_size, &error_fatal); --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582581003; cv=none; d=zohomail.com; s=zohoarc; b=U7vwvkoiMTHpmp2HP8jRwY/T153V7VGv0axKQn5YZDTWA1iVWfatf35XJijfcIl98sbdsil9sETKVtEFZOqq1jmpOE7Tz1m0wVTR+uTUF/jwkmQ5M/gUEaZ6Z1F/FCwxtdlmvmPU7kkyBjoEpPZrNcQ1A8qgyGkyvR3+ikefzGk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582581003; 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=M00bRTY5Od/jt3qLVU2pJOLmr0uFfCYFYcH1/TRboO0=; b=S4pYvKSW7+IizAb5OtJ0jUmhXNmWQXA7ncJiKd/khQZWEPGM6bifs5c5vEy4o7rUgb2HXcjICYeDQS/ET54FZBug/SGsP5/iI34e5/yXODgGrkI5khYs6v6rLNQvmbiyRhed5OW9jyVxS77GbYLfZkiEqSxREpEd4xovZv3hqB8= 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 1582581003080204.000661303809; Mon, 24 Feb 2020 13:50:03 -0800 (PST) Received: from localhost ([::1]:44524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Lc1-00058V-SK for importer@patchew.org; Mon, 24 Feb 2020 16:50:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53738) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6KsN-0000Ug-TE for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:02:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KsL-0008GW-Q7 for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:02:50 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:37753 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 1j6KsL-0008Fu-KX for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:02:49 -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-359-KedknbR_Pg-GkEjsoyumTg-1; Mon, 24 Feb 2020 16:02:45 -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 C59B91005512; Mon, 24 Feb 2020 21:02:41 +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 62E3B5C6DC; Mon, 24 Feb 2020 21:02:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578169; 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=M00bRTY5Od/jt3qLVU2pJOLmr0uFfCYFYcH1/TRboO0=; b=eQmonRLhWN7Xm2Jy4HkRwaUMb8msgrZES8uymNft1ZSCwPD84+ELYmT3FRFa+dtXX5yUp3 uaLGyUBXs4ufPIETwM5b99yGHhFOtbwMrZl9mmMp+sYabeK5PKOpqsTDzapi/H4fvqVE79 TtehcjC+NRy4jGwH6zPagwgv8Pu/bVs= X-MC-Unique: KedknbR_Pg-GkEjsoyumTg-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [RFC PATCH RESEND v2 30/32] hw/input/milkymist-softusb: Let devices own the MemoryRegion they create Date: Mon, 24 Feb 2020 21:55:31 +0100 Message-Id: <20200224205533.23798-31-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] [fuzzy] X-Received-From: 207.211.31.81 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. Note this change break the migration of the LM32 milkymist machine. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/input/milkymist-softusb.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c index 7deeb1294f..72bc7bae1e 100644 --- a/hw/input/milkymist-softusb.c +++ b/hw/input/milkymist-softusb.c @@ -259,13 +259,11 @@ static void milkymist_softusb_realize(DeviceState *de= v, Error **errp) sysbus_init_mmio(sbd, &s->regs_region); =20 /* register pmem and dmem */ - memory_region_init_ram_nomigrate(&s->pmem, OBJECT(s), "milkymist-softu= sb.pmem", + memory_region_init_ram(&s->pmem, OBJECT(s), "milkymist-softusb.pmem", s->pmem_size, &error_fatal); - vmstate_register_ram_global(&s->pmem); sysbus_init_mmio(sbd, &s->pmem); - memory_region_init_ram_nomigrate(&s->dmem, OBJECT(s), "milkymist-softu= sb.dmem", + memory_region_init_ram(&s->dmem, OBJECT(s), "milkymist-softusb.dmem", s->dmem_size, &error_fatal); - vmstate_register_ram_global(&s->dmem); s->dmem_ptr =3D memory_region_get_ram_ptr(&s->dmem); sysbus_init_mmio(sbd, &s->dmem); =20 @@ -275,8 +273,8 @@ static void milkymist_softusb_realize(DeviceState *dev,= Error **errp) =20 static const VMStateDescription vmstate_milkymist_softusb =3D { .name =3D "milkymist-softusb", - .version_id =3D 1, - .minimum_version_id =3D 1, + .version_id =3D 2, + .minimum_version_id =3D 2, .fields =3D (VMStateField[]) { VMSTATE_UINT32_ARRAY(regs, MilkymistSoftUsbState, R_MAX), VMSTATE_HID_KEYBOARD_DEVICE(hid_kbd, MilkymistSoftUsbState), --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582581122; cv=none; d=zohomail.com; s=zohoarc; b=DoRGh1vy0FfcuKsrBtcflVlOWiKo/oIS5/oHysxX9HSXrUkfWqNSlxXBqokOBgOO9RDlh9YCwjkSG7uZy/iMywy/p6xl9FKGJlDoUGqghQvDtG+1k6MWwv2qX0g+P8Vd9IP8isUe/YxsipwLEhi+fVJ5TFOcDowrEFM22GJ65TA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582581122; 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=XVZvi/YHzEh7ylVqPr697ez8p22nG0yVmTeif46TOmw=; b=IVZCXB1o6t05qX+490Al6tAQ40q6t0mT89uf0hclFbBDEOFjK4Jr3X2cWjA6YvE2gzrn0ZC3gj8ldQkNPQIhJDex0GihaxX0XH+QrkxUUn4JnmtcKgEbsDXWTXrS5UBG5MtXjzLRAwXx8PbfKp5wrzk0x6gidxGWOVdpKjBet0Y= 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 1582581122606359.7774451317256; Mon, 24 Feb 2020 13:52:02 -0800 (PST) Received: from localhost ([::1]:44576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Ldx-0007mk-JK for importer@patchew.org; Mon, 24 Feb 2020 16:52:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53792) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Ksa-0000sQ-NK for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:03:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6KsZ-0008NL-J5 for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:03:04 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:20204 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 1j6KsZ-0008Mh-FK for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:03:03 -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-473-v-AiIWesPt2X2quRXpPcbw-1; Mon, 24 Feb 2020 16:03:01 -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 B9C21801E6C; Mon, 24 Feb 2020 21:02:56 +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 3CEBA5C21B; Mon, 24 Feb 2020 21:02:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578183; 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=XVZvi/YHzEh7ylVqPr697ez8p22nG0yVmTeif46TOmw=; b=LOcpmxI4gKqqhkmNheMcNGBzbQiq0OcfMlLyG8pBvi1JQpO2BflwkHfjzocD8+e4gV9LDb syXWrS2QFjOeqrvAqhHfOlYH7NO/FnP4zyXDudUH0KYpwXKSBzgIHapS++mudlV1QmteT9 WMyyDC4gPDf/qtX/RPnrowIQu2hXsAE= X-MC-Unique: v-AiIWesPt2X2quRXpPcbw-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [RFC PATCH RESEND v2 31/32] hw/net/milkymist-minimac2: Let devices own the MemoryRegion they create Date: Mon, 24 Feb 2020 21:55:32 +0100 Message-Id: <20200224205533.23798-32-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] [fuzzy] X-Received-From: 207.211.31.81 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. Note this change break the migration of the LM32 milkymist machine. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/milkymist-minimac2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/net/milkymist-minimac2.c b/hw/net/milkymist-minimac2.c index 1ba01754ee..9582b5f8a3 100644 --- a/hw/net/milkymist-minimac2.c +++ b/hw/net/milkymist-minimac2.c @@ -473,9 +473,9 @@ static void milkymist_minimac2_realize(DeviceState *dev= , Error **errp) sysbus_init_mmio(sbd, &s->regs_region); =20 /* register buffers memory */ - memory_region_init_ram_nomigrate(&s->buffers, OBJECT(dev), "milkymist-= minimac2.buffers", + memory_region_init_ram(&s->buffers, OBJECT(dev), + "milkymist-minimac2.buffers", buffers_size, &error_fatal); - vmstate_register_ram_global(&s->buffers); s->rx0_buf =3D memory_region_get_ram_ptr(&s->buffers); s->rx1_buf =3D s->rx0_buf + MINIMAC2_BUFFER_SIZE; s->tx_buf =3D s->rx1_buf + MINIMAC2_BUFFER_SIZE; @@ -506,8 +506,8 @@ static const VMStateDescription vmstate_milkymist_minim= ac2_mdio =3D { =20 static const VMStateDescription vmstate_milkymist_minimac2 =3D { .name =3D "milkymist-minimac2", - .version_id =3D 1, - .minimum_version_id =3D 1, + .version_id =3D 2, + .minimum_version_id =3D 2, .fields =3D (VMStateField[]) { VMSTATE_UINT32_ARRAY(regs, MilkymistMinimac2State, R_MAX), VMSTATE_UINT16_ARRAY(phy_regs, MilkymistMinimac2State, R_PHY_MAX), --=20 2.21.1 From nobody Thu Nov 13 19:20:31 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=1582581209; cv=none; d=zohomail.com; s=zohoarc; b=kTXFMRt/32vlCyUQypPGLggeqmBq/GmtrcrRIbjyyxxOdVFnvVlbyhbDGEm5iU8GIMb0aRD4IfTQsZ1C6MLXBKVCKQePYeXG5swy0NzB0P4gXBiNJJJkfsVCndVqBaXoEvm7+fEhp4PuqIDHVammWE5V3eJihU9BDunm7mGWZ8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582581209; 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=StqJFGk25DRObG1eUf3VsEaRXrOCmfJGPZ/cwXjxQcU=; b=UVmIknAQhdk9xFIBSpT/qbltM52A/75pQgZDEB9Z+UAvavf9YiG166nHc4js+2LT6lAn5F3BoznWNJlInEUib8cIbXldVRGmbmiezaFW520B2FAugQsOfztq4PzDBN5P4w0KhdBGvGxnV8m/ULLE4jrf8JG/H6E/kdVHsjcbI+Y= 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 158258120972161.83640246921061; Mon, 24 Feb 2020 13:53:29 -0800 (PST) Received: from localhost ([::1]:44608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6LfL-0001Kh-M8 for importer@patchew.org; Mon, 24 Feb 2020 16:53:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53876) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Ksl-0001Fh-OP for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:03:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Ksj-0008Vo-8Q for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:03:15 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:28381 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6Ksj-0008Ue-3H for qemu-devel@nongnu.org; Mon, 24 Feb 2020 16:03:13 -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-296-DejhcVKnPHCUF0iGsrmtVg-1; Mon, 24 Feb 2020 16:03:10 -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 608991005513; Mon, 24 Feb 2020 21:03:06 +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 392765C21B; Mon, 24 Feb 2020 21:02:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582578192; 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=StqJFGk25DRObG1eUf3VsEaRXrOCmfJGPZ/cwXjxQcU=; b=OTs7s7vnvLnp/HKFx/Ap3N6e8/r58vnl64+tdoBls+fSLrlPe4+R2KJviQParEC+UZ6E+u vXxS7uUJPQmKij/DQbdiaBoXHZb+uVlYX+vqSul3+FXEkGXq/CDw4Sv9Qe9nW4HONJd6Ai d5cpNo7QPEh2jmiJ3BMuJIAj8PnjMXk= X-MC-Unique: DejhcVKnPHCUF0iGsrmtVg-1 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Paolo Bonzini , Peter Maydell Subject: [RFC PATCH RESEND v2 32/32] hw/block/onenand: Let devices own the MemoryRegion they create Date: Mon, 24 Feb 2020 21:55:33 +0100 Message-Id: <20200224205533.23798-33-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.120 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. Note this change break the migration of the nSeries machines. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/block/onenand.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/block/onenand.c b/hw/block/onenand.c index 898ac563a3..f49db0b2ee 100644 --- a/hw/block/onenand.c +++ b/hw/block/onenand.c @@ -173,8 +173,8 @@ static int onenand_post_load(void *opaque, int version_= id) =20 static const VMStateDescription vmstate_onenand =3D { .name =3D "onenand", - .version_id =3D 1, - .minimum_version_id =3D 1, + .version_id =3D 2, + .minimum_version_id =3D 2, .pre_save =3D onenand_pre_save, .post_load =3D onenand_post_load, .fields =3D (VMStateField[]) { @@ -809,9 +809,8 @@ static void onenand_realize(DeviceState *dev, Error **e= rrp) } s->otp =3D memset(g_malloc((64 + 2) << PAGE_SHIFT), 0xff, (64 + 2) << PAGE_SHIFT); - memory_region_init_ram_nomigrate(&s->ram, OBJECT(s), "onenand.ram", + memory_region_init_ram(&s->ram, OBJECT(s), "onenand.ram", 0xc000 << s->shift, &error_fatal); - vmstate_register_ram_global(&s->ram); ram =3D memory_region_get_ram_ptr(&s->ram); s->boot[0] =3D ram + (0x0000 << s->shift); s->boot[1] =3D ram + (0x8000 << s->shift); --=20 2.21.1