Commit baef8a666c137fae513a195c8abeb80e1806d7bd
Committed by
Anthony Liguori
1 parent
6be68d7e
QEMU BOCHS bios patches to use maxcpus value.
Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
4 changed files
with
181 additions
and
0 deletions
pc-bios/bios-pq/0020-qemu-kvm-cfg-maxcpus.patch
0 → 100644
1 | +Read max_cpus variable from QEMU_CFG. If not provided, use value of | |
2 | +smp_cpus. | |
3 | + | |
4 | +Signed-off-by: Jes Sorensen <jes@sgi.com> | |
5 | + | |
6 | +diff --git a/bios/rombios.h b/bios/rombios.h | |
7 | +index 8ece2ee..dbf3bd3 100644 | |
8 | +--- a/bios/rombios.h | |
9 | ++++ b/bios/rombios.h | |
10 | +@@ -65,6 +65,7 @@ | |
11 | + #define QEMU_CFG_UUID 0x02 | |
12 | + #define QEMU_CFG_NUMA 0x0d | |
13 | + #define QEMU_CFG_BOOT_MENU 0x0e | |
14 | ++#define QEMU_CFG_MAX_CPUS 0x0f | |
15 | + #define QEMU_CFG_ARCH_LOCAL 0x8000 | |
16 | + #define QEMU_CFG_ACPI_TABLES (QEMU_CFG_ARCH_LOCAL + 0) | |
17 | + #define QEMU_CFG_SMBIOS_ENTRIES (QEMU_CFG_ARCH_LOCAL + 1) | |
18 | +diff --git a/bios/rombios32.c b/bios/rombios32.c | |
19 | +index 69e82b1..610fc1f 100644 | |
20 | +--- a/bios/rombios32.c | |
21 | ++++ b/bios/rombios32.c | |
22 | +@@ -436,6 +436,7 @@ void delay_ms(int n) | |
23 | + } | |
24 | + | |
25 | + uint16_t smp_cpus; | |
26 | ++uint16_t max_cpus; | |
27 | + uint32_t cpuid_signature; | |
28 | + uint32_t cpuid_features; | |
29 | + uint32_t cpuid_ext_features; | |
30 | +@@ -526,6 +527,19 @@ static uint16_t smbios_entries(void) | |
31 | + return cnt; | |
32 | + } | |
33 | + | |
34 | ++static uint16_t get_max_cpus(void) | |
35 | ++{ | |
36 | ++ uint16_t cnt; | |
37 | ++ | |
38 | ++ qemu_cfg_select(QEMU_CFG_MAX_CPUS); | |
39 | ++ qemu_cfg_read((uint8_t*)&cnt, sizeof(cnt)); | |
40 | ++ | |
41 | ++ if (!cnt) | |
42 | ++ cnt = smp_cpus; | |
43 | ++ | |
44 | ++ return cnt; | |
45 | ++} | |
46 | ++ | |
47 | + uint64_t qemu_cfg_get64 (void) | |
48 | + { | |
49 | + uint64_t ret; | |
50 | +@@ -2689,6 +2703,12 @@ void rombios32_init(uint32_t *s3_resume_vector, uint8_t *shutdown_flag) | |
51 | + | |
52 | + smp_probe(); | |
53 | + | |
54 | ++#ifdef BX_QEMU | |
55 | ++ max_cpus = get_max_cpus(); | |
56 | ++#else | |
57 | ++ max_cpus = smp_cpus; | |
58 | ++#endif | |
59 | ++ | |
60 | + find_bios_table_area(); | |
61 | + | |
62 | + if (*shutdown_flag == 0xfe) { | ... | ... |
pc-bios/bios-pq/0021-qemu-madt-maxcpus.patch
0 → 100644
1 | +Use max_cpus when building bios tables. | |
2 | + | |
3 | +Signed-off-by: Jes Sorensen <jes@sgi.com> | |
4 | + | |
5 | +diff --git a/bios/rombios32.c b/bios/rombios32.c | |
6 | +index e6bb164..3d15283 100644 | |
7 | +--- a/bios/rombios32.c | |
8 | ++++ b/bios/rombios32.c | |
9 | +@@ -1145,23 +1145,25 @@ static void mptable_init(void) | |
10 | + putle32(&q, 0); /* OEM table ptr */ | |
11 | + putle16(&q, 0); /* OEM table size */ | |
12 | + #ifdef BX_QEMU | |
13 | +- putle16(&q, smp_cpus + 17); /* entry count */ | |
14 | ++ putle16(&q, max_cpus + 17); /* entry count */ | |
15 | + #else | |
16 | +- putle16(&q, smp_cpus + 18); /* entry count */ | |
17 | ++ putle16(&q, max_cpus + 18); /* entry count */ | |
18 | + #endif | |
19 | + putle32(&q, 0xfee00000); /* local APIC addr */ | |
20 | + putle16(&q, 0); /* ext table length */ | |
21 | + putb(&q, 0); /* ext table checksum */ | |
22 | + putb(&q, 0); /* reserved */ | |
23 | + | |
24 | +- for(i = 0; i < smp_cpus; i++) { | |
25 | ++ for(i = 0; i < max_cpus; i++) { | |
26 | + putb(&q, 0); /* entry type = processor */ | |
27 | + putb(&q, i); /* APIC id */ | |
28 | + putb(&q, 0x11); /* local APIC version number */ | |
29 | + if (i == 0) | |
30 | + putb(&q, 3); /* cpu flags: enabled, bootstrap cpu */ | |
31 | +- else | |
32 | ++ else if (i < smp_cpus) | |
33 | + putb(&q, 1); /* cpu flags: enabled */ | |
34 | ++ else | |
35 | ++ putb(&q, 0); /* cpu flags: disabled */ | |
36 | + putb(&q, 0); /* cpu signature */ | |
37 | + putb(&q, 6); | |
38 | + putb(&q, 0); | |
39 | +@@ -1181,7 +1183,7 @@ static void mptable_init(void) | |
40 | + putstr(&q, "ISA "); | |
41 | + | |
42 | + /* ioapic */ | |
43 | +- ioapic_id = smp_cpus; | |
44 | ++ ioapic_id = max_cpus; | |
45 | + putb(&q, 2); /* entry type = I/O APIC */ | |
46 | + putb(&q, ioapic_id); /* apic ID */ | |
47 | + putb(&q, 0x11); /* I/O APIC version number */ | |
48 | +@@ -1581,7 +1583,7 @@ int acpi_build_processor_ssdt(uint8_t *ssdt) | |
49 | + { | |
50 | + uint8_t *ssdt_ptr = ssdt; | |
51 | + int i, length; | |
52 | +- int acpi_cpus = smp_cpus > 0xff ? 0xff : smp_cpus; | |
53 | ++ int acpi_cpus = max_cpus > 0xff ? 0xff : max_cpus; | |
54 | + | |
55 | + ssdt_ptr[9] = 0; // checksum; | |
56 | + ssdt_ptr += sizeof(struct acpi_table_header); | |
57 | +@@ -1713,7 +1715,7 @@ void acpi_bios_init(void) | |
58 | + addr = (addr + 7) & ~7; | |
59 | + srat_addr = addr; | |
60 | + srat_size = sizeof(*srat) + | |
61 | +- sizeof(struct srat_processor_affinity) * smp_cpus + | |
62 | ++ sizeof(struct srat_processor_affinity) * max_cpus + | |
63 | + sizeof(struct srat_memory_affinity) * (nb_numa_nodes + 2); | |
64 | + srat = (void *)(addr); | |
65 | + addr += srat_size; | |
66 | +@@ -1726,7 +1728,7 @@ void acpi_bios_init(void) | |
67 | + addr = (addr + 7) & ~7; | |
68 | + madt_addr = addr; | |
69 | + madt_size = sizeof(*madt) + | |
70 | +- sizeof(struct madt_processor_apic) * smp_cpus + | |
71 | ++ sizeof(struct madt_processor_apic) * max_cpus + | |
72 | + #ifdef BX_QEMU | |
73 | + sizeof(struct madt_io_apic) + sizeof(struct madt_int_override); | |
74 | + #else | |
75 | +@@ -1799,18 +1801,21 @@ void acpi_bios_init(void) | |
76 | + madt->local_apic_address = cpu_to_le32(0xfee00000); | |
77 | + madt->flags = cpu_to_le32(1); | |
78 | + apic = (void *)(madt + 1); | |
79 | +- for(i=0;i<smp_cpus;i++) { | |
80 | ++ for(i = 0;i < max_cpus; i++) { | |
81 | + apic->type = APIC_PROCESSOR; | |
82 | + apic->length = sizeof(*apic); | |
83 | + apic->processor_id = i; | |
84 | + apic->local_apic_id = i; | |
85 | +- apic->flags = cpu_to_le32(1); | |
86 | ++ if (i < smp_cpus) | |
87 | ++ apic->flags = cpu_to_le32(1); | |
88 | ++ else | |
89 | ++ apic->flags = 0; | |
90 | + apic++; | |
91 | + } | |
92 | + io_apic = (void *)apic; | |
93 | + io_apic->type = APIC_IO; | |
94 | + io_apic->length = sizeof(*io_apic); | |
95 | +- io_apic->io_apic_id = smp_cpus; | |
96 | ++ io_apic->io_apic_id = max_cpus; | |
97 | + io_apic->address = cpu_to_le32(0xfec00000); | |
98 | + io_apic->interrupt = cpu_to_le32(0); | |
99 | + #ifdef BX_QEMU | |
100 | +@@ -1844,7 +1849,7 @@ void acpi_bios_init(void) | |
101 | + srat->reserved1=1; | |
102 | + | |
103 | + core = (void*)(srat + 1); | |
104 | +- for (i = 0; i < smp_cpus; ++i) { | |
105 | ++ for (i = 0; i < max_cpus; ++i) { | |
106 | + core->type = SRAT_PROCESSOR; | |
107 | + core->length = sizeof(*core); | |
108 | + core->local_apic_id = i; | |
109 | +@@ -2603,7 +2608,7 @@ void smbios_init(void) | |
110 | + add_struct(0, p); | |
111 | + add_struct(1, p); | |
112 | + add_struct(3, p); | |
113 | +- for (cpu_num = 1; cpu_num <= smp_cpus; cpu_num++) | |
114 | ++ for (cpu_num = 1; cpu_num <= max_cpus; cpu_num++) | |
115 | + add_struct(4, p, cpu_num); | |
116 | + | |
117 | + /* Each 'memory device' covers up to 16GB of address space. */ | ... | ... |
pc-bios/bios-pq/series
pc-bios/bios.bin
No preview for this file type