# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxxx
# Date 1167568002 0
# Node ID 4fc6ffff2ac583dc0c386eb3452484b31b37fd0e
# Parent dbddea768e2933b7379d1f10a410081f4946f33f
[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@xxxxxxxxxxxxx>
---
tools/firmware/hvmloader/acpi/build.c | 2 +-
tools/firmware/hvmloader/config.h | 3 ++-
tools/firmware/hvmloader/mp_tables.c | 2 +-
xen/arch/x86/hvm/vlapic.c | 2 +-
4 files changed, 5 insertions(+), 4 deletions(-)
diff -r dbddea768e29 -r 4fc6ffff2ac5 tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c Sun Dec 31 11:59:47 2006 +0000
+++ b/tools/firmware/hvmloader/acpi/build.c Sun Dec 31 12:26:42 2006 +0000
@@ -110,7 +110,7 @@ int construct_madt(struct acpi_20_madt *
memset(lapic, 0, sizeof(*lapic));
lapic->type = ACPI_PROCESSOR_LOCAL_APIC;
lapic->length = sizeof(*lapic);
- lapic->acpi_processor_id = lapic->apic_id = i + 1;
+ lapic->acpi_processor_id = lapic->apic_id = LAPIC_ID(i);
lapic->flags = ACPI_LOCAL_APIC_ENABLED;
offset += sizeof(*lapic);
lapic++;
diff -r dbddea768e29 -r 4fc6ffff2ac5 tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h Sun Dec 31 11:59:47 2006 +0000
+++ b/tools/firmware/hvmloader/config.h Sun Dec 31 12:26:42 2006 +0000
@@ -2,10 +2,11 @@
#define __HVMLOADER_CONFIG_H__
#define IOAPIC_BASE_ADDRESS 0xfec00000
-#define IOAPIC_ID 0x00
+#define IOAPIC_ID 0x01
#define IOAPIC_VERSION 0x11
#define LAPIC_BASE_ADDRESS 0xfee00000
+#define LAPIC_ID(vcpu_id) ((vcpu_id) * 2)
#define PCI_ISA_DEVFN 0x08 /* dev 1, fn 0 */
#define PCI_ISA_IRQ_MASK 0x0c60U /* ISA IRQs 5,6,10,11 are PCI connected */
diff -r dbddea768e29 -r 4fc6ffff2ac5 tools/firmware/hvmloader/mp_tables.c
--- a/tools/firmware/hvmloader/mp_tables.c Sun Dec 31 11:59:47 2006 +0000
+++ b/tools/firmware/hvmloader/mp_tables.c Sun Dec 31 12:26:42 2006 +0000
@@ -222,7 +222,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 + 1;
+ mppe->lapic_id = LAPIC_ID(vcpu_id);
mppe->lapic_version = 0x11;
mppe->cpu_flags = CPU_FLAG_ENABLED;
if ( vcpu_id == 0 )
diff -r dbddea768e29 -r 4fc6ffff2ac5 xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c Sun Dec 31 11:59:47 2006 +0000
+++ b/xen/arch/x86/hvm/vlapic.c Sun Dec 31 12:26:42 2006 +0000
@@ -767,7 +767,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 + 1) << 24);
+ vlapic_set_reg(vlapic, APIC_ID, (v->vcpu_id * 2) << 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
|