diff mbox series

[34/37] include/system: Remove ifndef CONFIG_USER_ONLY

Message ID 20250313034524.3069690-35-richard.henderson@linaro.org
State New
Headers show
Series accel/tcg, codebase: Build once patches | expand

Commit Message

Richard Henderson March 13, 2025, 3:45 a.m. UTC
This is include/system, so CONFIG_USER_ONLY will never be true.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 include/system/cpu-timers.h | 2 +-
 include/system/qtest.h      | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

Comments

Philippe Mathieu-Daudé March 13, 2025, 10:18 a.m. UTC | #1
On 13/3/25 04:45, Richard Henderson wrote:
> This is include/system, so CONFIG_USER_ONLY will never be true.

Ideally yes. I started moving headers in include/system/ to clarify
APIs, but that doesn't mean some of these APIs aren't being
(incorrectly) used in user emulation.

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   include/system/cpu-timers.h | 2 +-
>   include/system/qtest.h      | 2 --
>   2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/system/cpu-timers.h b/include/system/cpu-timers.h
> index 64ae54f6d6..f10cb5e7d4 100644
> --- a/include/system/cpu-timers.h
> +++ b/include/system/cpu-timers.h
> @@ -30,7 +30,7 @@ typedef enum {
>       ICOUNT_ADAPTATIVE,
>   } ICountMode;
>   
> -#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
> +#ifdef CONFIG_TCG
>   extern ICountMode use_icount;
>   #define icount_enabled() (use_icount)
>   #else
 >   #define icount_enabled() ICOUNT_DISABLED
 >   #endif

For example accel/tcg/tcg-all.c include this header in user and
gets icount_enabled() = 0.

So first we'd need preparatory changes in to form of:

-- >8 --
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
index c1a30b01219..daa629e5b72 100644
--- a/accel/tcg/tcg-all.c
+++ b/accel/tcg/tcg-all.c
@@ -74,4 +74,7 @@ DECLARE_INSTANCE_CHECKER(TCGState, TCG_STATE,
  static bool default_mttcg_enabled(void)
  {
+#ifdef CONFIG_USER_ONLY
+    return false;
+#else
      if (icount_enabled()) {
          return false;
@@ -85,4 +88,5 @@ static bool default_mttcg_enabled(void)
      return false;
  #endif
+#endif
  }
---
diff mbox series

Patch

diff --git a/include/system/cpu-timers.h b/include/system/cpu-timers.h
index 64ae54f6d6..f10cb5e7d4 100644
--- a/include/system/cpu-timers.h
+++ b/include/system/cpu-timers.h
@@ -30,7 +30,7 @@  typedef enum {
     ICOUNT_ADAPTATIVE,
 } ICountMode;
 
-#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
+#ifdef CONFIG_TCG
 extern ICountMode use_icount;
 #define icount_enabled() (use_icount)
 #else
diff --git a/include/system/qtest.h b/include/system/qtest.h
index 6ddddc501b..84b1f8c6ee 100644
--- a/include/system/qtest.h
+++ b/include/system/qtest.h
@@ -23,7 +23,6 @@  static inline bool qtest_enabled(void)
     return qtest_allowed;
 }
 
-#ifndef CONFIG_USER_ONLY
 void G_GNUC_PRINTF(2, 3) qtest_sendf(CharBackend *chr, const char *fmt, ...);
 void qtest_set_command_cb(bool (*pc_cb)(CharBackend *chr, gchar **words));
 bool qtest_driver(void);
@@ -33,6 +32,5 @@  void qtest_server_init(const char *qtest_chrdev, const char *qtest_log, Error **
 void qtest_server_set_send_handler(void (*send)(void *, const char *),
                                  void *opaque);
 void qtest_server_inproc_recv(void *opaque, const char *buf);
-#endif
 
 #endif