Message ID | 20240209150039.22211-4-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | system/memory: Trivial fixes | expand |
On Fri, 9 Feb 2024 at 15:01, Philippe Mathieu-Daudé <philmd@linaro.org> wrote: > > So far there is only one system I/O and one system > memory per machine. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > system/physmem.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/system/physmem.c b/system/physmem.c > index 5e66d9ae36..50947a374e 100644 > --- a/system/physmem.c > +++ b/system/physmem.c > @@ -2554,12 +2554,13 @@ static void memory_map_init(void) > { > system_memory = g_malloc(sizeof(*system_memory)); > > - memory_region_init(system_memory, NULL, "system", UINT64_MAX); > + memory_region_init(system_memory, OBJECT(current_machine), > + "system", UINT64_MAX); > address_space_init(&address_space_memory, system_memory, "memory"); > > system_io = g_malloc(sizeof(*system_io)); > - memory_region_init_io(system_io, NULL, &unassigned_io_ops, NULL, "io", > - 65536); > + memory_region_init_io(system_io, OBJECT(current_machine), > + &unassigned_io_ops, NULL, "io", 65535); > address_space_init(&address_space_io, system_io, "I/O"); > } What's the intention in doing this? What does it change? It seems to be OK to pass a non-Device owner in for memory_region_init() (whereas it is *not* OK to do that for memory_region_init_ram()), but this seems to be getting a bit tricky. thanks -- PMM
(+Markus I forgot to Cc) On 9/2/24 17:06, Peter Maydell wrote: > On Fri, 9 Feb 2024 at 15:01, Philippe Mathieu-Daudé <philmd@linaro.org> wrote: >> >> So far there is only one system I/O and one system >> memory per machine. >> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >> --- >> system/physmem.c | 7 ++++--- >> 1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/system/physmem.c b/system/physmem.c >> index 5e66d9ae36..50947a374e 100644 >> --- a/system/physmem.c >> +++ b/system/physmem.c >> @@ -2554,12 +2554,13 @@ static void memory_map_init(void) >> { >> system_memory = g_malloc(sizeof(*system_memory)); >> >> - memory_region_init(system_memory, NULL, "system", UINT64_MAX); >> + memory_region_init(system_memory, OBJECT(current_machine), >> + "system", UINT64_MAX); >> address_space_init(&address_space_memory, system_memory, "memory"); >> >> system_io = g_malloc(sizeof(*system_io)); >> - memory_region_init_io(system_io, NULL, &unassigned_io_ops, NULL, "io", >> - 65536); >> + memory_region_init_io(system_io, OBJECT(current_machine), >> + &unassigned_io_ops, NULL, "io", 65535); >> address_space_init(&address_space_io, system_io, "I/O"); >> } > > What's the intention in doing this? What does it change? We want to remove access to pre-QOM and possibly hotplug QOM paths from external API (CLI & QMP so far). When the parent object is obvious and missing we simply have to explicit it. > It seems to be OK to pass a non-Device owner in for > memory_region_init() (whereas it is *not* OK to do that > for memory_region_init_ram()), but this seems to be > getting a bit tricky. Yes, memory_region_init_ram() is problematic; I'm hardly trying to ignore it at this point.
diff --git a/system/physmem.c b/system/physmem.c index 5e66d9ae36..50947a374e 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -2554,12 +2554,13 @@ static void memory_map_init(void) { system_memory = g_malloc(sizeof(*system_memory)); - memory_region_init(system_memory, NULL, "system", UINT64_MAX); + memory_region_init(system_memory, OBJECT(current_machine), + "system", UINT64_MAX); address_space_init(&address_space_memory, system_memory, "memory"); system_io = g_malloc(sizeof(*system_io)); - memory_region_init_io(system_io, NULL, &unassigned_io_ops, NULL, "io", - 65536); + memory_region_init_io(system_io, OBJECT(current_machine), + &unassigned_io_ops, NULL, "io", 65535); address_space_init(&address_space_io, system_io, "I/O"); }
So far there is only one system I/O and one system memory per machine. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- system/physmem.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)