From nobody Fri May 17 04:49:51 2024 Delivered-To: importer@patchew.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; dmarc=fail(p=none dis=none) header.from=ispras.ru ARC-Seal: i=1; a=rsa-sha256; t=1594808423; cv=none; d=zohomail.com; s=zohoarc; b=UTWqPi/+YllJVax+4NSGTl0u2wmYdAwPU1HGdDIY9ERMp3CI/6hu2MTMicAw0TjHbJEonAAzrpo+CQg4gSrmj5AvSQdliwGFDlXDGVWaZvtnJgX7oARKWzTctkbSUHaRamPW6Mk6N+pxmEKslTEtogQ5/TDnY6t+s8tT1oNM58g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594808423; 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=xf3LCAT92hNF8T6n45LjW/G/5WR6VTNNSmFmsHr9yoc=; b=UStuaJgf2WC3atqI8/B3ASKUuQegTEbdrsEiHpsTjyRst627yLOmU3R9X84S9M4+1eABqjXnpwDTfbzK+iDETpdWn7Cw27xChwLJct9dgMgZmXYnOkhbwaE4UxFSt3jXI7R2OC8g08eTa11OFBGD8t1i5n3f7nnwmHwF5RlhWbo= 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; 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 1594808423280999.7909455468025; Wed, 15 Jul 2020 03:20:23 -0700 (PDT) Received: from localhost ([::1]:38672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jveWU-0000XM-1N for importer@patchew.org; Wed, 15 Jul 2020 06:20:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jveVP-0007Zq-JA for qemu-devel@nongnu.org; Wed, 15 Jul 2020 06:19:15 -0400 Received: from mail.ispras.ru ([83.149.199.84]:49884) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jveVN-0007JI-T1 for qemu-devel@nongnu.org; Wed, 15 Jul 2020 06:19:15 -0400 Received: from [127.0.1.1] (unknown [62.118.151.149]) by mail.ispras.ru (Postfix) with ESMTPSA id 23C034089EF8; Wed, 15 Jul 2020 10:19:12 +0000 (UTC) Subject: [PATCH 1/2] hw/mips: remove exit(1) in case of missing ROM From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 15 Jul 2020 13:19:11 +0300 Message-ID: <159480835187.15819.781619322329640772.stgit@pasha-ThinkPad-X280> In-Reply-To: <159480834629.15819.10175861928294983612.stgit@pasha-ThinkPad-X280> References: <159480834629.15819.10175861928294983612.stgit@pasha-ThinkPad-X280> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=83.149.199.84; envelope-from=pavel.dovgalyuk@ispras.ru; helo=mail.ispras.ru X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/15 06:19:07 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, pavel.dovgalyuk@ispras.ru, f4bug@amsat.org, jiaxun.yang@flygoat.com, aleksandar.qemu.devel@gmail.com, antonynpavlov@gmail.com, chenhc@lemote.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" This patch updates MIPS-based machines to allow starting them without ROM. In this case CPU starts to execute instructions from the empty memory, but QEMU allows introspecting the machine configuration. Signed-off-by: Pavel Dovgalyuk --- 0 files changed diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 8ca31e5162..3e8a073922 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -336,10 +336,8 @@ static void mips_fuloong2e_init(MachineState *machine) kernel_entry =3D load_kernel(env); write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entr= y); } else { - if (bios_name =3D=3D NULL) { - bios_name =3D FULOONG_BIOSNAME; - } - filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); + filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, + bios_name ?: FULOONG_BIOSNAME); if (filename) { bios_size =3D load_image_targphys(filename, 0x1fc00000LL, BIOS_SIZE); @@ -349,7 +347,7 @@ static void mips_fuloong2e_init(MachineState *machine) } =20 if ((bios_size < 0 || bios_size > BIOS_SIZE) && - !kernel_filename && !qtest_enabled()) { + bios_name && !qtest_enabled()) { error_report("Could not load MIPS bios '%s'", bios_name); exit(1); } diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index c3b0da60cc..fcd8d71262 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -205,10 +205,7 @@ static void mips_jazz_init(MachineState *machine, memory_region_add_subregion(address_space, 0xfff00000LL, bios2); =20 /* load the BIOS image. */ - if (bios_name =3D=3D NULL) { - bios_name =3D BIOS_FILENAME; - } - filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); + filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name ?: BIOS_FIL= ENAME); if (filename) { bios_size =3D load_image_targphys(filename, 0xfff00000LL, MAGNUM_BIOS_SIZE); @@ -216,7 +213,8 @@ static void mips_jazz_init(MachineState *machine, } else { bios_size =3D -1; } - if ((bios_size < 0 || bios_size > MAGNUM_BIOS_SIZE) && !qtest_enabled(= )) { + if ((bios_size < 0 || bios_size > MAGNUM_BIOS_SIZE) + && bios_name && !qtest_enabled()) { error_report("Could not load MIPS bios '%s'", bios_name); exit(1); } diff --git a/hw/mips/malta.c b/hw/mips/malta.c index d95926a89c..e48f284a8c 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1334,10 +1334,8 @@ void mips_malta_init(MachineState *machine) /* Load firmware from flash. */ if (!dinfo) { /* Load a BIOS image. */ - if (bios_name =3D=3D NULL) { - bios_name =3D BIOS_FILENAME; - } - filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); + filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, + bios_name ?: BIOS_FILENAME); if (filename) { bios_size =3D load_image_targphys(filename, FLASH_ADDRESS, BIOS_SIZE); @@ -1346,9 +1344,8 @@ void mips_malta_init(MachineState *machine) bios_size =3D -1; } if ((bios_size < 0 || bios_size > BIOS_SIZE) && - !kernel_filename && !qtest_enabled()) { - error_report("Could not load MIPS bios '%s', and no " - "-kernel argument was specified", bios_name); + bios_name && !qtest_enabled()) { + error_report("Could not load MIPS bios '%s'", bios_name); exit(1); } } diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c index 1b3b762203..f259e7041e 100644 --- a/hw/mips/mipssim.c +++ b/hw/mips/mipssim.c @@ -173,10 +173,7 @@ mips_mipssim_init(MachineState *machine) /* Map the BIOS / boot exception handler. */ memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios); /* Load a BIOS / boot exception handler image. */ - if (bios_name =3D=3D NULL) { - bios_name =3D BIOS_FILENAME; - } - filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); + filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name ?: BIOS_FIL= ENAME); if (filename) { bios_size =3D load_image_targphys(filename, 0x1fc00000LL, BIOS_SIZ= E); g_free(filename); @@ -184,10 +181,9 @@ mips_mipssim_init(MachineState *machine) bios_size =3D -1; } if ((bios_size < 0 || bios_size > BIOS_SIZE) && - !kernel_filename && !qtest_enabled()) { + bios_name && !qtest_enabled()) { /* Bail out if we have neither a kernel image nor boot vector code= . */ - error_report("Could not load MIPS bios '%s', and no " - "-kernel argument was specified", bios_name); + error_report("Could not load MIPS bios '%s'", bios_name); exit(1); } else { /* We have a boot vector start address. */ From nobody Fri May 17 04:49:51 2024 Delivered-To: importer@patchew.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; dmarc=fail(p=none dis=none) header.from=ispras.ru ARC-Seal: i=1; a=rsa-sha256; t=1594808429; cv=none; d=zohomail.com; s=zohoarc; b=Q0rMYZaDDE7s3RYoCV5/AfrHl+j4aLZkR90V5T9ID88gBoc18MgaEjrYKMDdLZ/2oHDwpvoAaxl8JtuGQKxPdoBlQ9VRnM559+HWbaMihnkfsTZstKU3NZtBL/dPc+TpwSS1kSdra++Yl6ut2srhZsCrzrCmvun51ssP0umWIuk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594808429; 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=s4Fff0LxUCRSJNlwHuzg0KD0skfS4ZYUFO+QMTGVoI0=; b=ZVTFR3GCWKQkqI2DWrNqNNSijiD1IQo8U1MS+k6Yu9WYUDp5mnAQyheIGI8dHtEv+EqlkPuZOeZ/9bnZGuZem08VIsDaVKyON8L5Du3sAm15/rGIjBDAXGZLgynHcq+ACXJZnXf58PZDAqG0pVjtEmPVoTmf4TVYBy+MLaV+vgQ= 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; 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 1594808429727190.88064980320098; Wed, 15 Jul 2020 03:20:29 -0700 (PDT) Received: from localhost ([::1]:39226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jveWa-0000rQ-Ga for importer@patchew.org; Wed, 15 Jul 2020 06:20:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jveVV-0007jX-8t for qemu-devel@nongnu.org; Wed, 15 Jul 2020 06:19:21 -0400 Received: from mail.ispras.ru ([83.149.199.84]:49916) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jveVT-0007Mu-HM for qemu-devel@nongnu.org; Wed, 15 Jul 2020 06:19:21 -0400 Received: from [127.0.1.1] (unknown [62.118.151.149]) by mail.ispras.ru (Postfix) with ESMTPSA id ADE0E4089EFB; Wed, 15 Jul 2020 10:19:17 +0000 (UTC) Subject: [PATCH 2/2] hw/arm: remove exit(1) in case of missing ROM From: Pavel Dovgalyuk To: qemu-devel@nongnu.org Date: Wed, 15 Jul 2020 13:19:17 +0300 Message-ID: <159480835744.15819.10383908697966018668.stgit@pasha-ThinkPad-X280> In-Reply-To: <159480834629.15819.10175861928294983612.stgit@pasha-ThinkPad-X280> References: <159480834629.15819.10175861928294983612.stgit@pasha-ThinkPad-X280> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=83.149.199.84; envelope-from=pavel.dovgalyuk@ispras.ru; helo=mail.ispras.ru X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/15 06:19:07 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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, pavel.dovgalyuk@ispras.ru, f4bug@amsat.org, jiaxun.yang@flygoat.com, aleksandar.qemu.devel@gmail.com, antonynpavlov@gmail.com, chenhc@lemote.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" This patch updates ARM-based machines to allow starting them without ROM. In this case CPU starts to execute instructions from the empty memory, but QEMU allows introspecting the machine configuration. Signed-off-by: Pavel Dovgalyuk --- 0 files changed diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c index b6452d918c..dbad63ffa2 100644 --- a/hw/arm/digic_boards.c +++ b/hw/arm/digic_boards.c @@ -102,8 +102,12 @@ static void digic_load_rom(DigicState *s, hwaddr addr, char *fn =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, filename); =20 if (!fn) { - error_report("Couldn't find rom image '%s'.", filename); - exit(1); + if (bios_name) { + error_report("Couldn't find rom image '%s'.", filename); + exit(1); + } else { + return; + } } =20 rom_size =3D load_image_targphys(fn, addr, max_size); diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c index 3a4bc332c4..a74bb5e27c 100644 --- a/hw/arm/gumstix.c +++ b/hw/arm/gumstix.c @@ -60,9 +60,8 @@ static void connex_init(MachineState *machine) =20 dinfo =3D drive_get(IF_PFLASH, 0, 0); if (!dinfo && !qtest_enabled()) { - error_report("A flash image must be given with the " - "'pflash' parameter"); - exit(1); + warn_report("A flash image must be given with the " + "'pflash' parameter"); } =20 if (!pflash_cfi01_register(0x00000000, "connext.rom", connex_rom, @@ -90,9 +89,8 @@ static void verdex_init(MachineState *machine) =20 dinfo =3D drive_get(IF_PFLASH, 0, 0); if (!dinfo && !qtest_enabled()) { - error_report("A flash image must be given with the " - "'pflash' parameter"); - exit(1); + warn_report("A flash image must be given with the " + "'pflash' parameter"); } =20 if (!pflash_cfi01_register(0x00000000, "verdex.rom", verdex_rom, diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c index 57829b3744..c0ed3d93e9 100644 --- a/hw/arm/omap_sx1.c +++ b/hw/arm/omap_sx1.c @@ -191,13 +191,12 @@ static void sx1_init(MachineState *machine, const int= version) } =20 if (!machine->kernel_filename && !fl_idx && !qtest_enabled()) { - error_report("Kernel or Flash image must be specified"); - exit(1); + warn_report("Kernel or Flash image must be specified"); + } else { + /* Load the kernel. */ + arm_load_kernel(mpu->cpu, machine, &sx1_binfo); } =20 - /* Load the kernel. */ - arm_load_kernel(mpu->cpu, machine, &sx1_binfo); - /* TODO: fix next line */ //~ qemu_console_resize(ds, 640, 480); } diff --git a/hw/arm/palm.c b/hw/arm/palm.c index 97ca105d29..d4f4a8d07a 100644 --- a/hw/arm/palm.c +++ b/hw/arm/palm.c @@ -257,12 +257,11 @@ static void palmte_init(MachineState *machine) } =20 if (!rom_loaded && !machine->kernel_filename && !qtest_enabled()) { - fprintf(stderr, "Kernel or ROM image must be specified\n"); - exit(1); + warn_report("Kernel or ROM image must be specified"); + } else { + /* Load the kernel. */ + arm_load_kernel(mpu->cpu, machine, &palmte_binfo); } - - /* Load the kernel. */ - arm_load_kernel(mpu->cpu, machine, &palmte_binfo); } =20 static void palmte_machine_init(MachineClass *mc)