# HG changeset patch # User tristan.gingold@xxxxxxxx # Node ID db769650b049d71df4423fdb83bc4ef3d85b2e19 # Parent 0c231aafd1b0e19545b3c2f5bddf08a030c8a7f4 Virtualize lid for domU. LSAPIC table cleaned for SMP-g. Signed-off-by: Tristan Gingold diff -r 0c231aafd1b0 -r db769650b049 xen/arch/ia64/xen/dom_fw.c --- a/xen/arch/ia64/xen/dom_fw.c Wed Mar 15 08:18:25 2006 +++ b/xen/arch/ia64/xen/dom_fw.c Wed Mar 15 10:52:37 2006 @@ -513,15 +513,15 @@ struct acpi_table_header dsdt; u8 aml[16]; struct acpi_table_madt madt; - struct acpi_table_lsapic lsapic; + struct acpi_table_lsapic lsapic[MAX_VIRT_CPUS]; u8 pm1a_evt_blk[4]; u8 pm1a_cnt_blk[1]; u8 pm_tmr_blk[4]; }; /* Create enough of an ACPI structure to make the guest OS ACPI happy. */ -void -dom_fw_fake_acpi(struct fake_acpi_tables *tables) +static void +dom_fw_fake_acpi(struct domain *d, struct fake_acpi_tables *tables) { struct acpi20_table_rsdp *rsdp = &tables->rsdp; struct xsdt_descriptor_rev2 *xsdt = &tables->xsdt; @@ -529,7 +529,8 @@ struct facs_descriptor_rev2 *facs = &tables->facs; struct acpi_table_header *dsdt = &tables->dsdt; struct acpi_table_madt *madt = &tables->madt; - struct acpi_table_lsapic *lsapic = &tables->lsapic; + struct acpi_table_lsapic *lsapic = tables->lsapic; + int i; memset(tables, 0, sizeof(struct fake_acpi_tables)); @@ -621,16 +622,20 @@ strncpy(madt->header.signature, APIC_SIG, 4); madt->header.revision = 2; madt->header.length = sizeof(struct acpi_table_madt) + - sizeof(struct acpi_table_lsapic); + MAX_VIRT_CPUS * sizeof(struct acpi_table_lsapic); strcpy(madt->header.oem_id, "XEN"); strcpy(madt->header.oem_table_id, "Xen/ia64"); strcpy(madt->header.asl_compiler_id, "XEN"); madt->header.asl_compiler_revision = (XEN_VERSION<<16)|(XEN_SUBVERSION); - /* A single LSAPIC entry describes the CPU. Revisit for SMP guests */ - lsapic->header.type = ACPI_MADT_LSAPIC; - lsapic->header.length = sizeof(struct acpi_table_lsapic); - lsapic->flags.enabled = 1; + /* An LSAPIC entry describes a CPU. */ + for (i = 0; i < MAX_VIRT_CPUS; i++) { + lsapic[i].header.type = ACPI_MADT_LSAPIC; + lsapic[i].header.length = sizeof(struct acpi_table_lsapic); + lsapic[i].id = i; + lsapic[i].eid = 0; + lsapic[i].flags.enabled = (d->vcpu[i] != NULL); + } madt->header.checksum = generate_acpi_checksum(madt, madt->header.length); @@ -784,7 +789,7 @@ acpi_tables = (void *)cp; cp += sizeof(struct fake_acpi_tables); - dom_fw_fake_acpi(acpi_tables); + dom_fw_fake_acpi(d, acpi_tables); efi_tables[i].guid = ACPI_20_TABLE_GUID; efi_tables[i].table = dom_pa((unsigned long) acpi_tables); diff -r 0c231aafd1b0 -r db769650b049 xen/arch/ia64/xen/vcpu.c --- a/xen/arch/ia64/xen/vcpu.c Wed Mar 15 08:18:25 2006 +++ b/xen/arch/ia64/xen/vcpu.c Wed Mar 15 10:52:37 2006 @@ -726,12 +726,12 @@ IA64FAULT vcpu_get_lid(VCPU *vcpu, UINT64 *pval) { -//extern unsigned long privop_trace; -//privop_trace=1; - //TODO: Implement this - printf("vcpu_get_lid: WARNING: Getting cr.lid always returns zero\n"); - //*pval = 0; - *pval = ia64_getreg(_IA64_REG_CR_LID); + /* Use real LID for domain0 until vIOSAPIC is present. + Use EID=0, ID=vcpu_id for domU. */ + if (vcpu->domain == dom0) + *pval = ia64_getreg(_IA64_REG_CR_LID); + else + *pval = vcpu->vcpu_id << 24; return IA64_NO_FAULT; }