From nobody Thu Nov 13 22:13:35 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; 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 ARC-Seal: i=1; a=rsa-sha256; t=1582810529; cv=none; d=zohomail.com; s=zohoarc; b=KxyKkepHz+AYTo+Ry9egGPYaz1lkUg7T/8/gV3utmymPdQkLXDqJUjsPyXnwbMg+CsqgTBMUb9ISWB8yq17K0677kqlAG4UWbmeybgpxBQ+QwIALpb2GmCGaQMBmIcu0khgiMr6++bu0L6kd+eQMXMP+5iNDcCaerkdt99XLoN0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582810529; 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=d5i5oNdBKQRovpLk3hScFdRwxms9MJJFS1FSmeS05aU=; b=nL0hs0+Y0SY4smM5VDbWSq1JNHrf0Vd7I1IQUExt8Q+L+KxrFUGAAWRXGcQz7VTnyy/GwQ9HSiJzDq3dDLVz0xCnpFxGSz3c8jXM+IAO7DDh+4aSnevAIBazxnrRgC2OzzrZZwh7ztOl+dRmOHOgi5BZ+va/MLMXYC/0+4Krw5I= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1582810529904866.2697434565077; Thu, 27 Feb 2020 05:35:29 -0800 (PST) Received: from localhost ([::1]:59680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7JK3-0000uC-KR for importer@patchew.org; Thu, 27 Feb 2020 08:35:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33227) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7JE2-0001on-D8 for qemu-devel@nongnu.org; Thu, 27 Feb 2020 08:29:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j7JE1-0005oJ-8s for qemu-devel@nongnu.org; Thu, 27 Feb 2020 08:29:14 -0500 Received: from mx2.rt-rk.com ([89.216.37.149]:40293 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j7JE0-0004XJ-Uh for qemu-devel@nongnu.org; Thu, 27 Feb 2020 08:29:13 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 3D0D51A20E4; Thu, 27 Feb 2020 14:28:10 +0100 (CET) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.14.106]) by mail.rt-rk.com (Postfix) with ESMTPSA id 1A38F1A20A0; Thu, 27 Feb 2020 14:28:10 +0100 (CET) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org Subject: [PULL 4/5] hw/mips: Use memory_region_init_rom() with read-only regions Date: Thu, 27 Feb 2020 14:27:35 +0100 Message-Id: <1582810056-22646-5-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1582810056-22646-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1582810056-22646-1-git-send-email-aleksandar.markovic@rt-rk.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 89.216.37.149 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: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , amarkovic@wavecomp.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Reviewed-by: Aleksandar Markovic Signed-off-by: Aleksandar Markovic Message-Id: <20200224205533.23798-8-philmd@redhat.com> --- 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 c373ab0..4727b1d 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_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, machine->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 32fbd10..afea52b 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -197,9 +197,8 @@ static void mips_jazz_init(MachineState *machine, /* allocate RAM */ memory_region_add_subregion(address_space, 0, machine->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); @@ -265,9 +264,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 b2555dd..d220318 100644 --- a/hw/mips/mips_mipssim.c +++ b/hw/mips/mips_mipssim.c @@ -165,9 +165,8 @@ mips_mipssim_init(MachineState *machine) qemu_register_reset(main_cpu_reset, reset_info); =20 /* Allocate RAM. */ - 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, machine->ram); =20 diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index 258cd91..ad8b75e 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -237,9 +237,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.7.4