ia64/xen-unstable

changeset 13235:4fc6ffff2ac5

[HVM] Change VCPU->LAPIC_ID mapping so that VCPU0 has ID0.
This fixes booting of older x86/64 Linux kernels.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@localhost.localdomain
date Sun Dec 31 12:26:42 2006 +0000 (2006-12-31)
parents dbddea768e29
children 711c31232d71
files tools/firmware/hvmloader/acpi/build.c tools/firmware/hvmloader/config.h tools/firmware/hvmloader/mp_tables.c xen/arch/x86/hvm/vlapic.c
line diff
     1.1 --- a/tools/firmware/hvmloader/acpi/build.c	Sun Dec 31 11:59:47 2006 +0000
     1.2 +++ b/tools/firmware/hvmloader/acpi/build.c	Sun Dec 31 12:26:42 2006 +0000
     1.3 @@ -110,7 +110,7 @@ int construct_madt(struct acpi_20_madt *
     1.4          memset(lapic, 0, sizeof(*lapic));
     1.5          lapic->type    = ACPI_PROCESSOR_LOCAL_APIC;
     1.6          lapic->length  = sizeof(*lapic);
     1.7 -        lapic->acpi_processor_id = lapic->apic_id = i + 1;
     1.8 +        lapic->acpi_processor_id = lapic->apic_id = LAPIC_ID(i);
     1.9          lapic->flags   = ACPI_LOCAL_APIC_ENABLED;
    1.10          offset += sizeof(*lapic);
    1.11          lapic++;
     2.1 --- a/tools/firmware/hvmloader/config.h	Sun Dec 31 11:59:47 2006 +0000
     2.2 +++ b/tools/firmware/hvmloader/config.h	Sun Dec 31 12:26:42 2006 +0000
     2.3 @@ -2,10 +2,11 @@
     2.4  #define __HVMLOADER_CONFIG_H__
     2.5  
     2.6  #define IOAPIC_BASE_ADDRESS 0xfec00000
     2.7 -#define IOAPIC_ID           0x00
     2.8 +#define IOAPIC_ID           0x01
     2.9  #define IOAPIC_VERSION      0x11
    2.10  
    2.11  #define LAPIC_BASE_ADDRESS  0xfee00000
    2.12 +#define LAPIC_ID(vcpu_id)   ((vcpu_id) * 2)
    2.13  
    2.14  #define PCI_ISA_DEVFN       0x08    /* dev 1, fn 0 */
    2.15  #define PCI_ISA_IRQ_MASK    0x0c60U /* ISA IRQs 5,6,10,11 are PCI connected */
     3.1 --- a/tools/firmware/hvmloader/mp_tables.c	Sun Dec 31 11:59:47 2006 +0000
     3.2 +++ b/tools/firmware/hvmloader/mp_tables.c	Sun Dec 31 12:26:42 2006 +0000
     3.3 @@ -222,7 +222,7 @@ void fill_mp_config_table(struct mp_conf
     3.4  void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
     3.5  {
     3.6      mppe->type = ENTRY_TYPE_PROCESSOR;
     3.7 -    mppe->lapic_id = vcpu_id + 1;
     3.8 +    mppe->lapic_id = LAPIC_ID(vcpu_id);
     3.9      mppe->lapic_version = 0x11;
    3.10      mppe->cpu_flags = CPU_FLAG_ENABLED;
    3.11      if ( vcpu_id == 0 )
     4.1 --- a/xen/arch/x86/hvm/vlapic.c	Sun Dec 31 11:59:47 2006 +0000
     4.2 +++ b/xen/arch/x86/hvm/vlapic.c	Sun Dec 31 12:26:42 2006 +0000
     4.3 @@ -767,7 +767,7 @@ static int vlapic_reset(struct vlapic *v
     4.4      struct vcpu *v = vlapic_vcpu(vlapic);
     4.5      int i;
     4.6  
     4.7 -    vlapic_set_reg(vlapic, APIC_ID,  (v->vcpu_id + 1) << 24);
     4.8 +    vlapic_set_reg(vlapic, APIC_ID,  (v->vcpu_id * 2) << 24);
     4.9      vlapic_set_reg(vlapic, APIC_LVR, VLAPIC_VERSION);
    4.10  
    4.11      for ( i = 0; i < 8; i++ )