qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user: Use X86CPU property to retrieve CPUID family
@ 2013-07-10 16:26 Andreas Färber
  2013-07-11  5:35 ` Igor Mammedov
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Färber @ 2013-07-10 16:26 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, Andreas Färber

Avoids duplicating the calculation.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 Have this lying around for a while already, apparently not sent out yet.

 linux-user/cpu-uname.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/linux-user/cpu-uname.c b/linux-user/cpu-uname.c
index 59cd647..cc713e6 100644
--- a/linux-user/cpu-uname.c
+++ b/linux-user/cpu-uname.c
@@ -55,12 +55,14 @@ const char *cpu_to_uname_machine(void *cpu_env)
     return "x86-64";
 #elif defined(TARGET_I386)
     /* see arch/x86/kernel/cpu/bugs.c: check_bugs(), 386, 486, 586, 686 */
-    uint32_t cpuid_version = ((CPUX86State *)cpu_env)->cpuid_version;
-    int family = ((cpuid_version >> 8) & 0x0f) + ((cpuid_version >> 20) & 0xff);
-    if (family == 4)
+    CPUState *cpu = ENV_GET_CPU((CPUX86State *)cpu_env);
+    int family = object_property_get_int(OBJECT(cpu), "family", NULL);
+    if (family == 4) {
         return "i486";
-    if (family == 5)
+    }
+    if (family == 5) {
         return "i586";
+    }
     return "i686";
 #else
     /* default is #define-d in each arch/ subdir */
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] linux-user: Use X86CPU property to retrieve CPUID family
  2013-07-10 16:26 [Qemu-devel] [PATCH] linux-user: Use X86CPU property to retrieve CPUID family Andreas Färber
@ 2013-07-11  5:35 ` Igor Mammedov
  2013-07-22 23:06   ` Andreas Färber
  0 siblings, 1 reply; 3+ messages in thread
From: Igor Mammedov @ 2013-07-11  5:35 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Riku Voipio, qemu-devel

On Wed, 10 Jul 2013 18:26:17 +0200
Andreas Färber <afaerber@suse.de> wrote:

> Avoids duplicating the calculation.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  Have this lying around for a while already, apparently not sent out yet.
> 
>  linux-user/cpu-uname.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/linux-user/cpu-uname.c b/linux-user/cpu-uname.c
> index 59cd647..cc713e6 100644
> --- a/linux-user/cpu-uname.c
> +++ b/linux-user/cpu-uname.c
> @@ -55,12 +55,14 @@ const char *cpu_to_uname_machine(void *cpu_env)
>      return "x86-64";
>  #elif defined(TARGET_I386)
>      /* see arch/x86/kernel/cpu/bugs.c: check_bugs(), 386, 486, 586, 686 */
> -    uint32_t cpuid_version = ((CPUX86State *)cpu_env)->cpuid_version;
> -    int family = ((cpuid_version >> 8) & 0x0f) + ((cpuid_version >> 20) & 0xff);
> -    if (family == 4)
> +    CPUState *cpu = ENV_GET_CPU((CPUX86State *)cpu_env);
> +    int family = object_property_get_int(OBJECT(cpu), "family", NULL);
> +    if (family == 4) {
>          return "i486";
> -    if (family == 5)
> +    }
> +    if (family == 5) {
>          return "i586";
> +    }
>      return "i686";
>  #else
>      /* default is #define-d in each arch/ subdir */

Reviewed-By: Igor Mammedov <imammedo@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] linux-user: Use X86CPU property to retrieve CPUID family
  2013-07-11  5:35 ` Igor Mammedov
@ 2013-07-22 23:06   ` Andreas Färber
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Färber @ 2013-07-22 23:06 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: Riku Voipio, qemu-devel

Am 11.07.2013 07:35, schrieb Igor Mammedov:
> On Wed, 10 Jul 2013 18:26:17 +0200
> Andreas Färber <afaerber@suse.de> wrote:
> 
>> Avoids duplicating the calculation.
>>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>> ---
>>  Have this lying around for a while already, apparently not sent out yet.
>>
>>  linux-user/cpu-uname.c | 10 ++++++----
>>  1 file changed, 6 insertions(+), 4 deletions(-)
[...]
> Reviewed-By: Igor Mammedov <imammedo@redhat.com>

Thanks, applied to qom-cpu:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-22 23:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-10 16:26 [Qemu-devel] [PATCH] linux-user: Use X86CPU property to retrieve CPUID family Andreas Färber
2013-07-11  5:35 ` Igor Mammedov
2013-07-22 23:06   ` Andreas Färber

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).