diff mbox series

[RFC,18/34] accel/stubs: [CPUTLB] Move xen.h stubs to xen-stub.c

Message ID 20240119144024.14289-19-anjo@rev.ng (mailing list archive)
State New, archived
Headers show
Series Compile accel/tcg once (partially) | expand

Commit Message

Anton Johansson Jan. 19, 2024, 2:40 p.m. UTC
Makes xen.h header independent of softmmu target.  Note:
CONFIG_XEN_IS_POSSIBLE is only used define stubs in xen.h and optimize
xen_enabled().

Required by cpu_physical_memory_set_dirty_range() in ram_addr.h.

Signed-off-by: Anton Johansson <anjo@rev.ng>
---
 include/sysemu/xen.h   | 27 ---------------------------
 accel/stubs/xen-stub.c | 12 ++++++++++++
 2 files changed, 12 insertions(+), 27 deletions(-)

Comments

Richard Henderson Jan. 24, 2024, 1:04 a.m. UTC | #1
On 1/20/24 00:40, Anton Johansson wrote:
> --- a/accel/stubs/xen-stub.c
> +++ b/accel/stubs/xen-stub.c
> @@ -14,3 +14,15 @@ bool xen_allowed;
>   void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
>   {
>   }
> +
> +#ifndef CONFIG_USER_ONLY
> +void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length)

No need for ifdef here, since this file is in system_stubs_ss.

Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/include/sysemu/xen.h b/include/sysemu/xen.h
index bc13ad5692..838bb5a003 100644
--- a/include/sysemu/xen.h
+++ b/include/sysemu/xen.h
@@ -12,16 +12,6 @@ 
 
 #include "exec/cpu-common.h"
 
-#ifdef NEED_CPU_H
-# ifdef CONFIG_XEN
-#  define CONFIG_XEN_IS_POSSIBLE
-# endif
-#else
-# define CONFIG_XEN_IS_POSSIBLE
-#endif
-
-#ifdef CONFIG_XEN_IS_POSSIBLE
-
 extern bool xen_allowed;
 
 #define xen_enabled()           (xen_allowed)
@@ -32,21 +22,4 @@  void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
                    struct MemoryRegion *mr, Error **errp);
 #endif
 
-#else /* !CONFIG_XEN_IS_POSSIBLE */
-
-#define xen_enabled() 0
-#ifndef CONFIG_USER_ONLY
-static inline void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length)
-{
-    /* nothing */
-}
-static inline void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
-                                 MemoryRegion *mr, Error **errp)
-{
-    g_assert_not_reached();
-}
-#endif
-
-#endif /* CONFIG_XEN_IS_POSSIBLE */
-
 #endif
diff --git a/accel/stubs/xen-stub.c b/accel/stubs/xen-stub.c
index 7054965c48..73cfa2d291 100644
--- a/accel/stubs/xen-stub.c
+++ b/accel/stubs/xen-stub.c
@@ -14,3 +14,15 @@  bool xen_allowed;
 void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
 {
 }
+
+#ifndef CONFIG_USER_ONLY
+void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length)
+{
+    /* nothing */
+}
+void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
+                   MemoryRegion *mr, Error **errp)
+{
+    g_assert_not_reached();
+}
+#endif