qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v2 13/14] pc: add 'etc/boot-cpus' fw_cfg file for ma


From: Igor Mammedov
Subject: [Qemu-devel] [PATCH v2 13/14] pc: add 'etc/boot-cpus' fw_cfg file for machine with more than 255 CPUs
Date: Thu, 22 Sep 2016 14:50:54 +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 new
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 | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index f807932..f90db33 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1237,9 +1237,11 @@ void pc_machine_done(Notifier *notifier, void *data)
     PCMachineState *pcms = container_of(notifier,
                                         PCMachineState, machine_done);
     PCIBus *bus = pcms->bus;
+    static uint16_t boot_cpus;
 
     /* set the number of CPUs */
-    rtc_set_memory(pcms->rtc, 0x5f, pc_present_cpus_count(pcms) - 1);
+    boot_cpus = pc_present_cpus_count(pcms);
+    rtc_set_memory(pcms->rtc, 0x5f, boot_cpus - 1);
 
     if (bus) {
         int extra_hosts = 0;
@@ -1260,8 +1262,16 @@ void pc_machine_done(Notifier *notifier, void *data)
 
     acpi_setup();
     if (pcms->fw_cfg) {
+        MachineClass *mc = MACHINE_GET_CLASS(pcms);
+
         pc_build_smbios(pcms->fw_cfg);
         pc_build_feature_control_file(pcms);
+
+        if (mc->max_cpus > 255) {
+            boot_cpus = cpu_to_le16(boot_cpus);
+            fw_cfg_add_file(pcms->fw_cfg, "etc/boot-cpus", &boot_cpus,
+                            sizeof(boot_cpus));
+        }
     }
 }
 
-- 
2.7.4




reply via email to

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