From: Emilio G. Cota Date: Mon, 10 Sep 2018 23:27:41 +0000 (-0400) Subject: cacheinfo: add i/d cache_linesize_log X-Git-Tag: v3.1.0-rc0~71^2~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fe21034292a2758639d6e66822a53770c7bcc0d;p=thirdparty%2Fqemu.git cacheinfo: add i/d cache_linesize_log Signed-off-by: Emilio G. Cota Message-Id: <20180910232752.31565-2-cota@braap.org> Signed-off-by: Paolo Bonzini --- diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index a91068df0ef..a746a5e5316 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -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 diff --git a/util/cacheinfo.c b/util/cacheinfo.c index db5172d07c7..6c8fe797bfc 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); }