From patchwork Tue Jul 7 14:11:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 50821 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 498A822A03 for ; Tue, 7 Jul 2015 14:25:14 +0000 (UTC) Received: by laer2 with SMTP id r2sf57930478lae.3 for ; Tue, 07 Jul 2015 07:25:13 -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=XX0qX8FkrVs/iM/3R1OS++kVsrrcp0wPhLf93TxXyjIvly9ZuR4C0sFj+p2FubZxWZ rM8ImB5PlLaqLszM/byH6rt70CV9G0wK4cd7retFW0Omj4v6sGsgBa8+7B1c1QcVCPv4 bOcqtjcmSPXW/rtjBWgmFLBhBtngT+4YRqwAcVA5yGT79IWjkL3KdUFWlrV4Anl06Be6 KJhPN2YH+9i9DaJO9NUKy4qH9yimCFv8mzkn8h6EYtMTWpSfWDgPuEtZ2laCgqBIAKwV xIiQrfYVyHU+aHy0AkcMDrEK8XC8hOAs0K4LLNB9+6NghFqXceDbCSrnPwfs4X/xxfFM wLJw== X-Gm-Message-State: ALoCoQmguqga569KZ7bXS+I2sZe1hVtIQAwkY0w7L/jwK4Qt4rs0ft+MV2H8AQrTAbxiP+QyG48f X-Received: by 10.180.87.201 with SMTP id ba9mr18083785wib.3.1436279113260; Tue, 07 Jul 2015 07:25:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.99 with SMTP id bf3ls807583lab.21.gmail; Tue, 07 Jul 2015 07:25:13 -0700 (PDT) X-Received: by 10.152.1.66 with SMTP id 2mr2541420lak.56.1436279113028; Tue, 07 Jul 2015 07:25:13 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id jm1si18259268lbc.84.2015.07.07.07.25.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jul 2015 07:25:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by laar3 with SMTP id r3so198080234laa.0 for ; Tue, 07 Jul 2015 07:25:12 -0700 (PDT) X-Received: by 10.152.26.163 with SMTP id m3mr4306416lag.86.1436279112920; Tue, 07 Jul 2015 07:25:12 -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 hn6csp2426725lbb; Tue, 7 Jul 2015 07:25:11 -0700 (PDT) X-Received: by 10.68.78.36 with SMTP id y4mr9457570pbw.106.1436279109755; Tue, 07 Jul 2015 07:25:09 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id dv2si34843346pbc.200.2015.07.07.07.25.08 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 07 Jul 2015 07:25:09 -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]:58493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCTo3-0000CR-My for patch@linaro.org; Tue, 07 Jul 2015 10:25:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCTbK-0006e7-DZ for qemu-devel@nongnu.org; Tue, 07 Jul 2015 10:12:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCTbE-0003bJ-EM for qemu-devel@nongnu.org; Tue, 07 Jul 2015 10:11:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56164) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCTbE-0003ak-6U for qemu-devel@nongnu.org; Tue, 07 Jul 2015 10:11:52 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id E44A58F28F; Tue, 7 Jul 2015 14:11:51 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-27.ams2.redhat.com [10.36.112.27]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t67EBmqN026663; Tue, 7 Jul 2015 10:11:50 -0400 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 7 Jul 2015 16:11:42 +0200 Message-Id: <1436278308-12720-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1436278308-12720-1-git-send-email-pbonzini@redhat.com> References: <1436278308-12720-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 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 1/7] 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.49 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) {