aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-09-20 13:58:04 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-09-20 13:58:04 +0100
commitf5c7af6295b18c9cb9bc183648ce37481b49f432 (patch)
tree3d9111bc513b26167b369a6acb349ad098ff55f1 /util
parentb53c54c63f04cc04cad4a31e72af7ed498bcb73d (diff)
parent754119198de633683d7af79bc08e73c2de9df011 (diff)
downloadqemu-f5c7af6295b18c9cb9bc183648ce37481b49f432.zip
qemu-f5c7af6295b18c9cb9bc183648ce37481b49f432.tar.gz
qemu-f5c7af6295b18c9cb9bc183648ce37481b49f432.tar.bz2
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into staging
Trivial patches 20190919 # gpg: Signature made Thu 19 Sep 2019 14:50:55 BST # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/trivial-branch-pull-request: configure: Add xkbcommon configure options kvm: Fix typo in header of kvm_device_access() Fix cacheline detection on FreeBSD/powerpc. build: Don't ignore qapi-visit-core.c target/m68k/fpu_helper.c: rename the access arguments Replace '-machine accel=xyz' with '-accel xyz' cutils: Move size_to_str() from "qemu-common.h" to "qemu/cutils.h" vfio: fix a typo Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util')
-rw-r--r--util/cacheinfo.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/util/cacheinfo.c b/util/cacheinfo.c
index eebe1ce..ea6f3e9 100644
--- a/util/cacheinfo.c
+++ b/util/cacheinfo.c
@@ -65,25 +65,28 @@ static void sys_cache_info(int *isize, int *dsize)
g_free(buf);
}
-#elif defined(__APPLE__) \
- || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#elif defined(__APPLE__)
# include <sys/sysctl.h>
-# if defined(__APPLE__)
-# define SYSCTL_CACHELINE_NAME "hw.cachelinesize"
-# else
-# define SYSCTL_CACHELINE_NAME "machdep.cacheline_size"
-# endif
-
static void sys_cache_info(int *isize, int *dsize)
{
/* There's only a single sysctl for both I/D cache line sizes. */
long size;
size_t len = sizeof(size);
- if (!sysctlbyname(SYSCTL_CACHELINE_NAME, &size, &len, NULL, 0)) {
+ if (!sysctlbyname("hw.cachelinesize", &size, &len, NULL, 0)) {
+ *isize = *dsize = size;
+ }
+}
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+# include <sys/sysctl.h>
+static void sys_cache_info(int *isize, int *dsize)
+{
+ /* There's only a single sysctl for both I/D cache line sizes. */
+ int size;
+ size_t len = sizeof(size);
+ if (!sysctlbyname("machdep.cacheline_size", &size, &len, NULL, 0)) {
*isize = *dsize = size;
}
}
-
#else
/* POSIX */