From: Jes Sorensen <jes@sgi.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>, Avi Kivity <avi@redhat.com>
Subject: [Qemu-devel] [patch 2/2] QEMU BOCHS bios patches to use maxcpus value.
Date: Tue, 23 Jun 2009 12:00:11 +0200 [thread overview]
Message-ID: <20090623100358.441238372@sgi.com> (raw)
In-Reply-To: 20090623100009.827553739@sgi.com
[-- Attachment #1: 0002-qemu-bios-patches.patch --]
[-- Type: text/plain, Size: 6708 bytes --]
Signed-off-by: Jes Sorensen <jes@sgi.com>
---
pc-bios/bios-pq/0017-qemu-kvm-cfg-maxcpus.patch | 57 +++++++++++++
pc-bios/bios-pq/0018-qemu-madt-maxcpus.patch | 105 ++++++++++++++++++++++++
pc-bios/bios-pq/series | 2
3 files changed, 164 insertions(+)
Index: qemu/pc-bios/bios-pq/0017-qemu-kvm-cfg-maxcpus.patch
===================================================================
--- /dev/null
+++ qemu/pc-bios/bios-pq/0017-qemu-kvm-cfg-maxcpus.patch
@@ -0,0 +1,57 @@
+Read max_cpus variable from QEMU_CFG. If not provided, use value of
+smp_cpus.
+
+Signed-off-by: Jes Sorensen <jes@sgi.com>
+
+diff --git a/bios/rombios32.c b/bios/rombios32.c
+index f861f81..f4a6300 100644
+--- a/bios/rombios32.c
++++ b/bios/rombios32.c
+@@ -436,6 +436,7 @@ void delay_ms(int n)
+ }
+
+ uint16_t smp_cpus;
++uint16_t max_cpus;
+ uint32_t cpuid_signature;
+ uint32_t cpuid_features;
+ uint32_t cpuid_ext_features;
+@@ -474,6 +475,7 @@ void wrmsr_smp(uint32_t index, uint64_t val)
+ #define QEMU_CFG_ID 0x01
+ #define QEMU_CFG_UUID 0x02
+ #define QEMU_CFG_NUMA 0x0D
++#define QEMU_CFG_MAX_CPUS 0x0E
+ #define QEMU_CFG_ARCH_LOCAL 0x8000
+ #define QEMU_CFG_ACPI_TABLES (QEMU_CFG_ARCH_LOCAL + 0)
+ #define QEMU_CFG_SMBIOS_ENTRIES (QEMU_CFG_ARCH_LOCAL + 1)
+@@ -536,6 +538,19 @@ static uint16_t smbios_entries(void)
+ return cnt;
+ }
+
++static uint16_t get_max_cpus(void)
++{
++ uint16_t cnt;
++
++ qemu_cfg_select(QEMU_CFG_MAX_CPUS);
++ qemu_cfg_read((uint8_t*)&cnt, sizeof(cnt));
++
++ if (!cnt)
++ cnt = smp_cpus;
++
++ return cnt;
++}
++
+ uint64_t qemu_cfg_get64 (void)
+ {
+ uint64_t ret;
+@@ -1655,6 +1670,11 @@ void acpi_bios_init(void)
+ uint16_t i, external_tables;
+ int nb_numa_nodes;
+
++#ifdef BX_QEMU
++ max_cpus = get_max_cpus();
++#else
++ max_cpus = smp_cpus;
++#endif
+ /* reserve memory space for tables */
+ #ifdef BX_USE_EBDA_TABLES
+ ebda_cur_addr = align(ebda_cur_addr, 16);
Index: qemu/pc-bios/bios-pq/0018-qemu-madt-maxcpus.patch
===================================================================
--- /dev/null
+++ qemu/pc-bios/bios-pq/0018-qemu-madt-maxcpus.patch
@@ -0,0 +1,105 @@
+Use max_cpus when building bios tables.
+
+Signed-off-by: Jes Sorensen <jes@sgi.com>
+
+diff --git a/bios/rombios32.c b/bios/rombios32.c
+index f4a6300..fb4d663 100644
+--- a/bios/rombios32.c
++++ b/bios/rombios32.c
+@@ -1155,13 +1155,13 @@ static void mptable_init(void)
+ 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 */
+@@ -1188,7 +1188,7 @@ static void mptable_init(void)
+ 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 */
+@@ -1588,7 +1588,7 @@ int acpi_build_processor_ssdt(uint8_t *ssdt)
+ {
+ uint8_t *ssdt_ptr = ssdt;
+ int i, length;
+- int acpi_cpus = smp_cpus > 0xff ? 0xff : smp_cpus;
++ int acpi_cpus = max_cpus > 0xff ? 0xff : max_cpus;
+
+ ssdt_ptr[9] = 0; // checksum;
+ ssdt_ptr += sizeof(struct acpi_table_header);
+@@ -1725,7 +1725,7 @@ void acpi_bios_init(void)
+ addr = (addr + 7) & ~7;
+ srat_addr = addr;
+ srat_size = sizeof(*srat) +
+- sizeof(struct srat_processor_affinity) * smp_cpus +
++ sizeof(struct srat_processor_affinity) * max_cpus +
+ sizeof(struct srat_memory_affinity) * (nb_numa_nodes + 2);
+ srat = (void *)(addr);
+ addr += srat_size;
+@@ -1738,7 +1738,7 @@ void acpi_bios_init(void)
+ 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 +
+ #ifdef BX_QEMU
+ sizeof(struct madt_io_apic) + sizeof(struct madt_int_override);
+ #else
+@@ -1811,7 +1811,7 @@ void acpi_bios_init(void)
+ madt->local_apic_address = cpu_to_le32(0xfee00000);
+ madt->flags = cpu_to_le32(1);
+ apic = (void *)(madt + 1);
+- for(i=0;i<smp_cpus;i++) {
++ for(i = 0;i < max_cpus; i++) {
+ apic->type = APIC_PROCESSOR;
+ apic->length = sizeof(*apic);
+ apic->processor_id = i;
+@@ -1822,7 +1822,7 @@ void acpi_bios_init(void)
+ 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);
+ #ifdef BX_QEMU
+@@ -1856,7 +1856,7 @@ void acpi_bios_init(void)
+ srat->reserved1=1;
+
+ core = (void*)(srat + 1);
+- for (i = 0; i < smp_cpus; ++i) {
++ for (i = 0; i < max_cpus; ++i) {
+ core->type = SRAT_PROCESSOR;
+ core->length = sizeof(*core);
+ core->local_apic_id = i;
+@@ -1864,7 +1864,7 @@ void acpi_bios_init(void)
+ core->proximity_lo = curnode;
+ memset (core->proximity_hi, 0, 3);
+ core->local_sapic_eid = 0;
+- if (i < smp_cpus)
++ if (i < max_cpus)
+ core->flags = cpu_to_le32(1);
+ else
+ core->flags = 0;
+@@ -2614,7 +2614,7 @@ void smbios_init(void)
+ add_struct(0, p);
+ add_struct(1, p);
+ add_struct(3, p);
+- for (cpu_num = 1; cpu_num <= smp_cpus; cpu_num++)
++ for (cpu_num = 1; cpu_num <= max_cpus; cpu_num++)
+ add_struct(4, p, cpu_num);
+
+ /* Each 'memory device' covers up to 16GB of address space. */
Index: qemu/pc-bios/bios-pq/series
===================================================================
--- qemu.orig/pc-bios/bios-pq/series
+++ qemu/pc-bios/bios-pq/series
@@ -14,3 +14,5 @@
0014_add-srat-acpi-table-support.patch
0015_enable-power-button-even-generation.patch
0016-use-correct-mask-to-size-pci-option-rom-bar.patch
+0017-qemu-kvm-cfg-maxcpus.patch
+0018-qemu-madt-maxcpus.patch
next prev parent reply other threads:[~2009-06-23 10:55 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-23 10:00 [Qemu-devel] [patch 0/2] QEMU maxcpus support Jes Sorensen
2009-06-23 10:00 ` [Qemu-devel] [patch 1/2] Introduce -maxcpus flag to QEMU and pass the value to the BIOS through FW_CFG Jes Sorensen
2009-06-23 10:00 ` Jes Sorensen [this message]
2009-06-23 11:37 ` [Qemu-devel] Re: [patch 0/2] QEMU maxcpus support Avi Kivity
2009-06-23 13:32 ` Jes Sorensen
2009-06-23 13:36 ` Avi Kivity
2009-06-23 15:07 ` Jes Sorensen
2009-06-23 15:47 ` Avi Kivity
2009-06-24 7:16 ` Jes Sorensen
2009-06-24 7:25 ` Filip Navara
-- strict thread matches above, loose matches on Subject: below --
2009-06-24 8:35 [Qemu-devel] [patch 0/2] QEMU maxcpus support v2 Jes Sorensen
2009-06-24 8:35 ` [Qemu-devel] [patch 2/2] QEMU BOCHS bios patches to use maxcpus value Jes Sorensen
2009-07-09 21:57 ` Anthony Liguori
2009-07-12 9:39 ` Avi Kivity
2009-07-12 13:23 ` Anthony Liguori
2009-07-12 13:36 ` Avi Kivity
2009-07-14 8:38 ` Jes Sorensen
2009-07-14 9:21 ` Filip Navara
2009-07-14 9:32 ` Gleb Natapov
2009-07-14 10:16 ` Alexander Graf
2009-07-14 11:15 ` Filip Navara
2009-07-14 11:21 ` Jes Sorensen
2009-07-14 12:53 [Qemu-devel] [PATCH 0/2] QEMU maxcpus support v2 Jes Sorensen
2009-07-14 12:53 ` [Qemu-devel] [PATCH 2/2] QEMU BOCHS bios patches to use maxcpus value Jes Sorensen
2009-07-20 14:43 [Qemu-devel] [PATCH 0/2] QEMU maxcpus support v3 Jes Sorensen
2009-07-20 14:43 ` [Qemu-devel] [PATCH 2/2] QEMU BOCHS bios patches to use maxcpus value Jes Sorensen
2009-07-23 15:03 [Qemu-devel] [PATCH 0/2] QEMU maxcpus support v4 Jes Sorensen
2009-07-23 15:03 ` [Qemu-devel] [PATCH 2/2] QEMU BOCHS bios patches to use maxcpus value Jes Sorensen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090623100358.441238372@sgi.com \
--to=jes@sgi.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).