[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH RFC 12/14] pc: add 'etc/boot-cpus' fw_cfg file for m

From: Igor Mammedov
Subject: [Qemu-devel] [PATCH RFC 12/14] pc: add 'etc/boot-cpus' fw_cfg file for machine with more than 255 CPUs
Date: Mon, 9 May 2016 11:26:58 +0200

Currently firmware uses 1 byte at 0x5F offset in RTC CMOS
to get number of CPUs present at boot. However 1 byte is
not enough to handle more than 255 CPUs.  So add a fw_cfg
file that would allow QEMU to tell it.
For compat reasons add file only for machine types that
support more than 255 CPUs.

Signed-off-by: Igor Mammedov <address@hidden>
 hw/i386/pc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 5fa5668..7161485 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -738,6 +738,7 @@ static void pc_build_smbios(FWCfgState *fw_cfg)
 static FWCfgState *bochs_bios_init(AddressSpace *as, PCMachineState *pcms)
+    MachineClass *mc = MACHINE_GET_CLASS(pcms);
     FWCfgState *fw_cfg;
     uint64_t *numa_fw_cfg;
     int i, j;
@@ -770,6 +771,11 @@ static FWCfgState *bochs_bios_init(AddressSpace *as, 
PCMachineState *pcms)
                     sizeof(struct e820_entry) * e820_entries);
     fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, &hpet_cfg, sizeof(hpet_cfg));
+    if (mc->max_cpus > 255) {
+        static uint16_t boot_cpus;
+        boot_cpus = cpu_to_le16(smp_cpus);
+        fw_cfg_add_file(fw_cfg, "etc/boot-cpus", &smp_cpus, sizeof(boot_cpus));
+    }
     /* allocate memory for the NUMA channel: one (64bit) word for the number
      * of nodes, one word for each VCPU->node and one word for each node to
      * hold the amount of memory.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]