From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JU63L-0006Bs-88 for qemu-devel@nongnu.org; Tue, 26 Feb 2008 15:05:27 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JU63G-0006A1-P1 for qemu-devel@nongnu.org; Tue, 26 Feb 2008 15:05:26 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JU63G-00069v-KS for qemu-devel@nongnu.org; Tue, 26 Feb 2008 15:05:22 -0500 Received: from mx1.redhat.com ([66.187.233.31]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JU63G-0001Cs-8R for qemu-devel@nongnu.org; Tue, 26 Feb 2008 15:05:22 -0500 From: Glauber Costa Date: Tue, 26 Feb 2008 16:56:32 -0300 Message-Id: <1204055805-32349-3-git-send-email-gcosta@redhat.com> In-Reply-To: <1204055805-32349-2-git-send-email-gcosta@redhat.com> References: <1204055805-32349-1-git-send-email-gcosta@redhat.com> <1204055805-32349-2-git-send-email-gcosta@redhat.com> Subject: [Qemu-devel] [PATCH 2/15] mark extra cpus as present Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kvm-devel@lists.sourceforge.net Cc: marcelo@kvack.org, glommer@gmail.com, qemu-devel@nongnu.org, Glauber Costa , chrisw@sous-sol.org Mark cpus over smp_cpus as present, but disable. The OS can then recognize it and make room for future hotplug Signed-off-by: Glauber Costa --- bios/rombios.h | 2 ++ bios/rombios32.c | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/bios/rombios.h b/bios/rombios.h index 412c5e9..2cf2bb3 100644 --- a/bios/rombios.h +++ b/bios/rombios.h @@ -58,6 +58,8 @@ #define PM_IO_BASE 0xb000 #define SMB_IO_BASE 0xb100 #define CPU_COUNT_ADDR 0xf000 +#define MAX_CPUS 16 + // Define the application NAME #if defined(BX_QEMU) # define BX_APPNAME "QEMU" diff --git a/bios/rombios32.c b/bios/rombios32.c index 3ec85cb..f2db740 100755 --- a/bios/rombios32.c +++ b/bios/rombios32.c @@ -948,20 +948,22 @@ #endif putstr(&q, "0.1 "); /* vendor id */ putle32(&q, 0); /* OEM table ptr */ putle16(&q, 0); /* OEM table size */ - putle16(&q, smp_cpus + 18); /* entry count */ + putle16(&q, MAX_CPUS + 18); /* entry count */ putle32(&q, 0xfee00000); /* local APIC addr */ putle16(&q, 0); /* ext table length */ putb(&q, 0); /* ext table checksum */ putb(&q, 0); /* reserved */ - for(i = 0; i < smp_cpus; i++) { + for(i = 0; i < MAX_CPUS ; i++) { putb(&q, 0); /* entry type = processor */ putb(&q, i); /* APIC id */ putb(&q, 0x11); /* local APIC version number */ if (i == 0) putb(&q, 3); /* cpu flags: enabled, bootstrap cpu */ - else + else if ( i < smp_cpus) putb(&q, 1); /* cpu flags: enabled */ + else + putb(&q, 0); /* cpu flags: disabled */ putb(&q, 0); /* cpu signature */ putb(&q, 6); putb(&q, 0); @@ -981,7 +983,7 @@ #endif putstr(&q, "ISA "); /* ioapic */ - ioapic_id = smp_cpus; + ioapic_id = MAX_CPUS; putb(&q, 2); /* entry type = I/O APIC */ putb(&q, ioapic_id); /* apic ID */ putb(&q, 0x11); /* I/O APIC version number */ @@ -1393,7 +1395,7 @@ #endif addr = (addr + 7) & ~7; madt_addr = addr; madt_size = sizeof(*madt) + - sizeof(struct madt_processor_apic) * smp_cpus + + sizeof(struct madt_processor_apic) * MAX_CPUS + sizeof(struct madt_io_apic); madt = (void *)(addr); addr += madt_size; @@ -1466,18 +1468,21 @@ #endif madt->local_apic_address = cpu_to_le32(0xfee00000); madt->flags = cpu_to_le32(1); apic = (void *)(madt + 1); - for(i=0;itype = APIC_PROCESSOR; apic->length = sizeof(*apic); apic->processor_id = i; apic->local_apic_id = i; - apic->flags = cpu_to_le32(1); + if (i < smp_cpus) + apic->flags = cpu_to_le32(1); + else + apic->flags = 0; apic++; } io_apic = (void *)apic; io_apic->type = APIC_IO; io_apic->length = sizeof(*io_apic); - io_apic->io_apic_id = smp_cpus; + io_apic->io_apic_id = MAX_CPUS; io_apic->address = cpu_to_le32(0xfec00000); io_apic->interrupt = cpu_to_le32(0); -- 1.4.2