All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Martin Ijewski <gm.ijewski@web.de>
To: "Emilio G. Cota" <cota@braap.org>
Cc: "Richard Henderson" <rth@twiddle.net>,
	"Pranith Kumar" <bobby.prani@gmail.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 1/3] compiler: define QEMU_CACHELINE_SIZE
Date: Wed, 7 Jun 2017 00:01:49 +0200	[thread overview]
Message-ID: <215e328d-d350-f7b8-772f-065a329142f9@web.de> (raw)
In-Reply-To: <20170606213808.GA23654@flamenco>

Am 06.06.2017 um 23:38 schrieb Emilio G. Cota:
 > On Tue, Jun 06, 2017 at 22:28:23 +0200, Geert Martin Ijewski wrote:
 >> On a fully patched Windows 10 with an i5-4690 this code works for me 
(TM):
 >
 > Thanks!
 > Can you please test this?
 >
 > 		Emilio
 > ---
 > #include "qemu/osdep.h"
 > #include <windows.h>

unnecassary as it's already included by qemu/osdep.h -> sysemu/os-win32.h
 >
 > static unsigned int linesize_win(PROCESSOR_CACHE_TYPE type)
 > {
 >      PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buf;
 >      DWORD size = 0;
 >      unsigned int ret = 0;
 >      BOOL success;
 >      size_t n;
 >      size_t i;
 >
 >      success = GetLogicalProcessorInformation(0, &size);
 >      if (success || GetLastError() != ERROR_INSUFFICIENT_BUF) {
 >          return 0;
 >      }
 >      buf = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION)g_malloc0(size);
 >      if (!GetLogicalProcessorInformation(buf, &size)) {
 >          goto out;
 >      }
 >
 >      n = size / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);
 >      for (i = 0; i < n; i++) {
 >          if (buf[i].Relationship == RelationCache &&
 >              buf[i].Cache.Level == 1 &&
 >              (buf[i].Cache.Type == CacheUnified ||
 >               buf[i].Cache.Type == type)) {
 >              ret = buf[i].Cache.LineSize;
 >              break;
 >          }
 >      }
 >   out:
 >      g_free(buf);
 >      return ret;
 > }
 >
 > linesize_win(CacheInstruction);
 > linesize_win(CacheData);
 >
 >

Yes, that works.
Tested-by: Geert Martin Ijewski <gm.ijewski@web.de>

  reply	other threads:[~2017-06-06 22:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-05 22:49 [Qemu-devel] [PATCH v2 0/3] tcg: allocate TB structs preceding translated code Emilio G. Cota
2017-06-05 22:49 ` [Qemu-devel] [PATCH v2 1/3] compiler: define QEMU_CACHELINE_SIZE Emilio G. Cota
2017-06-06  5:39   ` Pranith Kumar
2017-06-06  8:18     ` Richard Henderson
2017-06-06 16:11     ` Emilio G. Cota
2017-06-06 17:39       ` Richard Henderson
2017-06-06 20:28         ` Geert Martin Ijewski
2017-06-06 21:38           ` Emilio G. Cota
2017-06-06 22:01             ` Geert Martin Ijewski [this message]
2017-06-05 22:49 ` [Qemu-devel] [PATCH v2 2/3] tests: use QEMU_CACHELINE_SIZE instead of hard-coding it Emilio G. Cota
2017-06-06  5:40   ` Pranith Kumar
2017-06-05 22:49 ` [Qemu-devel] [PATCH v2 3/3] tcg: allocate TB structs before the corresponding translated code Emilio G. Cota
2017-06-06  5:36   ` Pranith Kumar
2017-06-06 17:13     ` Emilio G. Cota
2017-06-06  8:24   ` Richard Henderson
2017-06-06 16:25     ` Emilio G. Cota
2017-06-06 17:02       ` Richard Henderson
2017-06-06 17:31         ` Emilio G. Cota

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=215e328d-d350-f7b8-772f-065a329142f9@web.de \
    --to=gm.ijewski@web.de \
    --cc=alex.bennee@linaro.org \
    --cc=bobby.prani@gmail.com \
    --cc=cota@braap.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.