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=-11.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 B7BDCC433E7 for ; Fri, 17 Jul 2020 12:16:13 +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 8C5FC2080D for ; Fri, 17 Jul 2020 12:16:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C5FC2080D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kaod.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwPHg-0005hh-Tg for qemu-devel@archiver.kernel.org; Fri, 17 Jul 2020 08:16:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwPGl-00054D-IQ for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:15:15 -0400 Received: from 6.mo2.mail-out.ovh.net ([87.98.165.38]:53857) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jwPGj-00087U-7r for qemu-devel@nongnu.org; Fri, 17 Jul 2020 08:15:15 -0400 Received: from player795.ha.ovh.net (unknown [10.110.208.168]) by mo2.mail-out.ovh.net (Postfix) with ESMTP id BA35A1E23FA for ; Fri, 17 Jul 2020 14:15:01 +0200 (CEST) Received: from kaod.org (82-64-250-170.subs.proxad.net [82.64.250.170]) (Authenticated sender: clg@kaod.org) by player795.ha.ovh.net (Postfix) with ESMTPSA id C3EC5144E1AAA; Fri, 17 Jul 2020 12:14:55 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-100R00314731bc6-1c62-4562-8136-01b5a9a5a681,EDCDB8C856EF0F0B0CA5B21EBB7B009702C7510A) smtp.auth=clg@kaod.org Subject: Re: [PATCH v6 07/13] hw/arm: Load -bios image as a boot ROM for npcm7xx To: Havard Skinnemoen , qemu-devel@nongnu.org, qemu-arm@nongnu.org References: <20200717060258.1602319-1-hskinnemoen@google.com> <20200717060258.1602319-8-hskinnemoen@google.com> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: Date: Fri, 17 Jul 2020 14:14:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200717060258.1602319-8-hskinnemoen@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 10828060879354170281 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedrfeeigdegjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeevrogurhhitggpnfgvpgfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepfeffvddtudegieefudeugffhjefgieegieegleettdehgfeiieevueeihfegfefgnecukfhppedtrddtrddtrddtpdekvddrieegrddvhedtrddujedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeelhedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhg Received-SPF: pass client-ip=87.98.165.38; envelope-from=clg@kaod.org; helo=6.mo2.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/17 08:15:02 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: kfting@nuvoton.com, Avi.Fishman@nuvoton.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 7/17/20 8:02 AM, Havard Skinnemoen wrote: > If a -bios option is specified on the command line, load the image into > the internal ROM memory region, which contains the first instructions > run by the CPU after reset. > > If -bios is not specified, the vbootrom included with qemu is loaded by > default. > > Reviewed-by: Tyrone Ting > Signed-off-by: Havard Skinnemoen > --- > hw/arm/npcm7xx_boards.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c > index 0b9dce2b35..f32557e0e1 100644 > --- a/hw/arm/npcm7xx_boards.c > +++ b/hw/arm/npcm7xx_boards.c > @@ -18,12 +18,41 @@ > > #include "hw/arm/npcm7xx.h" > #include "hw/core/cpu.h" > +#include "hw/loader.h" > #include "qapi/error.h" > +#include "qemu-common.h" > #include "qemu/units.h" > +#include "sysemu/sysemu.h" > > #define NPCM750_EVB_POWER_ON_STRAPS 0x00001ff7 > #define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff > > +static const char npcm7xx_default_bootrom[] = "npcm7xx_bootrom.bin"; > + > +static void npcm7xx_load_bootrom(NPCM7xxState *soc) > +{ > + g_autofree char *filename = NULL; > + const char *bootrom; > + int ret; > + > + if (bios_name) { > + bootrom = bios_name; > + } else { > + bootrom = npcm7xx_default_bootrom; you could simply assign bios_name. No need to resend for that. Reviewed-by: Cédric Le Goater C. > + } > + > + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bootrom); > + if (!filename) { > + error_report("Could not find ROM image '%s'", bootrom); > + exit(1); > + } > + ret = load_image_mr(filename, &soc->irom); > + if (ret < 0) { > + error_report("Failed to load ROM image '%s'", filename); > + exit(1); > + } > +} > + > static void npcm7xx_connect_dram(NPCM7xxState *soc, MemoryRegion *dram) > { > memory_region_add_subregion(get_system_memory(), NPCM7XX_DRAM_BA, dram); > @@ -60,6 +89,7 @@ static void npcm750_evb_init(MachineState *machine) > npcm7xx_connect_dram(soc, machine->ram); > qdev_realize(DEVICE(soc), NULL, &error_fatal); > > + npcm7xx_load_bootrom(soc); > npcm7xx_load_kernel(machine, soc); > } > > @@ -71,6 +101,7 @@ static void quanta_gsj_init(MachineState *machine) > npcm7xx_connect_dram(soc, machine->ram); > qdev_realize(DEVICE(soc), NULL, &error_fatal); > > + npcm7xx_load_bootrom(soc); > npcm7xx_load_kernel(machine, soc); > } > >