Browse Source

include: Move qemu_[id]cache_* declarations to new qemu/cacheinfo.h

The qemu_icache_linesize, qemu_icache_linesize_log,
qemu_dcache_linesize, and qemu_dcache_linesize_log variables are not
used in many files.  Move them out of osdep.h to a new
qemu/cacheinfo.h, and document them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220208200856.3558249-5-peter.maydell@linaro.org
Peter Maydell 3 years ago
parent
commit
ad768e6f2a
9 changed files with 28 additions and 5 deletions
  1. 1 0
      accel/tcg/translate-all.c
  2. 21 0
      include/qemu/cacheinfo.h
  3. 0 5
      include/qemu/osdep.h
  4. 1 0
      plugins/loader.c
  5. 1 0
      tcg/region.c
  6. 1 0
      tcg/tcg.c
  7. 1 0
      util/atomic64.c
  8. 1 0
      util/cacheflush.c
  9. 1 0
      util/cacheinfo.c

+ 1 - 0
accel/tcg/translate-all.c

@@ -51,6 +51,7 @@
 #include "qemu/qemu-print.h"
 #include "qemu/qemu-print.h"
 #include "qemu/timer.h"
 #include "qemu/timer.h"
 #include "qemu/main-loop.h"
 #include "qemu/main-loop.h"
+#include "qemu/cacheinfo.h"
 #include "exec/log.h"
 #include "exec/log.h"
 #include "sysemu/cpus.h"
 #include "sysemu/cpus.h"
 #include "sysemu/cpu-timers.h"
 #include "sysemu/cpu-timers.h"

+ 21 - 0
include/qemu/cacheinfo.h

@@ -0,0 +1,21 @@
+/*
+ * QEMU host cacheinfo information
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef QEMU_CACHEINFO_H
+#define QEMU_CACHEINFO_H
+
+/*
+ * These variables represent our best guess at the host icache and
+ * dcache sizes, expressed both as the size in bytes and as the
+ * base-2 log of the size in bytes. They are initialized at startup
+ * (via an attribute 'constructor' function).
+ */
+extern int qemu_icache_linesize;
+extern int qemu_icache_linesize_log;
+extern int qemu_dcache_linesize;
+extern int qemu_dcache_linesize_log;
+
+#endif

+ 0 - 5
include/qemu/osdep.h

@@ -616,11 +616,6 @@ pid_t qemu_fork(Error **errp);
 extern uintptr_t qemu_real_host_page_size;
 extern uintptr_t qemu_real_host_page_size;
 extern intptr_t qemu_real_host_page_mask;
 extern intptr_t qemu_real_host_page_mask;
 
 
-extern int qemu_icache_linesize;
-extern int qemu_icache_linesize_log;
-extern int qemu_dcache_linesize;
-extern int qemu_dcache_linesize_log;
-
 /*
 /*
  * After using getopt or getopt_long, if you need to parse another set
  * After using getopt or getopt_long, if you need to parse another set
  * of options, then you must reset optind.  Unfortunately the way to
  * of options, then you must reset optind.  Unfortunately the way to

+ 1 - 0
plugins/loader.c

@@ -24,6 +24,7 @@
 #include "qemu/rcu_queue.h"
 #include "qemu/rcu_queue.h"
 #include "qemu/qht.h"
 #include "qemu/qht.h"
 #include "qemu/bitmap.h"
 #include "qemu/bitmap.h"
+#include "qemu/cacheinfo.h"
 #include "qemu/xxhash.h"
 #include "qemu/xxhash.h"
 #include "qemu/plugin.h"
 #include "qemu/plugin.h"
 #include "hw/core/cpu.h"
 #include "hw/core/cpu.h"

+ 1 - 0
tcg/region.c

@@ -26,6 +26,7 @@
 #include "qemu/units.h"
 #include "qemu/units.h"
 #include "qemu/madvise.h"
 #include "qemu/madvise.h"
 #include "qemu/mprotect.h"
 #include "qemu/mprotect.h"
+#include "qemu/cacheinfo.h"
 #include "qapi/error.h"
 #include "qapi/error.h"
 #include "exec/exec-all.h"
 #include "exec/exec-all.h"
 #include "tcg/tcg.h"
 #include "tcg/tcg.h"

+ 1 - 0
tcg/tcg.c

@@ -36,6 +36,7 @@
 #include "qemu/qemu-print.h"
 #include "qemu/qemu-print.h"
 #include "qemu/timer.h"
 #include "qemu/timer.h"
 #include "qemu/cacheflush.h"
 #include "qemu/cacheflush.h"
+#include "qemu/cacheinfo.h"
 
 
 /* Note: the long term plan is to reduce the dependencies on the QEMU
 /* Note: the long term plan is to reduce the dependencies on the QEMU
    CPU definitions. Currently they are used for qemu_ld/st
    CPU definitions. Currently they are used for qemu_ld/st

+ 1 - 0
util/atomic64.c

@@ -7,6 +7,7 @@
 #include "qemu/osdep.h"
 #include "qemu/osdep.h"
 #include "qemu/atomic.h"
 #include "qemu/atomic.h"
 #include "qemu/thread.h"
 #include "qemu/thread.h"
+#include "qemu/cacheinfo.h"
 
 
 #ifdef CONFIG_ATOMIC64
 #ifdef CONFIG_ATOMIC64
 #error This file must only be compiled if !CONFIG_ATOMIC64
 #error This file must only be compiled if !CONFIG_ATOMIC64

+ 1 - 0
util/cacheflush.c

@@ -7,6 +7,7 @@
 
 
 #include "qemu/osdep.h"
 #include "qemu/osdep.h"
 #include "qemu/cacheflush.h"
 #include "qemu/cacheflush.h"
+#include "qemu/cacheinfo.h"
 #include "qemu/bitops.h"
 #include "qemu/bitops.h"
 
 
 
 

+ 1 - 0
util/cacheinfo.c

@@ -9,6 +9,7 @@
 #include "qemu/osdep.h"
 #include "qemu/osdep.h"
 #include "qemu/host-utils.h"
 #include "qemu/host-utils.h"
 #include "qemu/atomic.h"
 #include "qemu/atomic.h"
+#include "qemu/cacheinfo.h"
 
 
 int qemu_icache_linesize = 0;
 int qemu_icache_linesize = 0;
 int qemu_icache_linesize_log;
 int qemu_icache_linesize_log;