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: Auger Eric X-Patchwork-Id: 49964 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B8B71205DE for ; Tue, 16 Jun 2015 16:08:11 +0000 (UTC) Received: by laka10 with SMTP id a10sf5936187lak.2 for ; Tue, 16 Jun 2015 09:08:10 -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:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=1ErT//BMz9cxD01acBBZdPES/MUE8ktHwGsGFokbarw=; b=cMAJWAqpfeZMsqDfy/nc06eCJauGjwqaMtbAPjTe2RYKpepnfCBcWw2675EhXG2f/b vmmndbl3Z8lyxP7O6C/reC+mHyhH3+2D6VncRARXBVXDPw3FTEEcJ41UaFU8WsUK8FuU ToNdmQBDufr7hNyOkSPpg/66MQPWOk1XISRQGPZwZSOiJGphspKwe2LAPbQxQbkb1uOZ TentzHBvzHegTr0BS7TiEEiMI9IRuco8/qN6J+xzvXvngobGaiFxgio9N0uvMRwakX5X TeoXwtmMgIlieYu7iFDEndpdoeTi7Rl0CTcE9zYx4YHkFm3YhXZqLS9BfJCwEOG6E+ZD YKjg== X-Gm-Message-State: ALoCoQneOzEJAs3obP/5TajBkIjwD2NrsZsVPdlqa9nZhLWb01PWHBYIBKXKJDG8CcFnmwy6cYmz X-Received: by 10.112.122.13 with SMTP id lo13mr1014624lbb.5.1434470890334; Tue, 16 Jun 2015 09:08:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.40 with SMTP id v8ls138766laj.88.gmail; Tue, 16 Jun 2015 09:08:10 -0700 (PDT) X-Received: by 10.112.154.71 with SMTP id vm7mr2065938lbb.96.1434470890192; Tue, 16 Jun 2015 09:08:10 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id z9si1069850laj.152.2015.06.16.09.08.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jun 2015 09:08:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lblr1 with SMTP id r1so14173077lbl.0 for ; Tue, 16 Jun 2015 09:08:10 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr2071022lbc.19.1434470889845; Tue, 16 Jun 2015 09:08:09 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp2219124lbb; Tue, 16 Jun 2015 09:08:09 -0700 (PDT) X-Received: by 10.180.109.111 with SMTP id hr15mr8275193wib.53.1434470889175; Tue, 16 Jun 2015 09:08:09 -0700 (PDT) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com. [209.85.212.173]) by mx.google.com with ESMTPS id mi6si24861653wic.25.2015.06.16.09.08.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jun 2015 09:08:09 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.173 as permitted sender) client-ip=209.85.212.173; Received: by wibdq8 with SMTP id dq8so24561122wib.1 for ; Tue, 16 Jun 2015 09:08:08 -0700 (PDT) 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 Cc: christoffer.dall@linaro.org, patches@linaro.org Subject: [PATCH] vl: move rom_load_all after machine init done 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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) {