----- Am 30. Sep 2024 um 17:16 schrieb Peter Maydell peter.mayd...@linaro.org:
> On Mon, 23 Sept 2024 at 04:57, Sebastian Huber > <sebastian.hu...@embedded-brains.de> wrote: >> >> In arm_load_kernel(), use the secondary boot hooks provided by the >> platform if PSCI is disabled also while booting a non-Linux kernel. >> While booting Linux with PSCI disabled, provide default hooks if needed. >> >> In do_cpu_reset(), use the secondary CPU reset hook provided by the >> platform for resetting a non-Linux kernel. >> >> This change allows a more accurate simulation of the platform reset >> behaviour. > > So, the difficulty with this is that it's effectively > introducing an extra way of booting. At the moment we > have two boot approaches for Arm guests: > > (1) Booting Linux -- the boot.c code simulates what the BIOS, > boot rom etc, does, both to set up the 1st CPU for the kernel > boot entry, and to set up the secondaries in whatever way > the bootrom does that the kernel expects to release them from. > > (2) Booting bare-metal -- boot.c assumes the guest code is going > to do whatever the BIOS/bootrom does, so you get what you get > for real-hardware CPU reset. (Either the secondaries start > in power-off state and the primary will release them via some > kind of power controller device, or else all the CPUs start at > once at the reset vector and the bootrom is going to sort the > secondaries out and put them in a pen.) > > What you want is a third thing: > > (3) Booting not-a-kernel but not 100% bare-metal: emulate what > the bootrom does for primary and secondary CPUs but don't > boot the guest binary as if it was a Linux kernel. > > The problem with adding that is that we don't have any > way to distinguish whether the user wanted that or our > existing type (2), because both are "user gave us a binary > that isn't a Linux kernel". (It also has a bit of a > "continuously expanding job" problem because the bootrom > could do arbitrarily complicated things, like boot directly > from SD cards, which we have historically not wanted to > emulate within QEMU itself.) > > There are other platforms where the real hardware's bootrom > has a particular "this is what a bare-metal-under-the-bootrom > startup looks like" definition, notably the raspberry pi > boards. There too we don't currently implement that, and > instead effectively tell users "pick one of the two boot > paradigms we do support"... Ok, I understand your concerns. What I would like to do is running unmodified executables on Qemu so that I can test exactly the same program which would run on the real hardware. To properly initialize an SMP system, you have to do certain things in a proper order. Currently, when I start the Zynq machine it immediately executes the ELF entry on both cores. This conflicts with the normal system start sequence which assumes that initially the second core waits in an idle loop. For example, the second core is normally released after the GIC distributor is initialized. Changing all the existing machines to use this third way is probably a bad idea, but would it be possible to make it configurable though the platform info or a command line option? -- embedded brains GmbH & Co. KG Herr Sebastian HUBER Dornierstr. 4 82178 Puchheim Germany email: sebastian.hu...@embedded-brains.de phone: +49-89-18 94 741 - 16 fax: +49-89-18 94 741 - 08 Registergericht: Amtsgericht München Registernummer: HRB 157899 Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler Unsere Datenschutzerklärung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/