ia64/xen-unstable

changeset 12586:b6c6a1efbfaf

[HVM] Move IOAPIC ID back to 0x00. Shift LAPIC IDs to 0x01 upwards.

Actually the conflict between LAPIC ID 0x00 and IOAPIC ID 0x00
really doesn't matter even in a native system but we can avoid
any risk of a warning by shifting the LAPIC ID space by one.

Also the changeset fixes construction of the MADT (LAPIC info
was overwriting the IOAPIC info) so we can now boot with ACPI
MADT again.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Mon Nov 27 12:00:01 2006 +0000 (2006-11-27)
parents 63786d35bc48
children dc1c8ae0a87a
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	Mon Nov 27 11:39:54 2006 +0000
     1.2 +++ b/tools/firmware/hvmloader/acpi/build.c	Mon Nov 27 12:00:01 2006 +0000
     1.3 @@ -88,14 +88,13 @@ int construct_madt(struct acpi_20_madt *
     1.4      io_apic->ioapic_addr = IOAPIC_BASE_ADDRESS;
     1.5      offset += sizeof(*io_apic);
     1.6  
     1.7 -    lapic = (struct acpi_20_madt_lapic *)io_apic;
     1.8 +    lapic = (struct acpi_20_madt_lapic *)(io_apic + 1);
     1.9      for ( i = 0; i < get_vcpu_nr(); i++ )
    1.10      {
    1.11          memset(lapic, 0, sizeof(*lapic));
    1.12          lapic->type    = ACPI_PROCESSOR_LOCAL_APIC;
    1.13          lapic->length  = sizeof(*lapic);
    1.14 -        lapic->acpi_processor_id = i;
    1.15 -        lapic->apic_id = i;
    1.16 +        lapic->acpi_processor_id = lapic->apic_id = i + 1;
    1.17          lapic->flags   = ACPI_LOCAL_APIC_ENABLED;
    1.18          offset += sizeof(*lapic);
    1.19          lapic++;
     2.1 --- a/tools/firmware/hvmloader/config.h	Mon Nov 27 11:39:54 2006 +0000
     2.2 +++ b/tools/firmware/hvmloader/config.h	Mon Nov 27 12:00:01 2006 +0000
     2.3 @@ -2,7 +2,7 @@
     2.4  #define __HVMLOADER_CONFIG_H__
     2.5  
     2.6  #define IOAPIC_BASE_ADDRESS 0xfec00000
     2.7 -#define IOAPIC_ID           0xfe
     2.8 +#define IOAPIC_ID           0x00
     2.9  #define IOAPIC_VERSION      0x11
    2.10  
    2.11  #define LAPIC_BASE_ADDRESS  0xfee00000
     3.1 --- a/tools/firmware/hvmloader/mp_tables.c	Mon Nov 27 11:39:54 2006 +0000
     3.2 +++ b/tools/firmware/hvmloader/mp_tables.c	Mon Nov 27 12:00:01 2006 +0000
     3.3 @@ -223,7 +223,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;
     3.8 +    mppe->lapic_id = vcpu_id + 1;
     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	Mon Nov 27 11:39:54 2006 +0000
     4.2 +++ b/xen/arch/x86/hvm/vlapic.c	Mon Nov 27 12:00:01 2006 +0000
     4.3 @@ -240,7 +240,7 @@ static int vlapic_match_dest(struct vcpu
     4.4          if ( dest_mode == 0 )
     4.5          {
     4.6              /* Physical mode. */
     4.7 -            if ( (dest == 0xFF) || (dest == v->vcpu_id) )
     4.8 +            if ( (dest == 0xFF) || (dest == VLAPIC_ID(target)) )
     4.9                  result = 1;
    4.10          }
    4.11          else
    4.12 @@ -900,7 +900,7 @@ static int vlapic_reset(struct vlapic *v
    4.13      struct vcpu *v = vlapic_vcpu(vlapic);
    4.14      int i;
    4.15  
    4.16 -    vlapic_set_reg(vlapic, APIC_ID,  v->vcpu_id << 24);
    4.17 +    vlapic_set_reg(vlapic, APIC_ID,  (v->vcpu_id + 1) << 24);
    4.18      vlapic_set_reg(vlapic, APIC_LVR, VLAPIC_VERSION);
    4.19  
    4.20      for ( i = 0; i < 8; i++ )