From patchwork Tue Jul 7 14:12:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 50822 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AB90822A03 for ; Tue, 7 Jul 2015 14:32:29 +0000 (UTC) Received: by wgwk7 with SMTP id k7sf6471605wgw.0 for ; Tue, 07 Jul 2015 07:32:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=kqX73IRVA6/AbRoTZwp9b6CW90kHKQZCLdnQpMMfE8g=; b=R7gyffOrczKbXxxIIAreAeaCpmQde9UVDR8JG02Qc9BpcikoAB6Kh9EJl23opXQiKL U0LbrrfkkMzTWT7Rihb3XoeUDkGILK9ik7JxHvIs8DuJDD7pzNJcFPQE1CFCT2l8aF6J kAnAl5Id6aWfSCvGP5kgfcb+mPrc2mM4UnwCCaq4GgU1BSM6KqVhTN+exptFnTKzm+6Q c8wWLcOixWvGMlvgXZ/scCwReXEFi9VojL5m//pu9mRFIs6H+zWoNzjJzUUBZSmAjF1K MFRRHUaNPn4eVFp2pB4bpScl8NUeBB7EkeS+gsB0rhpV2CN0PXK5lqWYIoXMKptD8s8A taGw== X-Gm-Message-State: ALoCoQlltU8N1WfiLGhiNBwlznDpkdAnwcV232ecMhIKhvxEf53tNZxmvWttZ6nNBiKBT4jZG+R9 X-Received: by 10.152.22.163 with SMTP id e3mr2267937laf.6.1436279548940; Tue, 07 Jul 2015 07:32:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.71 with SMTP id la7ls767826lab.25.gmail; Tue, 07 Jul 2015 07:32:28 -0700 (PDT) X-Received: by 10.152.27.74 with SMTP id r10mr4386346lag.31.1436279548758; Tue, 07 Jul 2015 07:32:28 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id jc5si18263979lbc.127.2015.07.07.07.32.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jul 2015 07:32:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by laar3 with SMTP id r3so198395558laa.0 for ; Tue, 07 Jul 2015 07:32:28 -0700 (PDT) X-Received: by 10.152.18.162 with SMTP id x2mr4312603lad.73.1436279548621; Tue, 07 Jul 2015 07:32:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2431025lbb; Tue, 7 Jul 2015 07:32:27 -0700 (PDT) X-Received: by 10.70.65.99 with SMTP id w3mr9696061pds.132.1436279546712; Tue, 07 Jul 2015 07:32:26 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id y13si34999073pdi.119.2015.07.07.07.32.25 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 07 Jul 2015 07:32:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:58552 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCTv6-0002pm-PF for patch@linaro.org; Tue, 07 Jul 2015 10:32:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCTcJ-0007fh-Bn for qemu-devel@nongnu.org; Tue, 07 Jul 2015 10:13:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCTcC-0004IU-NG for qemu-devel@nongnu.org; Tue, 07 Jul 2015 10:12:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCTcC-0004II-Fn for qemu-devel@nongnu.org; Tue, 07 Jul 2015 10:12:52 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 233F536506A; Tue, 7 Jul 2015 14:12:52 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-27.ams2.redhat.com [10.36.112.27]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t67ECmAb021123; Tue, 7 Jul 2015 10:12:50 -0400 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 7 Jul 2015 16:12:37 +0200 Message-Id: <1436278368-13449-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1436278368-13449-1-git-send-email-pbonzini@redhat.com> References: <1436278368-13449-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Eric Auger Subject: [Qemu-devel] [PULL 01/12] 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pbonzini@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Eric Auger 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 Message-Id: <1434470874-22573-1-git-send-email-eric.auger@linaro.org> Signed-off-by: Paolo Bonzini --- 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 69ad90c..2991af6 100644 --- a/vl.c +++ b/vl.c @@ -4579,18 +4579,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) {