qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Auger <eric.auger@linaro.org>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
	Peter Maydell <peter.maydell@linaro.org>
Cc: "Alexander Graf" <agraf@suse.de>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	"Shannon Zhao" <shannon.zhao@linaro.org>
Subject: Re: [Qemu-devel] [PULL 20/22] hw/arm/boot: arm_load_kernel implemented as a machine init done notifier
Date: Mon, 15 Jun 2015 15:34:58 +0200	[thread overview]
Message-ID: <557ED482.1020000@linaro.org> (raw)
In-Reply-To: <CAEgOgz6qbnEpx8b3ty0jhzxuFGU6yf3xoask7at8s1MLpLjMzQ@mail.gmail.com>

Hi Peter,
On 06/12/2015 08:04 PM, Peter Crosthwaite wrote:
> On Fri, Jun 12, 2015 at 3:04 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 12 June 2015 at 09:53, Eric Auger <eric.auger@linaro.org> wrote:
>>> On 06/12/2015 10:25 AM, Eric Auger wrote:
>>>>>  I think it is because this is now delaying
>>>>> arm_load_kernel_notify call until after rom_load_all. From vl.c:
>>>>>
>>>>>     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();
>>>>>
>>>>> the machine_init_done_notifiers are called after the rom_load_all()
>>>>> call which does the image loading.
>>>
>>> Isn't the actual rom loading done in a reset notifier? If confirmed the
>>> problem comes from the fact the order of registration of reset notifiers
>>> for rom_reset and do_cpu_reset has swapped?
>>
>> Yes, actual writing of rom data to ram happens in rom_reset_all().
>> This does seem to be called after arm_load_kernel_notify and
>> before do_cpu_reset, which is the order I would expect we require...
>>
> 
> So Eric's cpu reset re-ordering patch does fix it. But I thought we
> were trying to make reset ordering independent?
Thanks for testing & reporting.
> 
> I think the issue I describe above wrt rom_load_all is still real
> though, just with a more minor consequence. The notify patch is such
> that rom_load_all is now called before arm_load_kernel_notify. Looking
> at rom_load_all:
> 
> int rom_load_all(void)
> {
>     hwaddr addr = 0;
>     MemoryRegionSection section;
>     Rom *rom;
> 
>     QTAILQ_FOREACH(rom, &roms, next) {
>         if (rom->fw_file) {
>             continue;
>         }
>         if (addr > rom->addr) {
>             fprintf(stderr, "rom: requested regions overlap "
>                     "(rom %s. free=0x" TARGET_FMT_plx
>                     ", addr=0x" TARGET_FMT_plx ")\n",
>                     rom->name, addr, rom->addr);
>             return -1;
>         }
>         addr  = rom->addr;
>         addr += rom->romsize;
>         section = memory_region_find(get_system_memory(), rom->addr, 1);
>         rom->isrom = int128_nz(section.size) &&
> memory_region_is_rom(section.mr);
>         memory_region_unref(section.mr);
>     }
>     qemu_register_reset(rom_reset, NULL);
>     return 0;
> }
> 
> There is a list iterator over the ROM list doing some tweaking for the
> isrom field. This iteration process is now skipped for arm_load_kernel
> loading, as the rom_insert calls happen after the rom_load_all. Does
> this mean the arm_load_kernel no longer works on is_rom MRs?

OK I see your point. Do you think it could be acceptable to put
rom_load_all after machine init done, combined with rom_load_done, in
vl.c?

In practice, as far as I understand, rom_load_all does check whether
register ROM regions overlap and whether their associated MR is readonly
RAM. In the positive this isrom field is set.

If isrom is not correctly set this has for consequence:
- bad info reported about memory regions in monitor
- rom->data pointer not freed on rom_reset reset notifier.
As you I don't think such regressions are acceptable.
I did not see any other usage of isrom?

If the above is not sensible, due to other side effects I do not see,
the other way around to achieve my goal of building the dt at  machine
init done notifier time would be to only postpone the dtb creation and
not the whole ARM load kernel. But dtb also uses rom_add_blob_fixed and
adds a ROM region which would not be dealt with rom_load_all code.

Best Regards

Eric



> 
> Regards,
> Peter
> 
>> -- PMM
>>

  parent reply	other threads:[~2015-06-15 13:35 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02 16:33 [Qemu-devel] [PULL 00/22] target-arm queue Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 01/22] target-arm: Break down TLB_LOCKDOWN Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 02/22] target-arm: Add MAIR_EL2 Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 03/22] target-arm: Add TCR_EL2 Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 04/22] target-arm: Add SCTLR_EL2 Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 05/22] target-arm: Add TPIDR_EL2 Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 06/22] target-arm: Add TTBR0_EL2 Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 07/22] target-arm: Add TLBI_ALLE1{IS} Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 08/22] target-arm: Add TLBI_ALLE2 Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 09/22] target-arm: Add TLBI_VAE2{IS} Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 10/22] Revert "target-arm: Avoid g_hash_table_get_keys()" Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 11/22] target-arm: Add GIC phandle to VirtBoardInfo Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 12/22] arm_gicv2m: Add GICv2m widget to support MSIs Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 13/22] target-arm: Extend the gic node properties Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 14/22] target-arm: Add the GICv2m to the virt board Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 15/22] pl061: fix wrong calculation of GPIOMIS register Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 16/22] kvm: introduce kvm_arch_msi_data_to_gsi Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 17/22] arm_gicv2m: set kvm_gsi_direct_mapping and kvm_msi_via_irqfd_allowed Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 18/22] target-arm: Remove v8_ prefix from names of non-v8-specific cpreg arrays Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 19/22] hw/arm/sysbus-fdt: helpers for platform bus nodes addition Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 20/22] hw/arm/boot: arm_load_kernel implemented as a machine init done notifier Peter Maydell
2015-06-12  2:54   ` Peter Crosthwaite
2015-06-12  8:25     ` Eric Auger
2015-06-12  8:53       ` Eric Auger
2015-06-12 10:04         ` Peter Maydell
2015-06-12 18:04           ` Peter Crosthwaite
2015-06-12 18:06             ` Peter Maydell
2015-06-15 13:34             ` Eric Auger [this message]
2015-06-02 16:33 ` [Qemu-devel] [PULL 21/22] hw/arm/virt: add dynamic sysbus device support Peter Maydell
2015-06-02 16:33 ` [Qemu-devel] [PULL 22/22] hw/arm/virt: change indentation in a15memmap Peter Maydell
2015-06-04 10:44 ` [Qemu-devel] [PULL 00/22] target-arm queue Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=557ED482.1020000@linaro.org \
    --to=eric.auger@linaro.org \
    --cc=agraf@suse.de \
    --cc=alex.bennee@linaro.org \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhao@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).