]> git.proxmox.com Git - mirror_qemu.git/commitdiff
cacheinfo: add i/d cache_linesize_log
authorEmilio G. Cota <cota@braap.org>
Mon, 10 Sep 2018 23:27:41 +0000 (19:27 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 2 Oct 2018 16:47:55 +0000 (18:47 +0200)
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>
include/qemu/osdep.h
util/cacheinfo.c

index a91068df0ef63cad3ecccd57294acd24e7f80efb..a746a5e53166c5aa2fac27ac9c360a09231175bd 100644 (file)
@@ -570,6 +570,8 @@ extern uintptr_t qemu_real_host_page_size;
 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;
 
 #endif
index db5172d07c7aa3536188ed4a4916931c86134aac..6c8fe797bfc6d8343650a4fa3f5ef009c1ac194d 100644 (file)
@@ -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);
 }