Statistics
| Branch: | Revision:

root / pc-bios / bios-pq / 0020-qemu-kvm-cfg-maxcpus.patch @ baef8a66

History | View | Annotate | Download (1.5 kB)

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) {