From: "Andreas Färber" <afaerber@suse.de>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Igor Mammedov <imammedo@redhat.com>,
qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>,
Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH 1/3] target-i386: Add 486sx, old486, and old486sx CPU models
Date: Mon, 25 Mar 2013 10:39:36 +0100 [thread overview]
Message-ID: <51501B58.1060300@suse.de> (raw)
In-Reply-To: <1362017554-1260-1-git-send-email-hpa@zytor.com>
Am 28.02.2013 03:12, schrieb H. Peter Anvin:
> From: "H. Peter Anvin" <hpa@zytor.com>
>
> Add models for 486SX, and pre-CPUID versions of the 486 (DX & SX).
> Change the model number for the standard 486DX to a model which
> actually had CPUID.
>
> Note: these models are fairly vestigial, for example most of the FPU
> operations still work; only F*ST[CS]W have been modified to appear as
> through there is no FPU.
>
> This also changes the classic 486 model number to 8 (DX4) which
> matches the feature set presented.
>
> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
> ---
> target-i386/cpu.c | 39 ++++++++++++++++++++++++++---
> target-i386/fpu_helper.c | 12 +++++++--
> target-i386/misc_helper.c | 15 ++++++++----
> target-i386/translate.c | 62 +++++++++++++++--------------------------------
> 4 files changed, 75 insertions(+), 53 deletions(-)
>
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index aab35c7..a5aad19 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -365,8 +365,11 @@ typedef struct x86_def_t {
> uint32_t cpuid_7_0_ebx_features;
> } x86_def_t;
>
> -#define I486_FEATURES (CPUID_FP87 | CPUID_VME | CPUID_PSE)
> -#define PENTIUM_FEATURES (I486_FEATURES | CPUID_DE | CPUID_TSC | \
> +#define OLD_I486SX_FEATURES 0
> +#define OLD_I486_FEATURES CPUID_FP87
> +#define I486SX_FEATURES CPUID_VME /* SX2+ */
> +#define I486_FEATURES (CPUID_FP87 | CPUID_VME) /* DX4 and some DX2 */
> +#define PENTIUM_FEATURES (I486_FEATURES | CPUID_PSE | CPUID_DE | CPUID_TSC | \
> CPUID_MSR | CPUID_MCE | CPUID_CX8 | CPUID_MMX | CPUID_APIC)
> #define PENTIUM2_FEATURES (PENTIUM_FEATURES | CPUID_PAE | CPUID_SEP | \
> CPUID_MTRR | CPUID_PGE | CPUID_MCA | CPUID_CMOV | CPUID_PAT | \
> @@ -535,16 +538,46 @@ static x86_def_t builtin_x86_defs[] = {
> .model_id = "Genuine Intel(R) CPU T2600 @ 2.16GHz",
> },
> {
> + .name = "old486",
> + .level = 0,
> + .vendor = CPUID_VENDOR_INTEL,
> + .family = 4,
> + .model = 1,
> + .stepping = 0,
> + .features = OLD_I486_FEATURES,
> + .xlevel = 0,
> + },
> + {
> + .name = "old486sx",
> + .level = 0,
> + .vendor = CPUID_VENDOR_INTEL,
> + .family = 4,
> + .model = 2,
> + .stepping = 0,
> + .features = OLD_I486SX_FEATURES,
> + .xlevel = 0,
> + },
> + {
> .name = "486",
> .level = 1,
> .vendor = CPUID_VENDOR_INTEL,
> .family = 4,
> - .model = 0,
> + .model = 8,
Such changes have been rejected in the past (e.g., n270 Atom).
I personally wouldn't object to 486 changes, but I guess it should
rather be handled via Igor's CPU static properties that I have in my
review queue: The .model value would be set to 8 but the PC machine
would be changed alongside to set model = 0 for pc-1.4 and earlier.
> .stepping = 0,
> .features = I486_FEATURES,
> .xlevel = 0,
> },
> {
> + .name = "486sx",
> + .level = 1,
> + .vendor = CPUID_VENDOR_INTEL,
> + .family = 4,
> + .model = 5,
> + .stepping = 0,
> + .features = I486SX_FEATURES,
> + .xlevel = 0,
> + },
> + {
> .name = "pentium",
> .level = 1,
> .vendor = CPUID_VENDOR_INTEL,
[...]
> diff --git a/target-i386/translate.c b/target-i386/translate.c
> index 112c310..6d8abff 100644
> --- a/target-i386/translate.c
> +++ b/target-i386/translate.c
[...]
> @@ -7926,6 +7900,8 @@ static inline void gen_intermediate_code_internal(CPUX86State *env,
> if (flags & HF_SOFTMMU_MASK) {
> dc->mem_index = (cpu_mmu_index(env) + 1) << 2;
> }
> + dc->cpuid_family = (env->cpuid_version >> 8) & 0x0f;
> + dc->cpuid_level = env->cpuid_level;
> dc->cpuid_features = env->cpuid_features;
> dc->cpuid_ext_features = env->cpuid_ext_features;
> dc->cpuid_ext2_features = env->cpuid_ext2_features;
Would be better to reuse the "family" QOM property that also reads the
upper two nibbles, to avoid surprises.
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2013-03-25 9:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1362017554-1260-1-git-send-email-hpa@zytor.com>
2013-03-24 5:06 ` [Qemu-devel] [RFC PATCH 1/3] target-i386: Add 486sx, old486, and old486sx CPU models H. Peter Anvin
2013-03-25 9:06 ` Paolo Bonzini
2013-03-25 9:23 ` Andreas Färber
[not found] ` <1362017554-1260-3-git-send-email-hpa@zytor.com>
2013-03-25 9:05 ` [Qemu-devel] [RFC PATCH 3/3] mc146818rtc: export the timezone information Paolo Bonzini
2013-03-25 15:47 ` H. Peter Anvin
2013-03-25 15:51 ` Paolo Bonzini
2013-03-25 9:39 ` Andreas Färber [this message]
2013-03-25 15:15 ` [Qemu-devel] [RFC PATCH 1/3] target-i386: Add 486sx, old486, and old486sx CPU models Igor Mammedov
2013-03-25 18:44 ` H. Peter Anvin
2013-03-25 19:05 ` Eduardo Habkost
2013-03-25 20:45 ` H. Peter Anvin
2013-03-25 20:56 ` Eduardo Habkost
2013-03-25 20:56 ` H. Peter Anvin
2014-01-07 5:53 ` H. Peter Anvin
2014-01-07 9:08 ` Igor Mammedov
2013-03-25 20:47 ` H. Peter Anvin
2013-03-25 19:01 ` Eduardo Habkost
[not found] ` <1362017554-1260-2-git-send-email-hpa@zytor.com>
2013-03-28 19:15 ` [Qemu-devel] [RFC PATCH 2/3] target-i386: Raise #UD on accessing non-existent control registers Aurelien Jarno
2013-03-28 19:15 ` [Qemu-devel] [RFC PATCH 1/3] target-i386: Add 486sx, old486, and old486sx CPU models Aurelien Jarno
2013-03-28 20:02 ` H. Peter Anvin
2013-03-28 20:12 ` H. Peter Anvin
2013-03-29 5:10 ` Rob Landley
2013-03-29 5:25 ` H. Peter Anvin
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=51501B58.1060300@suse.de \
--to=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=ehabkost@redhat.com \
--cc=hpa@zytor.com \
--cc=imammedo@redhat.com \
--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).