[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [HVM] Move IOAPIC ID back to 0x00. Shift LAPIC IDs to 0x01 upwards.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID b6c6a1efbfaf49a1d999699cb9b7dd1f4b32bf3f
# Parent  63786d35bc48f761c35ab72b88beb70ccdb848ec
[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@xxxxxxxxxxxxx>
---
 tools/firmware/hvmloader/acpi/build.c |    5 ++---
 tools/firmware/hvmloader/config.h     |    2 +-
 tools/firmware/hvmloader/mp_tables.c  |    2 +-
 xen/arch/x86/hvm/vlapic.c             |    4 ++--
 4 files changed, 6 insertions(+), 7 deletions(-)

diff -r 63786d35bc48 -r b6c6a1efbfaf tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c     Mon Nov 27 11:39:54 2006 +0000
+++ b/tools/firmware/hvmloader/acpi/build.c     Mon Nov 27 12:00:01 2006 +0000
@@ -88,14 +88,13 @@ int construct_madt(struct acpi_20_madt *
     io_apic->ioapic_addr = IOAPIC_BASE_ADDRESS;
     offset += sizeof(*io_apic);
 
-    lapic = (struct acpi_20_madt_lapic *)io_apic;
+    lapic = (struct acpi_20_madt_lapic *)(io_apic + 1);
     for ( i = 0; i < get_vcpu_nr(); i++ )
     {
         memset(lapic, 0, sizeof(*lapic));
         lapic->type    = ACPI_PROCESSOR_LOCAL_APIC;
         lapic->length  = sizeof(*lapic);
-        lapic->acpi_processor_id = i;
-        lapic->apic_id = i;
+        lapic->acpi_processor_id = lapic->apic_id = i + 1;
         lapic->flags   = ACPI_LOCAL_APIC_ENABLED;
         offset += sizeof(*lapic);
         lapic++;
diff -r 63786d35bc48 -r b6c6a1efbfaf tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h Mon Nov 27 11:39:54 2006 +0000
+++ b/tools/firmware/hvmloader/config.h Mon Nov 27 12:00:01 2006 +0000
@@ -2,7 +2,7 @@
 #define __HVMLOADER_CONFIG_H__
 
 #define IOAPIC_BASE_ADDRESS 0xfec00000
-#define IOAPIC_ID           0xfe
+#define IOAPIC_ID           0x00
 #define IOAPIC_VERSION      0x11
 
 #define LAPIC_BASE_ADDRESS  0xfee00000
diff -r 63786d35bc48 -r b6c6a1efbfaf tools/firmware/hvmloader/mp_tables.c
--- a/tools/firmware/hvmloader/mp_tables.c      Mon Nov 27 11:39:54 2006 +0000
+++ b/tools/firmware/hvmloader/mp_tables.c      Mon Nov 27 12:00:01 2006 +0000
@@ -223,7 +223,7 @@ void fill_mp_proc_entry(struct mp_proc_e
 void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
 {
     mppe->type = ENTRY_TYPE_PROCESSOR;
-    mppe->lapic_id = vcpu_id;
+    mppe->lapic_id = vcpu_id + 1;
     mppe->lapic_version = 0x11;
     mppe->cpu_flags = CPU_FLAG_ENABLED;
     if ( vcpu_id == 0 )
diff -r 63786d35bc48 -r b6c6a1efbfaf xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c Mon Nov 27 11:39:54 2006 +0000
+++ b/xen/arch/x86/hvm/vlapic.c Mon Nov 27 12:00:01 2006 +0000
@@ -240,7 +240,7 @@ static int vlapic_match_dest(struct vcpu
         if ( dest_mode == 0 )
         {
             /* Physical mode. */
-            if ( (dest == 0xFF) || (dest == v->vcpu_id) )
+            if ( (dest == 0xFF) || (dest == VLAPIC_ID(target)) )
                 result = 1;
         }
         else
@@ -900,7 +900,7 @@ static int vlapic_reset(struct vlapic *v
     struct vcpu *v = vlapic_vcpu(vlapic);
     int i;
 
-    vlapic_set_reg(vlapic, APIC_ID,  v->vcpu_id << 24);
+    vlapic_set_reg(vlapic, APIC_ID,  (v->vcpu_id + 1) << 24);
     vlapic_set_reg(vlapic, APIC_LVR, VLAPIC_VERSION);
 
     for ( i = 0; i < 8; i++ )

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.