Re: [PATCH v2 01/20] hw/arm: aspeed: Store boot info in the machine state

Peter Maydell <[email protected]>
Newsgroups org.nongnu.qemu-arm,org.nongnu.qemu-devel
Message-ID <CAFEAcA9scKMTHfrGdYRY6i+2rtU26z8ObTx5fOC3iDbDdtpPdA@mail.gmail.com>
On Sun, 16 Aug 2026 at 15:54, Philippe Mathieu-Daudé
<[email protected]> wrote:
>
> On 16/8/26 15:12, Bin Meng wrote:
> > arm_load_kernel() keeps a pointer to the boot info struct for the
> > lifetime of the VM, so the struct logically belongs to the machine
> > rather than to a file scoped static object.
> >
> > Move the boot info into the existing AspeedMachineState.

> > -    aspeed_board_binfo.ram_size = machine->ram_size;
> > -    aspeed_board_binfo.loader_start = sc->memmap[ASPEED_DEV_SDRAM];
> > +    bmc->bootinfo.board_id = -1; /* device-tree-only board */
>
> Should #define a self-explanatory BOARD_ID_DEVICE_TREE?

> > @@ -42,6 +43,7 @@ struct AspeedMachineState {
> >       char *fmc_model;
> >       char *spi_model;
> >       uint32_t hw_strap1;
> > +    struct arm_boot_info bootinfo;
> >   };
>
> Maybe time to add a typedef to be style-consistent.

Mmm, and if we're adding a typedef then fixing the capitalization
style to ArmBootInfo is what matches our style guide.

I think these are both good ideas but in the interests of not
delaying this touch-lots-of-files patchset too much longer
I think we can do them as separate patches afterwards.

(Interestingly the kernel does not bother to define a
name for the -1 value -- it just hardcodes ~0 in its
DT_MACHINE_START macro.)

thanks
-- PMM
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.