All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] Check processor version for broadcast.
@ 2010-11-30  8:15 Jin Dongming
  2010-11-30  8:22 ` Huang Ying
  0 siblings, 1 reply; 3+ messages in thread
From: Jin Dongming @ 2010-11-30  8:15 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti
  Cc: Andi Kleen, Huang Ying, Hidetoshi Seto, Dean Nelson, KVM list

Broadcast MCA signal is not supported by the CPUs whose version is
below 06H_EH.

Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
---
 target-i386/helper.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/target-i386/helper.c b/target-i386/helper.c
index 7e07ebd..437290b 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1077,10 +1077,23 @@ void cpu_inject_x86_mce(CPUState *cenv, int bank, uint64_t status,
     unsigned bank_num = cenv->mcg_cap & 0xff;
     CPUState *env;
     int flag = 0;
+    int family, model, cpuver = first_cpu->cpuid_version;
 
     if (bank >= bank_num || !(status & MCI_STATUS_VAL))
         return;
 
+    if (broadcast) {
+        family = (cpuver >> 8) & 0x0f;
+        model = ((cpuver >> 12) & 0xf0) + ((cpuver >> 4) & 0x0f);
+
+        if ((family == 6 && model >= 14) || family > 6)
+            broadcast = 1;
+        else {
+            fprintf(stderr, "Current CPU does not support broadcast\n");
+            return;
+        }
+    }
+
     if (kvm_enabled()) {
         if (broadcast)
             flag |= 0x02; /* bit 1: 1(broadcast); 0(not broadcast) */
-- 
1.7.1.1



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

* Re: [PATCH 3/3] Check processor version for broadcast.
  2010-11-30  8:15 [PATCH 3/3] Check processor version for broadcast Jin Dongming
@ 2010-11-30  8:22 ` Huang Ying
  2010-11-30  8:40   ` Jin Dongming
  0 siblings, 1 reply; 3+ messages in thread
From: Huang Ying @ 2010-11-30  8:22 UTC (permalink / raw)
  To: Jin Dongming
  Cc: Avi Kivity, Marcelo Tosatti, Andi Kleen, Hidetoshi Seto,
	Dean Nelson, KVM list

Hi, Dongming,

On Tue, 2010-11-30 at 16:15 +0800, Jin Dongming wrote:
> Broadcast MCA signal is not supported by the CPUs whose version is
> below 06H_EH.
> 
> Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
> ---
>  target-i386/helper.c |   13 +++++++++++++
>  1 files changed, 13 insertions(+), 0 deletions(-)
> 
> diff --git a/target-i386/helper.c b/target-i386/helper.c
> index 7e07ebd..437290b 100644
> --- a/target-i386/helper.c
> +++ b/target-i386/helper.c
> @@ -1077,10 +1077,23 @@ void cpu_inject_x86_mce(CPUState *cenv, int bank, uint64_t status,
>      unsigned bank_num = cenv->mcg_cap & 0xff;
>      CPUState *env;
>      int flag = 0;
> +    int family, model, cpuver = first_cpu->cpuid_version;
>  
>      if (bank >= bank_num || !(status & MCI_STATUS_VAL))
>          return;
>  
> +    if (broadcast) {
> +        family = (cpuver >> 8) & 0x0f;
> +        model = ((cpuver >> 12) & 0xf0) + ((cpuver >> 4) & 0x0f);
> +
> +        if ((family == 6 && model >= 14) || family > 6)
> +            broadcast = 1;
> +        else {
> +            fprintf(stderr, "Current CPU does not support broadcast\n");
> +            return;
> +        }
> +    }
> +
>      if (kvm_enabled()) {
>          if (broadcast)
>              flag |= 0x02; /* bit 1: 1(broadcast); 0(not broadcast) */

Why not wrap this into a function? I think it may be used by other
functions too.

Best Regards,
Huang Ying



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

* Re: [PATCH 3/3] Check processor version for broadcast.
  2010-11-30  8:22 ` Huang Ying
@ 2010-11-30  8:40   ` Jin Dongming
  0 siblings, 0 replies; 3+ messages in thread
From: Jin Dongming @ 2010-11-30  8:40 UTC (permalink / raw)
  To: Huang Ying
  Cc: Avi Kivity, Marcelo Tosatti, Andi Kleen, Hidetoshi Seto,
	Dean Nelson, KVM list

Hi, Huang-san

(2010/11/30 17:22), Huang Ying wrote:
> Hi, Dongming,
> 
> On Tue, 2010-11-30 at 16:15 +0800, Jin Dongming wrote:
>> Broadcast MCA signal is not supported by the CPUs whose version is
>> below 06H_EH.
>>
>> Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
>> ---
>>  target-i386/helper.c |   13 +++++++++++++
>>  1 files changed, 13 insertions(+), 0 deletions(-)
>>
>> diff --git a/target-i386/helper.c b/target-i386/helper.c
>> index 7e07ebd..437290b 100644
>> --- a/target-i386/helper.c
>> +++ b/target-i386/helper.c
>> @@ -1077,10 +1077,23 @@ void cpu_inject_x86_mce(CPUState *cenv, int bank, uint64_t status,
>>      unsigned bank_num = cenv->mcg_cap & 0xff;
>>      CPUState *env;
>>      int flag = 0;
>> +    int family, model, cpuver = first_cpu->cpuid_version;
>>  
>>      if (bank >= bank_num || !(status & MCI_STATUS_VAL))
>>          return;
>>  
>> +    if (broadcast) {
>> +        family = (cpuver >> 8) & 0x0f;
>> +        model = ((cpuver >> 12) & 0xf0) + ((cpuver >> 4) & 0x0f);
>> +
>> +        if ((family == 6 && model >= 14) || family > 6)
>> +            broadcast = 1;
>> +        else {
>> +            fprintf(stderr, "Current CPU does not support broadcast\n");
>> +            return;
>> +        }
>> +    }
>> +
>>      if (kvm_enabled()) {
>>          if (broadcast)
>>              flag |= 0x02; /* bit 1: 1(broadcast); 0(not broadcast) */
> 
> Why not wrap this into a function? I think it may be used by other
> functions too.

I have other patchset for cleanup. So I will do it in that patchset.
Thank you!

Best Regards,
Jin Dongming
> 
> Best Regards,
> Huang Ying
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 



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

end of thread, other threads:[~2010-11-30  8:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-30  8:15 [PATCH 3/3] Check processor version for broadcast Jin Dongming
2010-11-30  8:22 ` Huang Ying
2010-11-30  8:40   ` Jin Dongming

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.