@@ -281,3 +281,15 @@ void qemu_cfg_get_numa_data(u64 *data, int n)
for (i = 0; i < n; i++)
qemu_cfg_read((u8*)(data + i), sizeof(u64));
}
+
+u16 qemu_cfg_get_max_cpus(void)
+{
+ u16 cnt;
+
+ if (!qemu_cfg_present)
+ return 0;
+
+ qemu_cfg_read_entry(&cnt, QEMU_CFG_MAX_CPUS, sizeof(cnt));
+
+ return cnt;
+}
@@ -51,5 +51,6 @@ int qemu_cfg_smbios_load_external(int type, char **p, unsigned *nr_structs,
unsigned *max_struct_size, char *end);
int qemu_cfg_get_numa_nodes(void);
void qemu_cfg_get_numa_data(u64 *data, int n);
+u16 qemu_cfg_get_max_cpus(void);
#endif
@@ -9,6 +9,7 @@
#include "config.h" // CONFIG_*
#include "cmos.h" // CMOS_BIOS_SMP_COUNT
#include "farptr.h" // ASSERT32
+#include "paravirt.h"
#define APIC_ICR_LOW ((u8*)BUILD_APIC_ADDR + 0x300)
#define APIC_SVR ((u8*)BUILD_APIC_ADDR + 0x0F0)
@@ -61,6 +62,7 @@ wrmsr_smp(u32 index, u64 val)
}
u32 CountCPUs VAR16VISIBLE;
+u32 MaxCountCPUs VAR16VISIBLE;
extern void smp_ap_boot_code();
ASM16(
" .global smp_ap_boot_code\n"
@@ -134,7 +136,12 @@ smp_probe(void)
// Restore memory.
*(u64*)BUILD_AP_BOOT_ADDR = old;
- dprintf(1, "Found %d cpu(s)\n", readl(&CountCPUs));
+ MaxCountCPUs = qemu_cfg_get_max_cpus();
+ if (!MaxCountCPUs || MaxCountCPUs < CountCPUs)
+ MaxCountCPUs = CountCPUs;
+
+ dprintf(1, "Found %d cpu(s) max supported %d cpu(s)\n", readl(&CountCPUs),
+ MaxCountCPUs);
}
// Reset variables to zero
@@ -221,6 +221,7 @@ void smm_init();
// smp.c
extern u32 CountCPUs;
+extern u32 MaxCountCPUs;
void wrmsr_smp(u32 index, u64 val);
void smp_probe(void);
void smp_probe_setup(void);
Signed-off-by: Gleb Natapov <gleb@redhat.com> --- src/paravirt.c | 12 ++++++++++++ src/paravirt.h | 1 + src/smp.c | 9 ++++++++- src/util.h | 1 + 4 files changed, 22 insertions(+), 1 deletions(-)