From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: Eduardo Habkost <ehabkost@redhat.com>,
mst@redhat.com, Stefan Hajnoczi <stefanha@gmail.com>,
Kevin O'Connor <kevin@koconnor.net>,
Gerd Hoffmann <kraxel@redhat.com>,
Laszlo Ersek <lersek@redhat.com>
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 [thread overview]
Message-ID: <1478877672-73759-3-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1478877672-73759-1-git-send-email-imammedo@redhat.com>
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 <imammedo@redhat.com>
---
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
next prev parent reply other threads:[~2016-11-11 15:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-11 15:21 [Qemu-devel] [PATCH for-2.8 0/2] pc: remove redundant fw_cfg file "etc/boot-cpus" Igor Mammedov
2016-11-11 15:21 ` [Qemu-devel] [PATCH for-2.8 1/2] fw_cfg: move FW_CFG_NB_CPUS out of fw_cfg_init1() Igor Mammedov
2016-11-11 15:21 ` Igor Mammedov [this message]
2016-11-14 15:40 ` [Qemu-devel] [PATCH for-2.8 0/2] pc: remove redundant fw_cfg file "etc/boot-cpus" Stefan Hajnoczi
2016-11-14 20:46 ` Michael S. Tsirkin
2016-11-15 10:23 ` Gerd Hoffmann
2016-11-15 11:07 ` Igor Mammedov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1478877672-73759-3-git-send-email-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=ehabkost@redhat.com \
--cc=kevin@koconnor.net \
--cc=kraxel@redhat.com \
--cc=lersek@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).