From: Richard Simpson <rs1002@huskydog.org.uk>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: Setting nx bit in virtual CPU
Date: Fri, 09 Apr 2010 00:55:53 +0100 [thread overview]
Message-ID: <4BBE6D09.7000207@huskydog.org.uk> (raw)
In-Reply-To: <4BBD8474.6060809@redhat.com>
On 08/04/10 08:23, Avi Kivity wrote:
> Strange. Can you hack qemu-kvm's cpuid code where it issues the ioctl
> KVM_SET_CPUID2 to show what the data is? I'm not where that code is in
> your version of qemu-kvm.
Gad, the last time I tried to mess around with this sort of low level
code was many years ago when I was a keen young bachelor burning the
midnight oil trying to get the weird IDE controller on my Alpha to work
properly! Anyway, I have tried to give it a go.
I found a file called qemu-kvm-x86.c
It contained a function called kvm_setup_cpuid2 which I modified as follows:
int kvm_setup_cpuid2(CPUState *env, int nent,
struct kvm_cpuid_entry2 *entries)
{
struct kvm_cpuid2 *cpuid;
int r, i;
fprintf(stderr, "cpuid=nent %d\n", nent);
for (i=0; i < nent; i++) {
fprintf(stderr, "%x %x %x %x %x %x %x\n",
entries[i].function, entries[i].index, entries[i].flags, entries[i].eax,
entries[i].ebx, entries[i].ecx, entries[i].edx);
}
cpuid = qemu_malloc(sizeof(*cpuid) + nent * sizeof(*entries));
cpuid->nent = nent;
memcpy(cpuid->entries, entries, nent * sizeof(*entries));
r = kvm_vcpu_ioctl(env, KVM_SET_CPUID2, cpuid);
free(cpuid);
return r;
}
So, basically I go round a loop and print out the contents of each
kvm_cpuid_entry2 structure.
Results below, using Andre Przywara's handy nano-kernel. I do hope that
some of this makes some kind of sense!
qemu-kvm -kernel cpuid_mb -vnc :0
cpuid=nent 21
40000000 0 0 0 4b4d564b 564b4d56 4d
40000001 0 0 7 0 0 0
0 0 0 4 68747541 444d4163 69746e65
1 0 0 623 800 80002001 78bfbfd
2 0 0 1 0 0 2c307d
3 0 0 0 0 0 0
4 0 1 121 1c0003f 3f 1
4 1 1 122 1c0003f 3f 1
4 2 1 143 3c0003f fff 1
4 3 1 0 0 0 0
80000000 0 0 8000000a 68747541 444d4163 69746e65
80000001 0 0 623 0 1 2181abfd
80000002 0 0 554d4551 72695620 6c617574 55504320
80000003 0 0 72657620 6e6f6973 312e3020 332e32
80000004 0 0 0 0 0 0
80000005 0 0 1ff01ff 1ff01ff 40020140 40020140
80000006 0 0 0 42004200 2008140 0
80000007 0 0 0 0 0 0
80000008 0 0 3028 0 0 0
80000009 0 0 0 0 0 0
8000000a 0 0 1 10 0 0
qemu-kvm -kernel cpuid_mb -cpu host -vnc :0
cpuid=nent 29
40000000 0 0 0 4b4d564b 564b4d56 4d
40000001 0 0 7 0 0 0
0 0 0 1 68747541 444d4163 69746e65
1 0 0 40ff2 800 80002001 78bfbff
80000000 0 0 80000018 68747541 444d4163 69746e65
80000001 0 0 40ff2 0 1 23c3fbff
80000002 0 0 20444d41 6c687441 74286e6f 3620296d
80000003 0 0 72502034 7365636f 20726f73 30303233
80000004 0 0 2b 0 0 0
80000005 0 0 1ff01ff 1ff01ff 40020140 40020140
80000006 0 0 0 42004200 2008140 0
80000007 0 0 0 0 0 0
80000008 0 0 3028 0 0 0
80000009 0 0 0 0 0 0
8000000a 0 0 1 10 0 0
8000000b 0 0 0 0 0 0
8000000c 0 0 0 0 0 0
8000000d 0 0 0 0 0 0
8000000e 0 0 0 0 0 0
8000000f 0 0 0 0 0 0
80000010 0 0 0 0 0 0
80000011 0 0 0 0 0 0
80000012 0 0 0 0 0 0
80000013 0 0 0 0 0 0
80000014 0 0 0 0 0 0
80000015 0 0 0 0 0 0
80000016 0 0 0 0 0 0
80000017 0 0 0 0 0 0
80000018 0 0 0 0 0 0
If I try with -no-kvm then nothing gets printed, presumably because this
is a kvm specific function and doesn't get called in that case.
next prev parent reply other threads:[~2010-04-08 23:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-29 22:16 Setting nx bit in virtual CPU Richard Simpson
2010-03-30 2:12 ` Chris Wright
2010-03-30 20:42 ` Richard Simpson
2010-04-01 8:43 ` Avi Kivity
2010-04-02 21:07 ` Richard Simpson
2010-04-05 8:27 ` Avi Kivity
2010-04-06 22:31 ` Richard Simpson
2010-04-07 5:39 ` Avi Kivity
2010-04-07 12:10 ` Richard Simpson
2010-04-07 12:23 ` Avi Kivity
2010-04-07 20:38 ` Richard Simpson
2010-04-07 20:48 ` Avi Kivity
2010-04-07 23:13 ` Richard Simpson
2010-04-08 7:23 ` Avi Kivity
2010-04-08 23:55 ` Richard Simpson [this message]
2010-04-10 19:34 ` Avi Kivity
2010-04-08 8:52 ` Andre Przywara
2010-04-08 21:23 ` Richard Simpson
2010-04-09 23:45 ` Andre Przywara
2010-04-12 21:15 ` Richard Simpson
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=4BBE6D09.7000207@huskydog.org.uk \
--to=rs1002@huskydog.org.uk \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.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 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.