From patchwork Tue Jan 24 19:55:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artyom Tarasenko X-Patchwork-Id: 9535789 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A11206042D for ; Tue, 24 Jan 2017 20:00:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F86526907 for ; Tue, 24 Jan 2017 20:00:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 844DC2711E; Tue, 24 Jan 2017 20:00:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 720C626907 for ; Tue, 24 Jan 2017 20:00:08 +0000 (UTC) Received: from localhost ([::1]:55464 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cW7GB-0000sa-Jy for patchwork-qemu-devel@patchwork.kernel.org; Tue, 24 Jan 2017 15:00:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cW7Cv-0006nU-Ua for qemu-devel@nongnu.org; Tue, 24 Jan 2017 14:56:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cW7Cr-0000n2-4M for qemu-devel@nongnu.org; Tue, 24 Jan 2017 14:56:46 -0500 Received: from mail-wj0-x241.google.com ([2a00:1450:400c:c01::241]:35644) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cW7Cq-0000mv-Ua for qemu-devel@nongnu.org; Tue, 24 Jan 2017 14:56:41 -0500 Received: by mail-wj0-x241.google.com with SMTP id i7so3195657wjf.2 for ; Tue, 24 Jan 2017 11:56:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bGyIPHxF87zcFSkDi97RpSc3uzZ1nbqiUwgBOIi+NYY=; b=YaO75YSNsXC27Grb7z9VFj+mQxoUAoqH02zVqCe2Qfw2dpd+S1soGw24yEz8OxuuPM QKK7gCfLpNHGEkQ8gsokpikNjrb9f+dCf8ThrDIat43EZAquFb9HmWUPG7hXuoji5650 rYftqMHnvsv1Jog0/NbFZasKPJW6K0Kkkhl1tyzfCmT1wygz+GI82/Er7LMJF1gPxeTo 33rfV++ocWdHfuHRMBCuzKhBmu70E6UEJkcI2zwFzYUOiZy+NPYhbbfhOeQ5Jw40Kywo mBV894+mB/Um25X10BZZPIRb3FKPI54v7Xzg4/Q6NY8XB9s8SuxX3KUGJy9h27JzoJva TFIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bGyIPHxF87zcFSkDi97RpSc3uzZ1nbqiUwgBOIi+NYY=; b=FWviXkWNgd9cy1aGGkv8YexRl47aAIAN66WGIOPet8g0c2UgSd4/Ltsn1jXugPO9XI 2C6VvjLn4LfZ1+cgp171j4r7hybS3kYS4BeO/uTQBYlTlj2rIZNOz2UxeqB/Pv6tCxhQ KYX6Z9Z1x8gVAGlRBHrLrVUUxxiqeaPoldD1qGKdTlcvho/rl/dzMezdnovKEDEizmbT GXxOq9PPWSo2o1RotBb8dMPcFxsc3NOPfIUJPoz2SGqhizloSfhmSuAINF0qJqCx8Cs3 PW9Ymbc4otFFhnVC/lUlkLzHRKLkKs+wLIsTOit2BUKdkcKv5fNkoKs/hiks+YcXC7qf Iopw== X-Gm-Message-State: AIkVDXI661ZWbE5UAhfiqAM0lrysqm4X7c/i2widphAJYJyen6VmkDT+vEPlwU74lFVnXQ== X-Received: by 10.223.173.181 with SMTP id w50mr29823853wrc.177.1485287799529; Tue, 24 Jan 2017 11:56:39 -0800 (PST) Received: from localhost (x55b4b9ca.dyn.telefonica.de. [85.180.185.202]) by smtp.gmail.com with ESMTPSA id w17sm21567871wra.28.2017.01.24.11.56.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jan 2017 11:56:38 -0800 (PST) From: Artyom Tarasenko To: qemu-devel@nongnu.org Date: Tue, 24 Jan 2017 20:55:41 +0100 Message-Id: <1485287742-31374-2-git-send-email-atar4qemu@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1485287742-31374-1-git-send-email-atar4qemu@gmail.com> References: <1485287742-31374-1-git-send-email-atar4qemu@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c01::241 Subject: [Qemu-devel] [PATCH v2 1/2] niagara: fail if a firmware file is missing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, armbru@redhat.com, Artyom Tarasenko Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP fail if a firmware file is missing and not qtest_enabled(), the later is necessary to allow some basic tests if firmware is not available Suggested-by: Peter Maydell Signed-off-by: Artyom Tarasenko --- hw/sparc64/niagara.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c index b55d4bb..edde86e 100644 --- a/hw/sparc64/niagara.c +++ b/hw/sparc64/niagara.c @@ -35,6 +35,8 @@ #include "hw/timer/sun4v-rtc.h" #include "exec/address-spaces.h" #include "sysemu/block-backend.h" +#include "qemu/error-report.h" +#include "sysemu/qtest.h" typedef struct NiagaraBoardState { @@ -85,6 +87,17 @@ typedef struct NiagaraBoardState { #define NIAGARA_OBP_OFFSET 0x80000ULL #define PROM_SIZE_MAX (4 * 1024 * 1024) +static void add_rom_or_fail(const char *file, const hwaddr addr) +{ + /* XXX remove qtest_enabled() check once firmware files are + * in the qemu tree + */ + if (!qtest_enabled() && rom_add_file_fixed(file, addr, -1)) { + error_report("Unable to load a firmware for -M niagara"); + exit(1); + } + +} /* Niagara hardware initialisation */ static void niagara_init(MachineState *machine) { @@ -119,14 +132,13 @@ static void niagara_init(MachineState *machine) "sun4v.prom", PROM_SIZE_MAX); memory_region_add_subregion(sysmem, NIAGARA_PROM_BASE, &s->prom); - rom_add_file_fixed("nvram1", NIAGARA_NVRAM_BASE, -1); - rom_add_file_fixed("1up-md.bin", NIAGARA_MD_ROM_BASE, -1); - rom_add_file_fixed("1up-hv.bin", NIAGARA_HV_ROM_BASE, -1); + add_rom_or_fail("nvram1", NIAGARA_NVRAM_BASE); + add_rom_or_fail("1up-md.bin", NIAGARA_MD_ROM_BASE); + add_rom_or_fail("1up-hv.bin", NIAGARA_HV_ROM_BASE); - rom_add_file_fixed("reset.bin", NIAGARA_PROM_BASE, -1); - rom_add_file_fixed("q.bin", NIAGARA_PROM_BASE + NIAGARA_Q_OFFSET, -1); - rom_add_file_fixed("openboot.bin", NIAGARA_PROM_BASE + NIAGARA_OBP_OFFSET, - -1); + add_rom_or_fail("reset.bin", NIAGARA_PROM_BASE); + add_rom_or_fail("q.bin", NIAGARA_PROM_BASE + NIAGARA_Q_OFFSET); + add_rom_or_fail("openboot.bin", NIAGARA_PROM_BASE + NIAGARA_OBP_OFFSET); /* the virtual ramdisk is kind of initrd, but it resides outside of the partition RAM */