qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH for-2.8 2/2] pc: drop "etc/boot-cpus" fw_cfg file an


From: Igor Mammedov
Subject: [Qemu-devel] [PATCH for-2.8 2/2] pc: drop "etc/boot-cpus" fw_cfg file and use FW_CFG_NB_CPUS instead
Date: Fri, 11 Nov 2016 16:21:12 +0100

Since "etc/boot-cpus" fw_cfg file and should have the same value
i.e. NR of of all present at boot CPUs (-smp X | -device cpu ...)

Reuse legacy FW_CFG_NB_CPUS since it can't be removed
and drop "etc/boot-cpus" fw_cfg file that's been added in this
release cycle and hasn't been shipped with released QEMU so far.

Follow up patch for SeaBIOS will have to go in stable branch
and updated SeaBIOS should be pulled in QEMU-2.8 release.

Signed-off-by: Igor Mammedov <address@hidden>
---
 include/hw/i386/pc.h |  4 ++--
 hw/i386/pc.c         | 18 ++++++------------
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 8eb517f..d88a9c2 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -36,7 +36,7 @@
 /**
  * PCMachineState:
  * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling
- * @boot_cpus_le: number of present VCPUs, referenced by 'etc/boot-cpus' fw_cfg
+ * @boot_cpus: number of present VCPUs, value goes to fw_cfg FW_CFG_NB_CPUS
  */
 struct PCMachineState {
     /*< private >*/
@@ -71,7 +71,7 @@ struct PCMachineState {
     bool apic_xrupt_override;
     unsigned apic_id_limit;
     CPUArchIdList *possible_cpus;
-    uint16_t boot_cpus_le;
+    uint16_t boot_cpus;
 
     /* NUMA information: */
     uint64_t numa_nodes;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 93016d0..c80f7a9 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1244,7 +1244,7 @@ void pc_machine_done(Notifier *notifier, void *data)
     PCIBus *bus = pcms->bus;
 
     /* set the number of CPUs */
-    rtc_set_cpus_count(pcms->rtc, le16_to_cpu(pcms->boot_cpus_le));
+    rtc_set_cpus_count(pcms->rtc, pcms->boot_cpus);
 
     if (bus) {
         int extra_hosts = 0;
@@ -1265,15 +1265,9 @@ 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) {
-            fw_cfg_add_file(pcms->fw_cfg, "etc/boot-cpus", &pcms->boot_cpus_le,
-                            sizeof(pcms->boot_cpus_le));
-        }
+        fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus);
     }
 
     if (pcms->apic_id_limit > 255) {
@@ -1834,10 +1828,10 @@ static void pc_cpu_plug(HotplugHandler *hotplug_dev,
     }
 
     /* increment the number of CPUs */
-    pcms->boot_cpus_le = cpu_to_le16(le16_to_cpu(pcms->boot_cpus_le) + 1);
+    pcms->boot_cpus++;
     if (dev->hotplugged) {
         /* Update the number of CPUs in CMOS */
-        rtc_set_cpus_count(pcms->rtc, le16_to_cpu(pcms->boot_cpus_le));
+        rtc_set_cpus_count(pcms->rtc, pcms->boot_cpus);
     }
 
     found_cpu = pc_find_cpu_slot(pcms, CPU(dev), NULL);
@@ -1892,9 +1886,9 @@ static void pc_cpu_unplug_cb(HotplugHandler *hotplug_dev,
     object_unparent(OBJECT(dev));
 
     /* decrement the number of CPUs */
-    pcms->boot_cpus_le = cpu_to_le16(le16_to_cpu(pcms->boot_cpus_le) - 1);
+    pcms->boot_cpus--;
     /* Update the number of CPUs in CMOS */
-    rtc_set_cpus_count(pcms->rtc, le16_to_cpu(pcms->boot_cpus_le));
+    rtc_set_cpus_count(pcms->rtc, pcms->boot_cpus);
  out:
     error_propagate(errp, local_err);
 }
-- 
2.7.4




reply via email to

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