On Mon, Jul 06, 2026 at 02:37:48PM +0530, Utkarsh Verma wrote: > +Thomas, Narayana, Shiva, Harsh - FYI > > Hi Alexey, David and Paolo, > Reviving this thread as would like to add the disk boot support by loading > GRUB. Good luck, but I'm afraid I no longer have any interest in, or time to commit to looking at ppc qemu stuff. > > On 2/1/20 7:09 PM, Alexey Kardashevskiy wrote: > > Hi! > > > > In my effort to "kill SLOF" (the PPC pseries guest firmware), I > > proceeded to the stage when QEMU needs to load GRUB from the disk. The > > current workaround is to read it from qcow2, save in a file and then > > call load_elf(). Not nice. > > > > 2 problems with that. > > > > 1. when load_elf calls address_space_write() - I need to know where and > > how much RAM was used to mark this memory "used" for the OF client > > interface (/memory@0/available FDT property). So I'll need "preload()" > > hook. > > > > 2. (bigger) GRUB comes from PReP partition which is 8MB. load_elf{32|64} > > consumes filename, not a memory pointer nor a "read_fn" callback - so I > > thought I need a "read_fn" callback. > > > > And then I discovered that load_elf actually maps the passed file. And > > here I got lost. > > > > Why does not load_elf just map the entire file and parse the bits? It > > still reads chunks with seek+read and then it maps the file in a loop > > potentially multiple times - is this even correct? Passing "fd" around > > is weird. > > > > Why ROMs are different from "-kernel"? > > > > If I want to solve 1 and 2 of my problem, should I just cut-n-paste > > load_elf and tweak bits rather then add more parameters to already > > 15-parameters long prototypes? > > Or I could read GRUB from qcow2 into the memory and change the rest to > > parse ELF from memory (mapped from a ELF file or read from qcow2)? > To rectify the mentioned issues, would like to implement a custom ELF loader > for ppc that can load the elf from the buffer and claim the memory for each > program header segment. > > It was attempted earlier in v6 (Patch 6/6) and v7 (Patch 5/5) , but later > dropped for reasons unknown to me: > v6: > https://lore.kernel.org/qemu-devel/20200203032943.121178-1-aik@ozlabs.ru/ > v7: https://lore.kernel.org/qemu-devel/20200220061622.15064-1-aik@ozlabs.ru/ > > I believe disk boot is a worthwhile addition to VOF. It would make the > pseries machine type fully usable without SLOF for the most common case: > booting from a distro qcow2 image with a PReP partition containing GRUB. > > > > > > > > > Thanks, > > > > ps. VW == very weird, indeed :) > > > > Regards, > Utkarsh Verma > -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson