Skip to contentSkip to conversation

exec: Restrict memory-internal.h to system/

PATCH In review Philippe Mathieu-Daudé 4 participants 6 messages Mar 17, 2025

lore
Share & tools
lore
#0 lore raw

cover exec: Restrict memory-internal.h to system/

Only file units within the system/ directory need access to "memory-internal.h". Move it to system/ to restrict its scope.

Based-on: <[email protected]>

Philippe Mathieu-Daudé (2):
accel/tcg: Remove unnecesary inclusion of memory-internal.h in
cputlb.c
exec: Restrict memory-internal.h to system/

 MAINTAINERS                                | 2 +-
 {include/exec => system}/memory-internal.h | 6 ------
 accel/tcg/cputlb.c                         | 1 -
 system/memory.c                            | 3 ++-
 system/physmem.c                           | 3 ++-
 5 files changed, 5 insertions(+), 10 deletions(-)
 rename {include/exec => system}/memory-internal.h (88%)
Signature · 1 line
2.47.1
#1 lore raw

PATCH 1/2 accel/tcg: Remove unnecesary inclusion of memory-internal.h in cputlb.c

At some point cputlb.c stopped depending on the
"exec/memory-internal.h" header. Clean that now.

---
 accel/tcg/cputlb.c | 1 -
 1 file changed, 1 deletion(-)
accel/tcg/cputlb.c +0 -1
index fb22048876e..5007bdbcd75 100644
@@ -26,7 +26,6 @@
 #include "exec/cpu_ldst.h"
 #include "exec/cputlb.h"
 #include "exec/tb-flush.h"
-#include "exec/memory-internal.h"
 #include "exec/ram_addr.h"
 #include "exec/mmu-access-type.h"
 #include "exec/tlb-common.h"
Signature · 1 line
2.47.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] accel/tcg: Remove unnecesary inclusion of memory-internal.h in cputlb.c

Quoted 13 lines · Philippe Mathieu-Daudé

At some point cputlb.c stopped depending on the
"exec/memory-internal.h" header. Clean that now.

---
  accel/tcg/cputlb.c | 1 -
  1 file changed, 1 deletion(-)
accel/tcg/cputlb.c +0 -0
index fb22048876e..5007bdbcd75 100644

accel/tcg/cputlb.c line 31

Quoted 7 lines
accel/tcg/cputlb.c +0 -1
@@ -26,7 +26,6 @@
  #include "exec/cpu_ldst.h"
  #include "exec/cputlb.h"
  #include "exec/tb-flush.h"
-#include "exec/memory-internal.h"
  #include "exec/ram_addr.h"
  #include "exec/mmu-access-type.h"
  #include "exec/tlb-common.h"
#3 lore raw

PATCH 2/2 exec: Restrict memory-internal.h to system/

In reply to Philippe Mathieu-Daudé

Only file units within the system/ directory need access to "memory-internal.h". Restrict its scope by moving it there.

The comment from commit 9d70618c684 ("memory-internal.h:
Remove obsolete claim that header is obsolete") is now obsolete, remove it.

---
 MAINTAINERS                                | 2 +-
 {include/exec => system}/memory-internal.h | 6 ------
 system/memory.c                            | 3 ++-
 system/physmem.c                           | 3 ++-
 4 files changed, 5 insertions(+), 9 deletions(-)
 rename {include/exec => system}/memory-internal.h (88%)
MAINTAINERS +1 -1
index 8f470a1c9b7..b9f6c3cf15c 100644
@@ -3115,7 +3115,7 @@ F: system/ioport.c
 F: system/memory.c
 F: system/memory_mapping.c
 F: system/physmem.c
-F: include/exec/memory-internal.h
+F: system/memory-internal.h
 F: scripts/coccinelle/memory-region-housekeeping.cocci
 
 Memory devices
system/memory-internal.h renamed from include/exec/memory-internal.h +0 -6
similarity index 88%
rename from include/exec/memory-internal.h
rename to system/memory-internal.h
index c75178a3d6b..085e81a9fe4 100644
@@ -11,12 +11,6 @@
  *
  */
 
-/*
- * This header is for use by exec.c, memory.c and accel/tcg/cputlb.c ONLY,
- * for declarations which are shared between the memory subsystem's
- * internals and the TCG TLB code. Do not include it from elsewhere.
- */
-
 #ifndef MEMORY_INTERNAL_H
 #define MEMORY_INTERNAL_H
 
system/memory.c +2 -1
index eddd21a6cdb..f9b34cf4254 100644
@@ -25,7 +25,6 @@
 #include "qom/object.h"
 #include "trace.h"
 
-#include "exec/memory-internal.h"
 #include "exec/ram_addr.h"
 #include "system/kvm.h"
 #include "system/runstate.h"
@@ -35,6 +34,8 @@
 #include "migration/vmstate.h"
 #include "exec/address-spaces.h"
 
+#include "memory-internal.h"
+
 //#define DEBUG_UNASSIGNED
 
 static unsigned memory_region_transaction_depth;
system/physmem.c +2 -1
index e97de3ef65c..d4fbda9310d 100644
@@ -66,7 +66,6 @@
 #include "qemu/main-loop.h"
 #include "system/replay.h"
 
-#include "exec/memory-internal.h"
 #include "exec/ram_addr.h"
 
 #include "qemu/pmem.h"
@@ -88,6 +87,8 @@
 #include <daxctl/libdaxctl.h>
 #endif
 
+#include "memory-internal.h"
+
 //#define DEBUG_SUBPAGE
 
 /* ram_list is read under rcu_read_lock()/rcu_read_unlock().  Writes
Signature · 1 line
2.47.1
Reviewed-by on the v1 series
#5 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé

Only file units within the system/ directory need access to "memory-internal.h". Move it to system/ to restrict its scope.

Based-on: <[email protected]>

Philippe Mathieu-Daudé (2):
accel/tcg: Remove unnecesary inclusion of memory-internal.h in
cputlb.c
exec: Restrict memory-internal.h to system/

Quoted 8 lines
  MAINTAINERS                                | 2 +-
  {include/exec => system}/memory-internal.h | 6 ------
  accel/tcg/cputlb.c                         | 1 -
  system/memory.c                            | 3 ++-
  system/physmem.c                           | 3 ++-
  5 files changed, 5 insertions(+), 10 deletions(-)

rename {include/exec => system}/memory-internal.h (88%)

r~