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"... thanks -- PMM