Skip to contentSkip to conversation

exec: Header cleanups around memory.h/address-spaces.h

PATCH In review Philippe Mathieu-Daudé 2 participants 9 messages Jun 19, 2023 KVM

lore
Share & tools
lore
#0 lore raw

cover exec: Header cleanups around memory.h/address-spaces.h

Trivial header cleanups extracted from bigger series. Sending separately since somehow unrelated to its goal.

Philippe Mathieu-Daudé (4):
hw/net/i82596: Include missing 'exec/address-spaces.h' header hw/dma/etraxfs: Include missing 'exec/memory.h' header exec/address-spaces.h: Remove unuseful 'exec/memory.h' include sysemu/kvm: Re-include "exec/memattrs.h" header

 include/exec/address-spaces.h | 2 --
 include/sysemu/kvm.h          | 1 +
 hw/dma/etraxfs_dma.c          | 1 +
 hw/net/i82596.c               | 1 +
 4 files changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.38.1
#1 lore raw

PATCH 1/4 hw/net/i82596: Include missing 'exec/address-spaces.h' header

hw/net/i82596.c access the global 'address_space_memory' calling the ld/st_phys() API. address_space_memory is declared in "exec/address-spaces.h". Currently this header is indirectly pulled in via another header. Explicitly include it to avoid when refactoring unrelated headers:

hw/net/i82596.c:91:23: error: use of undeclared identifier 'address_space_memory'; did you mean 'address_space_destroy'?

    return ldub_phys(&address_space_memory, addr);
                      ^~~~~~~~~~~~~~~~~~~~
                      address_space_destroy
---
 hw/net/i82596.c | 1 +
 1 file changed, 1 insertion(+)
hw/net/i82596.c +1 -0
index ec21e2699a..9b9e3aa792 100644
@@ -15,6 +15,7 @@
 #include "hw/irq.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
+#include "exec/address-spaces.h"
 #include "qemu/module.h"
 #include "trace.h"
 #include "i82596.h"
Signature · 1 line
2.38.1
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] hw/net/i82596: Include missing 'exec/address-spaces.h' header

Quoted 11 lines · Philippe Mathieu-Daudé

hw/net/i82596.c access the global 'address_space_memory' calling the ld/st_phys() API. address_space_memory is declared in "exec/address-spaces.h". Currently this header is indirectly pulled in via another header. Explicitly include it to avoid when refactoring unrelated headers:

   hw/net/i82596.c:91:23: error: use of undeclared identifier 'address_space_memory'; did you mean 'address_space_destroy'?
     return ldub_phys(&address_space_memory, addr);
                       ^~~~~~~~~~~~~~~~~~~~
                       address_space_destroy
Quoted 4 lines
---
  hw/net/i82596.c | 1 +
  1 file changed, 1 insertion(+)

r~

#3 lore raw

PATCH 2/4 hw/dma/etraxfs: Include missing 'exec/memory.h' header

In reply to Philippe Mathieu-Daudé

The 'fs_dma_ctrl' structure has a MemoryRegion 'mmio' field which is initialized in etraxfs_dmac_init() calling memory_region_init_io() and memory_region_add_subregion().

These functions are declared in "exec/memory.h", along with the MemoryRegion structure. Include the missing header.

---
 hw/dma/etraxfs_dma.c | 1 +
 1 file changed, 1 insertion(+)
hw/dma/etraxfs_dma.c +1 -0
index a1068b19ea..9c0003de51 100644
@@ -28,6 +28,7 @@
 #include "qemu/main-loop.h"
 #include "sysemu/runstate.h"
 #include "exec/address-spaces.h"
+#include "exec/memory.h"
 
 #include "hw/cris/etraxfs_dma.h"
 
Signature · 1 line
2.38.1
Reviewed-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] hw/dma/etraxfs: Include missing 'exec/memory.h' header

Quoted 11 lines · Philippe Mathieu-Daudé

The 'fs_dma_ctrl' structure has a MemoryRegion 'mmio' field which is initialized in etraxfs_dmac_init() calling memory_region_init_io() and memory_region_add_subregion().

These functions are declared in "exec/memory.h", along with the MemoryRegion structure. Include the missing header.

---
  hw/dma/etraxfs_dma.c | 1 +
  1 file changed, 1 insertion(+)

r~

#5 lore raw

PATCH 3/4 exec/address-spaces.h: Remove unuseful 'exec/memory.h' include

In reply to Philippe Mathieu-Daudé

"exec/address-spaces.h" declares get_system_io() and get_system_memory(), both returning a MemoryRegion pointer. MemoryRegion is forward declared in "qemu/typedefs.h", so we don't need any declaration from "exec/memory.h" here. Remove it.

---
 include/exec/address-spaces.h | 2 --
 1 file changed, 2 deletions(-)
include/exec/address-spaces.h +0 -2
index db8bfa9a92..0d0aa61d68 100644
@@ -19,8 +19,6 @@
  * you're one of them.
  */
 
-#include "exec/memory.h"
-
 #ifndef CONFIG_USER_ONLY
 
 /* Get the root memory region.  This interface should only be used temporarily
Signature · 1 line
2.38.1
Reviewed-by on v1 3/4
#6 lore raw

Re: [PATCH 3/4] exec/address-spaces.h: Remove unuseful 'exec/memory.h' include

Quoted 10 lines · Philippe Mathieu-Daudé

"exec/address-spaces.h" declares get_system_io() and get_system_memory(), both returning a MemoryRegion pointer. MemoryRegion is forward declared in "qemu/typedefs.h", so we don't need any declaration from "exec/memory.h" here. Remove it.

---
  include/exec/address-spaces.h | 2 --
  1 file changed, 2 deletions(-)

r~

#7 lore raw

PATCH 4/4 sysemu/kvm: Re-include "exec/memattrs.h" header

In reply to Philippe Mathieu-Daudé

Commit 1e05888ab5 ("sysemu/kvm: Remove unused headers") was a bit overzealous while cleaning "sysemu/kvm.h" headers:
kvm_arch_post_run() returns a MemTxAttrs type, so depends on "exec/memattrs.h" for its definition.

Fixes 1e05888ab5 ("sysemu/kvm: Remove unused headers")
---
 include/sysemu/kvm.h | 1 +
 1 file changed, 1 insertion(+)
include/sysemu/kvm.h +1 -0
index 88f5ccfbce..528966b5a8 100644
@@ -14,6 +14,7 @@
 #ifndef QEMU_KVM_H
 #define QEMU_KVM_H
 
+#include "exec/memattrs.h"
 #include "qemu/accel.h"
 #include "qom/object.h"
 
Signature · 1 line
2.38.1
Reviewed-by on v1 4/4
#8 lore raw

Re: [PATCH 4/4] sysemu/kvm: Re-include "exec/memattrs.h" header

Quoted 10 lines · Philippe Mathieu-Daudé

Commit 1e05888ab5 ("sysemu/kvm: Remove unused headers") was a bit overzealous while cleaning "sysemu/kvm.h" headers:
kvm_arch_post_run() returns a MemTxAttrs type, so depends on "exec/memattrs.h" for its definition.

Fixes 1e05888ab5 ("sysemu/kvm: Remove unused headers")
---
  include/sysemu/kvm.h | 1 +
  1 file changed, 1 insertion(+)

r~