From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2767DC0044D for ; Mon, 16 Mar 2020 22:00:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E593920674 for ; Mon, 16 Mar 2020 22:00:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SSdGJULk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E593920674 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxmg-0002a7-Ve for qemu-devel@archiver.kernel.org; Mon, 16 Mar 2020 18:00:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43028) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxI5-0004E9-Sy for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxI4-0006ib-8o for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:53 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:47817) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxI3-0006gY-Mi for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394131; 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=g4xvNCNRSh2yAzQnkNyxfYKq+UdpxRWD7xk18vmDD9o=; b=SSdGJULksco/v0VyEFK5XRZyK6pSvrKpZjUIBsrAh7d1SveuqVe98vy5Lbdf6UUpc3+Hkg CkAppTYy23SgE/0faxuA+WAagDuSyUFQ920TmDWGxXMG9AUATuRKOC4G6sTour5Psj+2Cl ocG9U9nH610QshmcYLo85RM9ZMQjjx0= 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-131-WdoFYjETMuyALniruDnSOA-1; Mon, 16 Mar 2020 17:28:49 -0400 X-MC-Unique: WdoFYjETMuyALniruDnSOA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E5E4F801E5C for ; Mon, 16 Mar 2020 21:28:48 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2F7519C4F; Mon, 16 Mar 2020 21:28:47 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 41/61] hw/arm: Use memory_region_init_rom() with read-only regions Date: Mon, 16 Mar 2020 22:27:08 +0100 Message-Id: <1584394048-44994-42-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 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: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daud=C3=A9 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 59a27bd..3af6502 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 1042017..6bc6436 100644 --- a/hw/arm/mainstone.c +++ b/hw/arm/mainstone.c @@ -124,9 +124,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 /* There are two 32MiB flash devices on the board */ diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c index de5ff44..57829b3 100644 --- a/hw/arm/omap_sx1.c +++ b/hw/arm/omap_sx1.c @@ -131,9 +131,8 @@ static void sx1_init(MachineState *machine, const int v= ersion) mpu =3D omap310_mpu_init(machine->ram, 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, @@ -167,9 +166,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 99554bd..97ca105 100644 --- a/hw/arm/palm.c +++ b/hw/arm/palm.c @@ -213,9 +213,8 @@ static void palmte_init(MachineState *machine) mpu =3D omap310_mpu_init(machine->ram, 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 cbfa693..c28d9b5 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -929,8 +929,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 221a786..d136ba1 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 4d95a1f..5dee2d7 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 1.8.3.1