[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-6.2 10/25] hw/arm: Don't allocate separate MemoryRegions
From: |
Peter Maydell |
Subject: |
Re: [PATCH for-6.2 10/25] hw/arm: Don't allocate separate MemoryRegions in stm32 SoC realize |
Date: |
Thu, 12 Aug 2021 13:27:20 +0100 |
On Thu, 12 Aug 2021 at 13:13, Alexandre IOOSS <erdnaxe@crans.org> wrote:
>
> On 8/12/21 11:33 AM, Peter Maydell wrote:
> > In the realize methods of the stm32f100 and stm32f205 SoC objects, we
> > call g_new() to create new MemoryRegion objjects for the sram, flash,
> > and flash_alias. This is unnecessary (and leaves open the
> > possibility of leaking the allocations if we exit from realize with
> > an error). Make these MemoryRegions member fields of the device
> > state struct instead, as stm32f405 already does.
>
> There is a typo in "objjects".
>
> This is something I had issue understanding as I was seeing both
> patterns in the codebase, thank you for making this clear.
Basically if there's a struct that the MemoryRegion can live
in then that's the best place for it. For some board-level code
where we haven't needed to subclass MachineState there is no
convenient struct, so we just g_new(). In a few places like this
one the board-code pattern has been copied into an SoC object.
-- PMM
- Re: [PATCH for-6.2 09/25] clock: Provide builtin multiplier/divider, (continued)
Re: [PATCH for-6.2 09/25] clock: Provide builtin multiplier/divider, Luc Michel, 2021/08/15
Re: [PATCH for-6.2 09/25] clock: Provide builtin multiplier/divider, Damien Hedde, 2021/08/17
[PATCH for-6.2 10/25] hw/arm: Don't allocate separate MemoryRegions in stm32 SoC realize, Peter Maydell, 2021/08/12
Re: [PATCH for-6.2 10/25] hw/arm: Don't allocate separate MemoryRegions in stm32 SoC realize, Alistair Francis, 2021/08/12
Re: [PATCH for-6.2 10/25] hw/arm: Don't allocate separate MemoryRegions in stm32 SoC realize, Luc Michel, 2021/08/17
[PATCH for-6.2 12/25] hw/arm/stm32f205: Wire up sysclk and refclk, Peter Maydell, 2021/08/12
[PATCH for-6.2 11/25] hw/arm/stm32f100: Wire up sysclk and refclk, Peter Maydell, 2021/08/12