aboutsummaryrefslogtreecommitdiff
path: root/util/cacheinfo.c
diff options
context:
space:
mode:
authorEmilio G. Cota <cota@braap.org>2018-09-10 19:27:41 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2018-10-02 18:47:55 +0200
commit5fe21034292a2758639d6e66822a53770c7bcc0d (patch)
tree106e7fde1b2b7b5ef1772c2b098008cb269fb6d3 /util/cacheinfo.c
parent87a09cdc529ddb5daa660e3c442b793032a2169d (diff)
cacheinfo: add i/d cache_linesize_log
Signed-off-by: Emilio G. Cota <cota@braap.org> Message-Id: <20180910232752.31565-2-cota@braap.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util/cacheinfo.c')
-rw-r--r--util/cacheinfo.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/cacheinfo.c b/util/cacheinfo.c
index db5172d07c..6c8fe797bf 100644
--- a/util/cacheinfo.c
+++ b/util/cacheinfo.c
@@ -7,9 +7,12 @@
*/
#include "qemu/osdep.h"
+#include "qemu/host-utils.h"
int qemu_icache_linesize = 0;
+int qemu_icache_linesize_log;
int qemu_dcache_linesize = 0;
+int qemu_dcache_linesize_log;
/*
* Operating system specific detection mechanisms.
@@ -172,6 +175,11 @@ static void __attribute__((constructor)) init_cache_info(void)
arch_cache_info(&isize, &dsize);
fallback_cache_info(&isize, &dsize);
+ assert((isize & (isize - 1)) == 0);
+ assert((dsize & (dsize - 1)) == 0);
+
qemu_icache_linesize = isize;
+ qemu_icache_linesize_log = ctz32(isize);
qemu_dcache_linesize = dsize;
+ qemu_dcache_linesize_log = ctz32(dsize);
}