diff mbox

[2/2] Advertise X2APIC support.

Message ID 1242927475-6140-3-git-send-email-gleb@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gleb Natapov May 21, 2009, 5:37 p.m. UTC
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 target-i386/cpu.h    |    1 +
 target-i386/helper.c |    5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Dor Laor May 24, 2009, 6:46 a.m. UTC | #1
Gleb Natapov wrote:
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> ---
>  target-i386/cpu.h    |    1 +
>  target-i386/helper.c |    5 +++--
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
> index f054af1..29d730e 100644
> --- a/target-i386/cpu.h
> +++ b/target-i386/cpu.h
> @@ -252,6 +252,7 @@
>  #define MSR_IA32_APICBASE               0x1b
>  #define MSR_IA32_APICBASE_BSP           (1<<8)
>  #define MSR_IA32_APICBASE_ENABLE        (1<<11)
> +#define MSR_IA32_APICBASE_EXTD          (1<<10)
>  #define MSR_IA32_APICBASE_BASE          (0xfffff<<12)
>  
>  #define MSR_MTRRcap			0xfe
> diff --git a/target-i386/helper.c b/target-i386/helper.c
> index 23efcf4..170c3f7 100644
> --- a/target-i386/helper.c
> +++ b/target-i386/helper.c
> @@ -148,7 +148,7 @@ static x86_def_t x86_defs[] = {
>              CPUID_MTRR | CPUID_CLFLUSH | CPUID_MCA |
>          /* this feature is needed for Solaris and isn't fully implemented */
>              CPUID_PSE36,
> -        .ext_features = CPUID_EXT_SSE3,
> +        .ext_features = CPUID_EXT_SSE3 | CPUID_EXT_X2APIC,
>   
Why not first test if the feature exists in the kernel?
>          .ext2_features = (PPRO_FEATURES & 0x0183F3FF) | 
>              CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX |
>              CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT,
> @@ -199,7 +199,8 @@ static x86_def_t x86_defs[] = {
>  	/* The original CPU also implements these ext features:
>                 CPUID_EXT_DTES64, CPUID_EXT_DSCPL, CPUID_EXT_VMX, CPUID_EXT_EST,
>                 CPUID_EXT_TM2, CPUID_EXT_CX16, CPUID_EXT_XTPR, CPUID_EXT_PDCM */
> -        .ext_features = CPUID_EXT_SSE3 | CPUID_EXT_MONITOR | CPUID_EXT_SSSE3,
> +        .ext_features = CPUID_EXT_SSE3 | CPUID_EXT_MONITOR | CPUID_EXT_SSSE3 |
> +            CPUID_EXT_X2APIC,
>          .ext2_features = CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX,
>          /* Missing: .ext3_features = CPUID_EXT3_LAHF_LM */
>          .xlevel = 0x80000008,
>   

--
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
Gleb Natapov May 24, 2009, 6:48 a.m. UTC | #2
On Sun, May 24, 2009 at 09:46:44AM +0300, Dor Laor wrote:
> Gleb Natapov wrote:
>> Signed-off-by: Gleb Natapov <gleb@redhat.com>
>> ---
>>  target-i386/cpu.h    |    1 +
>>  target-i386/helper.c |    5 +++--
>>  2 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/target-i386/cpu.h b/target-i386/cpu.h
>> index f054af1..29d730e 100644
>> --- a/target-i386/cpu.h
>> +++ b/target-i386/cpu.h
>> @@ -252,6 +252,7 @@
>>  #define MSR_IA32_APICBASE               0x1b
>>  #define MSR_IA32_APICBASE_BSP           (1<<8)
>>  #define MSR_IA32_APICBASE_ENABLE        (1<<11)
>> +#define MSR_IA32_APICBASE_EXTD          (1<<10)
>>  #define MSR_IA32_APICBASE_BASE          (0xfffff<<12)
>>   #define MSR_MTRRcap			0xfe
>> diff --git a/target-i386/helper.c b/target-i386/helper.c
>> index 23efcf4..170c3f7 100644
>> --- a/target-i386/helper.c
>> +++ b/target-i386/helper.c
>> @@ -148,7 +148,7 @@ static x86_def_t x86_defs[] = {
>>              CPUID_MTRR | CPUID_CLFLUSH | CPUID_MCA |
>>          /* this feature is needed for Solaris and isn't fully implemented */
>>              CPUID_PSE36,
>> -        .ext_features = CPUID_EXT_SSE3,
>> +        .ext_features = CPUID_EXT_SSE3 | CPUID_EXT_X2APIC,
>>   
> Why not first test if the feature exists in the kernel?
Correct. This should be done for the final version. This patch series is more
of RFC at this stage.

--
			Gleb.
--
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
Avi Kivity June 8, 2009, 12:13 p.m. UTC | #3
Gleb Natapov wrote:
>  
>  #define MSR_MTRRcap			0xfe
> diff --git a/target-i386/helper.c b/target-i386/helper.c
> index 23efcf4..170c3f7 100644
> --- a/target-i386/helper.c
> +++ b/target-i386/helper.c
> @@ -148,7 +148,7 @@ static x86_def_t x86_defs[] = {
>              CPUID_MTRR | CPUID_CLFLUSH | CPUID_MCA |
>          /* this feature is needed for Solaris and isn't fully implemented */
>              CPUID_PSE36,
> -        .ext_features = CPUID_EXT_SSE3,
> +        .ext_features = CPUID_EXT_SSE3 | CPUID_EXT_X2APIC,
>          .ext2_features = (PPRO_FEATURES & 0x0183F3FF) | 
>              CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX |
>              CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT,
> @@ -199,7 +199,8 @@ static x86_def_t x86_defs[] = {
>  	/* The original CPU also implements these ext features:
>                 CPUID_EXT_DTES64, CPUID_EXT_DSCPL, CPUID_EXT_VMX, CPUID_EXT_EST,
>                 CPUID_EXT_TM2, CPUID_EXT_CX16, CPUID_EXT_XTPR, CPUID_EXT_PDCM */
> -        .ext_features = CPUID_EXT_SSE3 | CPUID_EXT_MONITOR | CPUID_EXT_SSSE3,
> +        .ext_features = CPUID_EXT_SSE3 | CPUID_EXT_MONITOR | CPUID_EXT_SSSE3 |
> +            CPUID_EXT_X2APIC,
>          .ext2_features = CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX,
>          /* Missing: .ext3_features = CPUID_EXT3_LAHF_LM */
>          .xlevel = 0x80000008,
>   

x2apic is not present on most cpus, so it should not be available by 
default.  Users can enable it with -cpu +x2apic
diff mbox

Patch

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index f054af1..29d730e 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -252,6 +252,7 @@ 
 #define MSR_IA32_APICBASE               0x1b
 #define MSR_IA32_APICBASE_BSP           (1<<8)
 #define MSR_IA32_APICBASE_ENABLE        (1<<11)
+#define MSR_IA32_APICBASE_EXTD          (1<<10)
 #define MSR_IA32_APICBASE_BASE          (0xfffff<<12)
 
 #define MSR_MTRRcap			0xfe
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 23efcf4..170c3f7 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -148,7 +148,7 @@  static x86_def_t x86_defs[] = {
             CPUID_MTRR | CPUID_CLFLUSH | CPUID_MCA |
         /* this feature is needed for Solaris and isn't fully implemented */
             CPUID_PSE36,
-        .ext_features = CPUID_EXT_SSE3,
+        .ext_features = CPUID_EXT_SSE3 | CPUID_EXT_X2APIC,
         .ext2_features = (PPRO_FEATURES & 0x0183F3FF) | 
             CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX |
             CPUID_EXT2_3DNOW | CPUID_EXT2_3DNOWEXT,
@@ -199,7 +199,8 @@  static x86_def_t x86_defs[] = {
 	/* The original CPU also implements these ext features:
                CPUID_EXT_DTES64, CPUID_EXT_DSCPL, CPUID_EXT_VMX, CPUID_EXT_EST,
                CPUID_EXT_TM2, CPUID_EXT_CX16, CPUID_EXT_XTPR, CPUID_EXT_PDCM */
-        .ext_features = CPUID_EXT_SSE3 | CPUID_EXT_MONITOR | CPUID_EXT_SSSE3,
+        .ext_features = CPUID_EXT_SSE3 | CPUID_EXT_MONITOR | CPUID_EXT_SSSE3 |
+            CPUID_EXT_X2APIC,
         .ext2_features = CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX,
         /* Missing: .ext3_features = CPUID_EXT3_LAHF_LM */
         .xlevel = 0x80000008,