qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] system/memory: Trivial fixes
@ 2024-02-09 15:00 Philippe Mathieu-Daudé
  2024-02-09 15:00 ` [PATCH 1/3] cpu-target: Include missing 'exec/memory.h' header Philippe Mathieu-Daudé
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-09 15:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael Tokarev, Peter Xu, Paolo Bonzini,
	Philippe Mathieu-Daudé, qemu-trivial, Dr. David Alan Gilbert,
	Richard Henderson, Laurent Vivier, David Hildenbrand

- Include missing "exec/memory.h"
- Set machine as parent of io/mem regions

Philippe Mathieu-Daudé (3):
  cpu-target: Include missing 'exec/memory.h' header
  monitor/target: Include missing 'exec/memory.h' header
  system/physmem: Assign global system I/O Memory to machine

 cpu-target.c              | 1 +
 monitor/hmp-cmds-target.c | 1 +
 system/physmem.c          | 7 ++++---
 3 files changed, 6 insertions(+), 3 deletions(-)

-- 
2.41.0



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] cpu-target: Include missing 'exec/memory.h' header
  2024-02-09 15:00 [PATCH 0/3] system/memory: Trivial fixes Philippe Mathieu-Daudé
@ 2024-02-09 15:00 ` Philippe Mathieu-Daudé
  2024-02-09 16:01   ` Peter Maydell
  2024-02-09 15:00 ` [PATCH 2/3] monitor/target: " Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-09 15:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael Tokarev, Peter Xu, Paolo Bonzini,
	Philippe Mathieu-Daudé, qemu-trivial, Dr. David Alan Gilbert,
	Richard Henderson, Laurent Vivier, David Hildenbrand

Include "exec/memory.h" in order to avoid:

  cpu-target.c:201:50: error: use of undeclared identifier 'TYPE_MEMORY_REGION'
      DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION,
                                                   ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 cpu-target.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cpu-target.c b/cpu-target.c
index 958d63e882..86444cc2c6 100644
--- a/cpu-target.c
+++ b/cpu-target.c
@@ -31,6 +31,7 @@
 #else
 #include "hw/core/sysemu-cpu-ops.h"
 #include "exec/address-spaces.h"
+#include "exec/memory.h"
 #endif
 #include "sysemu/cpus.h"
 #include "sysemu/tcg.h"
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] monitor/target: Include missing 'exec/memory.h' header
  2024-02-09 15:00 [PATCH 0/3] system/memory: Trivial fixes Philippe Mathieu-Daudé
  2024-02-09 15:00 ` [PATCH 1/3] cpu-target: Include missing 'exec/memory.h' header Philippe Mathieu-Daudé
@ 2024-02-09 15:00 ` Philippe Mathieu-Daudé
  2024-02-09 16:01   ` Peter Maydell
  2024-02-09 15:00 ` [PATCH 3/3] system/physmem: Assign global system I/O Memory to machine Philippe Mathieu-Daudé
  2024-02-09 21:33 ` [PATCH 0/3] system/memory: Trivial fixes Michael Tokarev
  3 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-09 15:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael Tokarev, Peter Xu, Paolo Bonzini,
	Philippe Mathieu-Daudé, qemu-trivial, Dr. David Alan Gilbert,
	Richard Henderson, Laurent Vivier, David Hildenbrand

Include "exec/memory.h" in order to avoid:

  monitor/hmp-cmds-target.c:263:10: error: call to undeclared function 'memory_region_is_ram';
  ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      if (!memory_region_is_ram(mrs.mr) && !memory_region_is_romd(mrs.mr)) {
           ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 monitor/hmp-cmds-target.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/monitor/hmp-cmds-target.c b/monitor/hmp-cmds-target.c
index d9fbcac08d..9338ae8440 100644
--- a/monitor/hmp-cmds-target.c
+++ b/monitor/hmp-cmds-target.c
@@ -25,6 +25,7 @@
 #include "qemu/osdep.h"
 #include "disas/disas.h"
 #include "exec/address-spaces.h"
+#include "exec/memory.h"
 #include "monitor/hmp-target.h"
 #include "monitor/monitor-internal.h"
 #include "qapi/error.h"
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] system/physmem: Assign global system I/O Memory to machine
  2024-02-09 15:00 [PATCH 0/3] system/memory: Trivial fixes Philippe Mathieu-Daudé
  2024-02-09 15:00 ` [PATCH 1/3] cpu-target: Include missing 'exec/memory.h' header Philippe Mathieu-Daudé
  2024-02-09 15:00 ` [PATCH 2/3] monitor/target: " Philippe Mathieu-Daudé
@ 2024-02-09 15:00 ` Philippe Mathieu-Daudé
  2024-02-09 16:06   ` Peter Maydell
  2024-02-09 21:33 ` [PATCH 0/3] system/memory: Trivial fixes Michael Tokarev
  3 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-09 15:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael Tokarev, Peter Xu, Paolo Bonzini,
	Philippe Mathieu-Daudé, qemu-trivial, Dr. David Alan Gilbert,
	Richard Henderson, Laurent Vivier, David Hildenbrand

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");
 }
 
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] cpu-target: Include missing 'exec/memory.h' header
  2024-02-09 15:00 ` [PATCH 1/3] cpu-target: Include missing 'exec/memory.h' header Philippe Mathieu-Daudé
@ 2024-02-09 16:01   ` Peter Maydell
  2024-02-09 16:31     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Maydell @ 2024-02-09 16:01 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Michael Tokarev, Peter Xu, Paolo Bonzini,
	qemu-trivial, Dr. David Alan Gilbert, Richard Henderson,
	Laurent Vivier, David Hildenbrand

On Fri, 9 Feb 2024 at 15:01, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Include "exec/memory.h" in order to avoid:
>
>   cpu-target.c:201:50: error: use of undeclared identifier 'TYPE_MEMORY_REGION'
>       DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION,
>                                                    ^

Given that we don't actually see this error, presumably
we're implicitly dragging it in via some other include?
Anyway, better to be explicit than implicit, so

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] monitor/target: Include missing 'exec/memory.h' header
  2024-02-09 15:00 ` [PATCH 2/3] monitor/target: " Philippe Mathieu-Daudé
@ 2024-02-09 16:01   ` Peter Maydell
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2024-02-09 16:01 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Michael Tokarev, Peter Xu, Paolo Bonzini,
	qemu-trivial, Dr. David Alan Gilbert, Richard Henderson,
	Laurent Vivier, David Hildenbrand

On Fri, 9 Feb 2024 at 15:02, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Include "exec/memory.h" in order to avoid:
>
>   monitor/hmp-cmds-target.c:263:10: error: call to undeclared function 'memory_region_is_ram';
>   ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>       if (!memory_region_is_ram(mrs.mr) && !memory_region_is_romd(mrs.mr)) {
>            ^
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  monitor/hmp-cmds-target.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/monitor/hmp-cmds-target.c b/monitor/hmp-cmds-target.c
> index d9fbcac08d..9338ae8440 100644
> --- a/monitor/hmp-cmds-target.c
> +++ b/monitor/hmp-cmds-target.c
> @@ -25,6 +25,7 @@
>  #include "qemu/osdep.h"
>  #include "disas/disas.h"
>  #include "exec/address-spaces.h"
> +#include "exec/memory.h"
>  #include "monitor/hmp-target.h"
>  #include "monitor/monitor-internal.h"
>  #include "qapi/error.h"
> --
> 2.41.0

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] system/physmem: Assign global system I/O Memory to machine
  2024-02-09 15:00 ` [PATCH 3/3] system/physmem: Assign global system I/O Memory to machine Philippe Mathieu-Daudé
@ 2024-02-09 16:06   ` Peter Maydell
  2024-02-09 16:41     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Maydell @ 2024-02-09 16:06 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Michael Tokarev, Peter Xu, Paolo Bonzini,
	qemu-trivial, Dr. David Alan Gilbert, Richard Henderson,
	Laurent Vivier, David Hildenbrand

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] cpu-target: Include missing 'exec/memory.h' header
  2024-02-09 16:01   ` Peter Maydell
@ 2024-02-09 16:31     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-09 16:31 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-devel, Michael Tokarev, Peter Xu, Paolo Bonzini,
	qemu-trivial, Dr. David Alan Gilbert, Richard Henderson,
	Laurent Vivier, David Hildenbrand

On 9/2/24 17:01, Peter Maydell wrote:
> On Fri, 9 Feb 2024 at 15:01, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> Include "exec/memory.h" in order to avoid:
>>
>>    cpu-target.c:201:50: error: use of undeclared identifier 'TYPE_MEMORY_REGION'
>>        DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION,
>>                                                     ^
> 
> Given that we don't actually see this error, presumably
> we're implicitly dragging it in via some other include?

It is pulled in by the exec/cpu-all.h header which I'm trying to
sanitize (along with others). I'll add a note about this.

> Anyway, better to be explicit than implicit, so
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Thanks!



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] system/physmem: Assign global system I/O Memory to machine
  2024-02-09 16:06   ` Peter Maydell
@ 2024-02-09 16:41     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-02-09 16:41 UTC (permalink / raw)
  To: Peter Maydell, Markus Armbruster
  Cc: qemu-devel, Michael Tokarev, Peter Xu, Paolo Bonzini,
	qemu-trivial, Dr. David Alan Gilbert, Richard Henderson,
	Laurent Vivier, David Hildenbrand

(+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.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] system/memory: Trivial fixes
  2024-02-09 15:00 [PATCH 0/3] system/memory: Trivial fixes Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2024-02-09 15:00 ` [PATCH 3/3] system/physmem: Assign global system I/O Memory to machine Philippe Mathieu-Daudé
@ 2024-02-09 21:33 ` Michael Tokarev
  3 siblings, 0 replies; 10+ messages in thread
From: Michael Tokarev @ 2024-02-09 21:33 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Xu, Paolo Bonzini, qemu-trivial, Dr. David Alan Gilbert,
	Richard Henderson, Laurent Vivier, David Hildenbrand

09.02.2024 18:00, Philippe Mathieu-Daudé :
> - Include missing "exec/memory.h"
> - Set machine as parent of io/mem regions
> 
> Philippe Mathieu-Daudé (3):
>    cpu-target: Include missing 'exec/memory.h' header
>    monitor/target: Include missing 'exec/memory.h' header
>    system/physmem: Assign global system I/O Memory to machine

Picked up patches 1 & 2, but not 3 yet.

/mjt

>   cpu-target.c              | 1 +
>   monitor/hmp-cmds-target.c | 1 +
>   system/physmem.c          | 7 ++++---
>   3 files changed, 6 insertions(+), 3 deletions(-)
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-02-09 21:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-09 15:00 [PATCH 0/3] system/memory: Trivial fixes Philippe Mathieu-Daudé
2024-02-09 15:00 ` [PATCH 1/3] cpu-target: Include missing 'exec/memory.h' header Philippe Mathieu-Daudé
2024-02-09 16:01   ` Peter Maydell
2024-02-09 16:31     ` Philippe Mathieu-Daudé
2024-02-09 15:00 ` [PATCH 2/3] monitor/target: " Philippe Mathieu-Daudé
2024-02-09 16:01   ` Peter Maydell
2024-02-09 15:00 ` [PATCH 3/3] system/physmem: Assign global system I/O Memory to machine Philippe Mathieu-Daudé
2024-02-09 16:06   ` Peter Maydell
2024-02-09 16:41     ` Philippe Mathieu-Daudé
2024-02-09 21:33 ` [PATCH 0/3] system/memory: Trivial fixes Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).