From: Andre Przywara <andre.przywara@amd.com>
To: qemu-devel@nongnu.org
Cc: kvm@vger.kernel.org
Subject: [Qemu-devel] [PATCH] x86 CPUID extended family/model
Date: Thu, 6 Nov 2008 14:33:12 +0100 [thread overview]
Message-ID: <4912F218.2050208@amd.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1140 bytes --]
Hi,
(at least) AMD CPUs feature extended family/model bits in CPUID leaf
0000_0001|EAX. Refer to page 10 in:
http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25481.pdf
Those bits are necessary to model newer AMD CPUs:
-cpu qemu64,family=15,model=65,stepping=3 or
-cpu qemu64,family=16,model=4,stepping=2
Attached patch introduces support for specifying those bits on the
command line and passing them to the guest.
(Patch applies against qemu-svn and kvm-userspace)
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Regards,
Andre.
P.S. I heard of a way to propagate the host CPUID bits to the guest,
like -cpu=host, but couldn't find any code. Did I miss something?
--
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 277-84917
----to satisfy European Law for business letters:
AMD Saxony Limited Liability Company & Co. KG,
Wilschdorfer Landstr. 101, 01109 Dresden, Germany
Register Court Dresden: HRA 4896, General Partner authorized
to represent: AMD Saxony LLC (Wilmington, Delaware, US)
General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy
[-- Attachment #2: cpuid_ext.patch --]
[-- Type: text/x-patch, Size: 1182 bytes --]
Index: target-i386/helper.c
===================================================================
--- target-i386/helper.c (revision 5639)
+++ target-i386/helper.c (working copy)
@@ -337,7 +337,7 @@
} else if (!strcmp(featurestr, "model")) {
char *err;
model = strtol(val, &err, 10);
- if (!*val || *err || model < 0 || model > 0xf) {
+ if (!*val || *err || model < 0 || model > 0xff) {
fprintf(stderr, "bad numerical value %s\n", val);
goto error;
}
@@ -416,7 +416,12 @@
env->cpuid_vendor3 = CPUID_VENDOR_INTEL_3;
}
env->cpuid_level = def->level;
- env->cpuid_version = (def->family << 8) | (def->model << 4) | def->stepping;
+ if (def->family > 0x0F)
+ env->cpuid_version = 0xF00 | (def->family - 0x0F)<<20;
+ else
+ env->cpuid_version = def->family << 8;
+ env->cpuid_version |= (def->model & 0x0F) << 4;
+ env->cpuid_version |= def->stepping | (def->model>>4)<<16;
env->cpuid_features = def->features;
env->pat = 0x0007040600070406ULL;
env->cpuid_ext_features = def->ext_features;
next reply other threads:[~2008-11-06 13:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-06 13:33 Andre Przywara [this message]
2008-11-06 15:16 ` [Qemu-devel] Re: [PATCH] x86 CPUID extended family/model Avi Kivity
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=4912F218.2050208@amd.com \
--to=andre.przywara@amd.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@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).