Peter Maydell <peter.mayd...@linaro.org> writes:
> On Wed, 5 Jan 2022 at 21:05, Alex Bennée <alex.ben...@linaro.org> wrote: >> Can't be added as a subregion to the container... >> >> qemu-system-arm: ../../softmmu/memory.c:2538: >> memory_region_add_subregion_common: Assertion `!subregion->container' failed. > > This assert means you tried to add the same MemoryRegion > as a subregion of more than one parent MR. Right - that is probably something we should make (more?) explicitly clear in the Memory API docs. > You can either: > * pass all the CPUs the same container as their "memory" link, > if they all see the same view of the world This should be the case - I don't think the different cores have any particular different view of the world. The use of the two 4kb banks I think is purely convention. However trying for a single container shared between both cores fails because armv7m_realize adds it's board_memory to another container: memory_region_add_subregion_overlap(&s->container, 0, s->board_memory, -1); So I guess I just have to repeat the creation of the aliases for each core. This seems needlessly messy... > * if they have different views of the world, you need to > create a container for each CPU to be the "memory" link, > and to populate that container you need to create N-1 alias MRs > of the board_memory MR (CPU 0's container can use the original > board_memory MR; CPU 1, ... use the aliases). > > Example of option 1: virt board > Example of option 2: hw/arm/armsse.c (look at what it does with > the s->cpu_container[] and s->container_alias[] arrays) > > -- PMM -- Alex Bennée