From: Justin Hibbits <chmeeedalf@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org
Subject: [Qemu-devel] Fix cacheline size retrieval on FreeBSD/PowerPC(64)
Date: Fri, 7 Jun 2019 13:56:53 -0500 [thread overview]
Message-ID: <20190607135653.6ece685d@titan.knownspace> (raw)
[-- Attachment #1: Type: text/plain, Size: 139 bytes --]
The attached very trivial patch fixes a startup bug that prevents at
least Qemu 3.1 and later from working on FreeBSD/powerpc64.
- Justin
[-- Attachment #2: 0001-Fix-cacheline-detection-on-FreeBSD-powerpc.patch --]
[-- Type: text/x-patch, Size: 1089 bytes --]
From 74a70fdcfa5347e7637aa36276c55781f19de72a Mon Sep 17 00:00:00 2001
From: Justin Hibbits <chmeeedalf@gmail.com>
Date: Fri, 7 Jun 2019 13:44:51 -0500
Subject: [PATCH] Fix cacheline detection on FreeBSD/powerpc.
machdep.cacheline_size is an integer, not a long. Since PowerPC is
big-endian this causes sysctlbyname() to fill in the upper bits of the
argument, rather than the correct 'lower bits' of the word. Specify the
correct type to fix this.
Signed-off-by: Justin Hibbits <chmeeedalf@gmail.com>
---
util/cacheinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/cacheinfo.c b/util/cacheinfo.c
index eebe1ce9c5..516f837748 100644
--- a/util/cacheinfo.c
+++ b/util/cacheinfo.c
@@ -77,7 +77,7 @@ static void sys_cache_info(int *isize, int *dsize)
static void sys_cache_info(int *isize, int *dsize)
{
/* There's only a single sysctl for both I/D cache line sizes. */
- long size;
+ int size;
size_t len = sizeof(size);
if (!sysctlbyname(SYSCTL_CACHELINE_NAME, &size, &len, NULL, 0)) {
*isize = *dsize = size;
--
2.21.0
next reply other threads:[~2019-06-07 20:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-07 18:56 Justin Hibbits [this message]
2019-06-26 16:14 ` [Qemu-devel] [Qemu-trivial] Fix cacheline size retrieval on FreeBSD/PowerPC(64) Laurent Vivier
2019-06-26 16:16 ` Laurent Vivier
2019-06-26 16:37 ` Justin Hibbits
2019-06-26 16:47 ` Laurent Vivier
2019-06-26 18:04 ` Justin Hibbits
2019-06-27 0:02 ` Justin Hibbits
2019-06-27 0:08 ` Laurent Vivier
2019-06-27 0:15 ` Justin Hibbits
2019-07-01 8:54 ` Laurent Vivier
2019-07-01 13:02 ` Justin Hibbits
2019-07-01 13:17 ` Laurent Vivier
2019-07-02 22:11 ` Justin Hibbits
2019-07-01 14:08 ` Christophe de Dinechin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190607135653.6ece685d@titan.knownspace \
--to=chmeeedalf@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).