ia64/xen-unstable

changeset 9803:9c313ff7a0ed

There are instances where we DO NOT want an hvm guest to run an
MP enabled kernel. In such situations we should have a workaround to
guarantee hvm guests will not detect MP.

For example, in the absence of ACPI and MPS the installation code in some
linux distributions key off the presence of cpuid edx/HTT bit (indicating
the presence of Hyper-Threading Technology) to determine if another
logical processor is present and if so load an MP enabled kernel instead
of a uniprocessor kernel. SMBIOS is also looked at for the same purpose
and presents a potential problem as well. While both approaches for
selecting an MP kernel are debatable (since using MPS or ACPI have long
been the standard for MP detection), these approaches are something we
have to live and work around with because making a change in the fully
virtualized guest is not an option.

To solve the problem we need to hide all secondary processors from the hvm
guest. Since the hvm does not surface MPS tables, we only need to deal
with ACPI, cpuid HTT, and possibly SMBIOS. (I did not have time right
now to look closely at the hvm BIOS to know if SMBIOS is also going to be
a problem.)

Also fixes a logic problem the code path where apic=0 was not
being handled correctly (vmx path only).

Signed-off-by: Clyde Griffin <cgriffin@novell.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Apr 21 09:56:50 2006 +0100 (2006-04-21)
parents 72adf2025a93
children 29e9a0313c09
files xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/vmx/vmx.c
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/svm.c	Fri Apr 21 09:37:22 2006 +0100
     1.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Fri Apr 21 09:56:50 2006 +0100
     1.3 @@ -931,7 +931,13 @@ static void svm_vmexit_do_cpuid(struct v
     1.4      {
     1.5          if ( !hvm_apic_support(v->domain) ||
     1.6                  !vlapic_global_enabled((VLAPIC(v))) )
     1.7 +        {
     1.8              clear_bit(X86_FEATURE_APIC, &edx);
     1.9 +            /* Since the apic is disabled, avoid any confusion about SMP cpus being available */
    1.10 +            clear_bit(X86_FEATURE_HT, &edx);  /* clear the hyperthread bit */
    1.11 +            ebx &= 0xFF00FFFF;  /* set the logical processor count to 1 */
    1.12 +            ebx |= 0x00010000;
    1.13 +        }
    1.14  	    
    1.15  #if CONFIG_PAGING_LEVELS < 3
    1.16          clear_bit(X86_FEATURE_NX, &edx);
     2.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Fri Apr 21 09:37:22 2006 +0100
     2.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Fri Apr 21 09:56:50 2006 +0100
     2.3 @@ -828,9 +828,16 @@ static void vmx_vmexit_do_cpuid(struct c
     2.4  
     2.5      if ( input == 1 )
     2.6      {
     2.7 -        if ( hvm_apic_support(v->domain) &&
     2.8 +        if ( !hvm_apic_support(v->domain) ||
     2.9               !vlapic_global_enabled((VLAPIC(v))) )
    2.10 +        {
    2.11              clear_bit(X86_FEATURE_APIC, &edx);
    2.12 +            /* Since the apic is disabled, avoid any confusion about SMP cpus being available */
    2.13 +            clear_bit(X86_FEATURE_HT, &edx);  /* clear the hyperthread bit */
    2.14 +            ebx &= 0xFF00FFFF;  /* set the logical processor count to 1 */
    2.15 +            ebx |= 0x00010000;
    2.16 +        }
    2.17 +
    2.18  
    2.19  #if CONFIG_PAGING_LEVELS < 3
    2.20          clear_bit(X86_FEATURE_PAE, &edx);