From patchwork Tue Jun 16 16:07:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 485079 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B2FBD1401B5 for ; Wed, 17 Jun 2015 02:09:05 +1000 (AEST) Received: from localhost ([::1]:41312 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4tQ5-0001Es-Om for incoming@patchwork.ozlabs.org; Tue, 16 Jun 2015 12:09:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4tPK-0000Ob-Ba for qemu-devel@nongnu.org; Tue, 16 Jun 2015 12:08:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4tPG-0001iK-70 for qemu-devel@nongnu.org; Tue, 16 Jun 2015 12:08:14 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:38062) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4tPG-0001i3-0f for qemu-devel@nongnu.org; Tue, 16 Jun 2015 12:08:10 -0400 Received: by wibdq8 with SMTP id dq8so24561124wib.1 for ; Tue, 16 Jun 2015 09:08:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=1ErT//BMz9cxD01acBBZdPES/MUE8ktHwGsGFokbarw=; b=FVuzvQBPMBWaOlo8eqKBcI0vV46dgOXWZpo3nEe9674ZRpXopvO2WTMG1ig131sBJK wuREUIWmysEa9iNmu8BHxPyUGJigHmxSC2R4TnZxdjzim4KL2r93js/Dh8Zc5FqCnlLk fhQKEF5GcFXI+iVqZ2YmWpbCGc19ViJMCW9gJmXIIcarlOM21iYqmvDWzjOREdaZ7vjk 26WA16Mw3bdzuNZ3ZRI1zuXZdURgsKgBEcO6zfeWq0JQ6HfxTsuONySlQwDJK1CA2CyE LL2ObYZwUFnpVZKQT2XB23xc4xb8/VOjKcfEFKjkIloPqSckIT6DUizektaqB1C6DX+E wCeA== X-Gm-Message-State: ALoCoQnA61h6Wg7crJI2BYI7Bfjhy1IcvrhGDIfi58TEEb4HnTOH7/wm+Y0sgrhqtzfAhpAo+ew7 X-Received: by 10.180.77.193 with SMTP id u1mr43809235wiw.50.1434470888499; Tue, 16 Jun 2015 09:08:08 -0700 (PDT) Received: from midway01-04-00.lavalab ([81.128.185.50]) by mx.google.com with ESMTPSA id m2sm21455281wiy.7.2015.06.16.09.08.07 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Jun 2015 09:08:07 -0700 (PDT) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, qemu-devel@nongnu.org, peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, pbonzini@redhat.com Date: Tue, 16 Jun 2015 17:07:54 +0100 Message-Id: <1434470874-22573-1-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.212.173 Cc: christoffer.dall@linaro.org, patches@linaro.org Subject: [Qemu-devel] [PATCH] vl: move rom_load_all after machine init done X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On ARM, commit ac9d32e39664e060cd1b538ff190980d57ad69e4 postponed the memory preparation for boot until the machine init done notifier. This has for consequence to insert ROM at machine init done time. However the rom_load_all function stayed called before the ROM are inserted. As a consequence the rom_load_all function does not do everything it is expected to do, on ARM. It currently registers the ROM reset notifier but does not iterate through the registered ROM list. the isrom field is not set properly. This latter is used to report info in the monitor and also to decide whether the rom->data can be freed on ROM reset notifier. To fix that regression the patch moves the rom_load_all call after machine init done. We also take the opportunity to rename the rom_load_all function into rom_check_and_resgister_reset() and integrate the rom_load_done in it. Signed-off-by: Eric Auger Reported-by: Peter Crosthwaite --- hw/core/loader.c | 8 ++------ include/hw/loader.h | 3 +-- vl.c | 11 ++++------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/hw/core/loader.c b/hw/core/loader.c index 7ee675c..216eeeb 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -933,7 +933,7 @@ static void rom_reset(void *unused) } } -int rom_load_all(void) +int rom_check_and_register_reset(void) { hwaddr addr = 0; MemoryRegionSection section; @@ -957,12 +957,8 @@ int rom_load_all(void) memory_region_unref(section.mr); } qemu_register_reset(rom_reset, NULL); - return 0; -} - -void rom_load_done(void) -{ roms_loaded = 1; + return 0; } void rom_set_fw(FWCfgState *f) diff --git a/include/hw/loader.h b/include/hw/loader.h index 485ff8f..f7b43ab 100644 --- a/include/hw/loader.h +++ b/include/hw/loader.h @@ -75,8 +75,7 @@ MemoryRegion *rom_add_blob(const char *name, const void *blob, size_t len, void *callback_opaque); int rom_add_elf_program(const char *name, void *data, size_t datasize, size_t romsize, hwaddr addr); -int rom_load_all(void); -void rom_load_done(void); +int rom_check_and_register_reset(void); void rom_set_fw(FWCfgState *f); int rom_copy(uint8_t *dest, hwaddr addr, size_t size); void *rom_ptr(hwaddr addr); diff --git a/vl.c b/vl.c index 9542095..4f12957 100644 --- a/vl.c +++ b/vl.c @@ -4419,18 +4419,15 @@ int main(int argc, char **argv, char **envp) qdev_machine_creation_done(); - if (rom_load_all() != 0) { - fprintf(stderr, "rom loading failed\n"); - exit(1); - } - /* TODO: once all bus devices are qdevified, this should be done * when bus is created by qdev.c */ qemu_register_reset(qbus_reset_all_fn, sysbus_get_default()); qemu_run_machine_init_done_notifiers(); - /* Done notifiers can load ROMs */ - rom_load_done(); + if (rom_check_and_register_reset() != 0) { + fprintf(stderr, "rom check and register reset failed\n"); + exit(1); + } qemu_system_reset(VMRESET_SILENT); if (loadvm) {