From patchwork Tue Jun 9 15:55:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beth Kon X-Patchwork-Id: 29042 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n59Fsl1f020006 for ; Tue, 9 Jun 2009 15:54:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752743AbZFIPyl (ORCPT ); Tue, 9 Jun 2009 11:54:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753242AbZFIPyl (ORCPT ); Tue, 9 Jun 2009 11:54:41 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:42700 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752208AbZFIPyl (ORCPT ); Tue, 9 Jun 2009 11:54:41 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e39.co.us.ibm.com (8.13.1/8.13.1) with ESMTP id n59FohuP026795 for ; Tue, 9 Jun 2009 09:50:43 -0600 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n59FsZef066452 for ; Tue, 9 Jun 2009 09:54:35 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n59FsYD0010730 for ; Tue, 9 Jun 2009 09:54:35 -0600 Received: from localhost.localdomain (sig-9-65-123-8.mts.ibm.com [9.65.123.8]) by d03av03.boulder.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n59FsYjP010709; Tue, 9 Jun 2009 09:54:34 -0600 From: Beth Kon To: avi@redhat.com Cc: kvm@vger.kernel.org, Beth Kon Subject: [PATCH 1/2] Clean up MADT Table Creation (v2) Date: Tue, 9 Jun 2009 11:55:22 -0400 Message-Id: <1244562923-4336-1-git-send-email-eak@us.ibm.com> X-Mailer: git-send-email 1.5.4.3 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This patch is based on the recent patch from Vincent Minet. I split Vincent's changes into 2 patches (to separate MADT and RSDT table cleanup, as suggested by Marcelo) and added a bit to them. There has been much ado over the acpi_bios_init function recently. I had actually done a rewrite very similar to Gleb's, but Avi argued that the rewrite has to be more incremental. This patch contains minimal changes without any rewrite because the changes are kvm-only. The rewrite would better be a separate step, submitted to qemu and then merged into kvm. I am submitting the RSDT fix to kvm because the kvm and qemu RSDT implementation differs. Again, as a separate rewrite effort, the kvm and qemu RSDT manipulation could be merged into one base as a later, separate step. This patch will get MADT into reasonable enough shape for me to resubmit hpet patches on top of it. After that, I'd be willing to submit incremental rewrite patches for acpi_bios_init to qemu, starting with MADT and RSDT. Signed-off-by: Beth Kon --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kvm/bios/rombios32.c b/kvm/bios/rombios32.c index 369cbef..cdae363 100755 --- a/kvm/bios/rombios32.c +++ b/kvm/bios/rombios32.c @@ -86,6 +86,8 @@ typedef unsigned long long uint64_t; #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg)) #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1) +#define MAX_INT_OVERRIDES 16 + static inline void outl(int addr, int val) { asm volatile ("outl %1, %w0" : : "d" (addr), "a" (val)); @@ -1600,7 +1602,7 @@ void acpi_bios_init(void) uint32_t hpet_addr; #endif uint32_t base_addr, rsdt_addr, fadt_addr, addr, facs_addr, dsdt_addr, ssdt_addr; - uint32_t acpi_tables_size, madt_addr, madt_size, rsdt_size; + uint32_t acpi_tables_size, madt_addr, madt_size, rsdt_size, madt_end; uint32_t srat_addr,srat_size; uint16_t i, external_tables; int nb_numa_nodes; @@ -1668,7 +1670,7 @@ void acpi_bios_init(void) madt_size = sizeof(*madt) + sizeof(struct madt_processor_apic) * MAX_CPUS + #ifdef BX_QEMU - sizeof(struct madt_io_apic) /* + sizeof(struct madt_int_override) */; + sizeof(struct madt_io_apic) + sizeof(struct madt_int_override) * MAX_INT_OVERRIDES; #else sizeof(struct madt_io_apic); #endif @@ -1786,8 +1788,9 @@ void acpi_bios_init(void) continue; } int_override++; - madt_size += sizeof(struct madt_int_override); } + madt_end = (uint32_t)int_override; + madt_size = madt_end - madt_addr; acpi_build_table_header((struct acpi_table_header *)madt, "APIC", madt_size, 1); }