Patchwork [qom-cpu,for-1.5,4/4] target-i386: Change CPUID model of 486 to 8

login
register
mail settings
Submitter Andreas Färber
Date May 1, 2013, 4:07 p.m.
Message ID <1367424440-16687-5-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/240786/
State New
Headers show

Comments

Andreas Färber - May 1, 2013, 4:07 p.m.
This changes the model number of 486 to 8 (DX4) which matches the
feature set presented, and actually has the CPUID instruction.

This adds a compatibility property, to keep model=0 on pc-*-1.4 and older.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
[AF: Add compat_props entry]
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 include/hw/i386/pc.h | 4 ++++
 target-i386/cpu.c    | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
Eduardo Habkost - May 2, 2013, 3:48 p.m.
On Wed, May 01, 2013 at 06:07:20PM +0200, Andreas Färber wrote:
> This changes the model number of 486 to 8 (DX4) which matches the
> feature set presented, and actually has the CPUID instruction.
> 
> This adds a compatibility property, to keep model=0 on pc-*-1.4 and older.
> 
> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> [AF: Add compat_props entry]
> Signed-off-by: Andreas Färber <afaerber@suse.de>

Tested by running a simple CPUID-dump test kernel, CPUID data is
changing according to the machine-type as expected. Didn't test using a
Linux kernel.

Tested-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>


> ---
>  include/hw/i386/pc.h | 4 ++++
>  target-i386/cpu.c    | 2 +-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 41869e5..417afe4 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -242,6 +242,10 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t);
>              .driver   = "pc-sysfw",\
>              .property = "rom_only",\
>              .value    = stringify(0),\
> +        },{\
> +            .driver   = "486-" TYPE_X86_CPU,\
> +            .property = "model",\
> +            .value    = stringify(0),\
>          }
>  
>  #endif
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 8a9563b..f7d4d9b 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -550,7 +550,7 @@ static x86_def_t builtin_x86_defs[] = {
>          .level = 1,
>          .vendor = CPUID_VENDOR_INTEL,
>          .family = 4,
> -        .model = 0,
> +        .model = 8,
>          .stepping = 0,
>          .features = I486_FEATURES,
>          .xlevel = 0,
> -- 
> 1.8.1.4
>

Patch

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 41869e5..417afe4 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -242,6 +242,10 @@  int e820_add_entry(uint64_t, uint64_t, uint32_t);
             .driver   = "pc-sysfw",\
             .property = "rom_only",\
             .value    = stringify(0),\
+        },{\
+            .driver   = "486-" TYPE_X86_CPU,\
+            .property = "model",\
+            .value    = stringify(0),\
         }
 
 #endif
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 8a9563b..f7d4d9b 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -550,7 +550,7 @@  static x86_def_t builtin_x86_defs[] = {
         .level = 1,
         .vendor = CPUID_VENDOR_INTEL,
         .family = 4,
-        .model = 0,
+        .model = 8,
         .stepping = 0,
         .features = I486_FEATURES,
         .xlevel = 0,