diff mbox series

[14/24] exec: Declare tlb_init/destroy() in 'exec/cputlb.h'

Message ID 20241114011310.3615-15-philmd@linaro.org
State New
Headers show
Series exec: Build up 'cputlb.h' and 'ram_addr.h' headers | expand

Commit Message

Philippe Mathieu-Daudé Nov. 14, 2024, 1:12 a.m. UTC
Move CPU TLB related methods to "exec/cputlb.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/exec/cputlb.h   | 28 +++++++++++++++++++++++-----
 include/exec/exec-all.h | 17 -----------------
 accel/tcg/cpu-exec.c    |  1 +
 3 files changed, 24 insertions(+), 22 deletions(-)

Comments

Pierrick Bouvier Nov. 14, 2024, 4:13 a.m. UTC | #1
On 11/13/24 17:12, Philippe Mathieu-Daudé wrote:
> Move CPU TLB related methods to "exec/cputlb.h".
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/exec/cputlb.h   | 28 +++++++++++++++++++++++-----
>   include/exec/exec-all.h | 17 -----------------
>   accel/tcg/cpu-exec.c    |  1 +
>   3 files changed, 24 insertions(+), 22 deletions(-)
> 
> diff --git a/include/exec/cputlb.h b/include/exec/cputlb.h
> index 6cac7d530f..5386e53806 100644
> --- a/include/exec/cputlb.h
> +++ b/include/exec/cputlb.h
> @@ -22,15 +22,33 @@
>   
>   #include "exec/cpu-common.h"
>   
> -#ifdef CONFIG_TCG
> +#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
> +
> +/**
> + * tlb_init - initialize a CPU's TLB
> + * @cpu: CPU whose TLB should be initialized
> + */
> +void tlb_init(CPUState *cpu);
> +
> +/**
> + * tlb_destroy - destroy a CPU's TLB
> + * @cpu: CPU whose TLB should be destroyed
> + */
> +void tlb_destroy(CPUState *cpu);
>   
> -#if !defined(CONFIG_USER_ONLY)
> -/* cputlb.c */
>   void tlb_protect_code(ram_addr_t ram_addr);
>   void tlb_unprotect_code(ram_addr_t ram_addr);
> -#endif
>   
> -#endif /* CONFIG_TCG */
> +#else
> +
> +static inline void tlb_init(CPUState *cpu)
> +{
> +}
> +static inline void tlb_destroy(CPUState *cpu)
> +{
> +}
> +
> +#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
>   
>   #ifndef CONFIG_USER_ONLY
>   
> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
> index 2c06e54387..d792203773 100644
> --- a/include/exec/exec-all.h
> +++ b/include/exec/exec-all.h
> @@ -47,17 +47,6 @@ static inline bool cpu_loop_exit_requested(CPUState *cpu)
>   }
>   
>   #if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
> -/* cputlb.c */
> -/**
> - * tlb_init - initialize a CPU's TLB
> - * @cpu: CPU whose TLB should be initialized
> - */
> -void tlb_init(CPUState *cpu);
> -/**
> - * tlb_destroy - destroy a CPU's TLB
> - * @cpu: CPU whose TLB should be destroyed
> - */
> -void tlb_destroy(CPUState *cpu);
>   /**
>    * tlb_flush_page:
>    * @cpu: CPU whose TLB should be flushed
> @@ -242,12 +231,6 @@ void tlb_set_page(CPUState *cpu, vaddr addr,
>                     hwaddr paddr, int prot,
>                     int mmu_idx, vaddr size);
>   #else
> -static inline void tlb_init(CPUState *cpu)
> -{
> -}
> -static inline void tlb_destroy(CPUState *cpu)
> -{
> -}
>   static inline void tlb_flush_page(CPUState *cpu, vaddr addr)
>   {
>   }
> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index 8163295f34..8770493590 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -24,6 +24,7 @@
>   #include "hw/core/tcg-cpu-ops.h"
>   #include "trace.h"
>   #include "disas/disas.h"
> +#include "exec/cputlb.h"
>   #include "exec/exec-all.h"
>   #include "tcg/tcg.h"
>   #include "qemu/atomic.h"

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
diff mbox series

Patch

diff --git a/include/exec/cputlb.h b/include/exec/cputlb.h
index 6cac7d530f..5386e53806 100644
--- a/include/exec/cputlb.h
+++ b/include/exec/cputlb.h
@@ -22,15 +22,33 @@ 
 
 #include "exec/cpu-common.h"
 
-#ifdef CONFIG_TCG
+#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
+
+/**
+ * tlb_init - initialize a CPU's TLB
+ * @cpu: CPU whose TLB should be initialized
+ */
+void tlb_init(CPUState *cpu);
+
+/**
+ * tlb_destroy - destroy a CPU's TLB
+ * @cpu: CPU whose TLB should be destroyed
+ */
+void tlb_destroy(CPUState *cpu);
 
-#if !defined(CONFIG_USER_ONLY)
-/* cputlb.c */
 void tlb_protect_code(ram_addr_t ram_addr);
 void tlb_unprotect_code(ram_addr_t ram_addr);
-#endif
 
-#endif /* CONFIG_TCG */
+#else
+
+static inline void tlb_init(CPUState *cpu)
+{
+}
+static inline void tlb_destroy(CPUState *cpu)
+{
+}
+
+#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
 
 #ifndef CONFIG_USER_ONLY
 
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 2c06e54387..d792203773 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -47,17 +47,6 @@  static inline bool cpu_loop_exit_requested(CPUState *cpu)
 }
 
 #if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
-/* cputlb.c */
-/**
- * tlb_init - initialize a CPU's TLB
- * @cpu: CPU whose TLB should be initialized
- */
-void tlb_init(CPUState *cpu);
-/**
- * tlb_destroy - destroy a CPU's TLB
- * @cpu: CPU whose TLB should be destroyed
- */
-void tlb_destroy(CPUState *cpu);
 /**
  * tlb_flush_page:
  * @cpu: CPU whose TLB should be flushed
@@ -242,12 +231,6 @@  void tlb_set_page(CPUState *cpu, vaddr addr,
                   hwaddr paddr, int prot,
                   int mmu_idx, vaddr size);
 #else
-static inline void tlb_init(CPUState *cpu)
-{
-}
-static inline void tlb_destroy(CPUState *cpu)
-{
-}
 static inline void tlb_flush_page(CPUState *cpu, vaddr addr)
 {
 }
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 8163295f34..8770493590 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -24,6 +24,7 @@ 
 #include "hw/core/tcg-cpu-ops.h"
 #include "trace.h"
 #include "disas/disas.h"
+#include "exec/cputlb.h"
 #include "exec/exec-all.h"
 #include "tcg/tcg.h"
 #include "qemu/atomic.h"