qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for-7.2 v2 09/20] hw/ppc: set machine->fdt in pnv_reset()


From: David Gibson
Subject: Re: [PATCH for-7.2 v2 09/20] hw/ppc: set machine->fdt in pnv_reset()
Date: Mon, 8 Aug 2022 13:25:35 +1000

On Fri, Aug 05, 2022 at 09:31:11AM -0300, Daniel Henrique Barboza wrote:
> 
> 
> On 8/5/22 08:03, Frederic Barrat wrote:
> > 
> > 
> > On 05/08/2022 11:39, Daniel Henrique Barboza wrote:
> > > This will enable support for 'dumpdtb' and 'info fdt' HMP commands for
> > > all powernv machines.
> > > 
> > > Cc: Cédric Le Goater <clg@kaod.org>
> > > Cc: Frederic Barrat <fbarrat@linux.ibm.com>
> > > Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> > > ---
> > >   hw/ppc/pnv.c | 6 +++++-
> > >   1 file changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> > > index d3f77c8367..f5162f8b7b 100644
> > > --- a/hw/ppc/pnv.c
> > > +++ b/hw/ppc/pnv.c
> > > @@ -608,7 +608,11 @@ static void pnv_reset(MachineState *machine)
> > >       qemu_fdt_dumpdtb(fdt, fdt_totalsize(fdt));
> > >       cpu_physical_memory_write(PNV_FDT_ADDR, fdt, fdt_totalsize(fdt));
> > > -    g_free(fdt);
> > > +    /*
> > > +     * Update the machine->fdt pointer to enable support for
> > > +     * 'dumpdtb' and 'info fdt' commands.
> > > +     */
> > > +    machine->fdt = fdt;
> > 
> > 
> > Can pnv_reset() be called several times in the same instance of the qemu 
> > process, in which case we leak memory?
> 
> hmmm I think it's possible if we issue a 'system_reset' via the
> monitor.

Right.  I'm not certain about pnv, but on most platforms there's a way
to trigger system_reset from the guest side as well.

> I'll put a g_free(machine->fdt) before the assignment.
> 
> 
> Daniel
> 
> 
> > 
> >    Fred
> > 
> > 
> > >   }
> > >   static ISABus *pnv_chip_power8_isa_create(PnvChip *chip, Error **errp)
> 

-- 
David Gibson                    | 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

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]