From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWHAZ-0006bh-Im for qemu-devel@nongnu.org; Sun, 07 Aug 2016 02:02:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWHAV-0000hL-CK for qemu-devel@nongnu.org; Sun, 07 Aug 2016 02:02:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53642) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWHAV-0000hG-4w for qemu-devel@nongnu.org; Sun, 07 Aug 2016 02:02:39 -0400 Date: Sun, 7 Aug 2016 09:02:33 +0300 From: "Michael S. Tsirkin" Message-ID: <20160807090133-mutt-send-email-mst@kernel.org> References: <1470390377-228219-1-git-send-email-imammedo@redhat.com> <1470390377-228219-17-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1470390377-228219-17-git-send-email-imammedo@redhat.com> Subject: Re: [Qemu-devel] [PATCH for-2.8 16/18] pc: add 'etc/boot-cpus' fw_cfg file for machine with more than 255 CPUs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, ehabkost@redhat.com, mtosatti@redhat.com, rkrcmar@redhat.com, kevin@koconnor.net, lersek@redhat.com On Fri, Aug 05, 2016 at 11:46:15AM +0200, Igor Mammedov wrote: > 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 Do we really need this? Why differentiate between boot cpus and others? How about reusing the hotplug register, such that it looks just as if all CPUs were just added by hotplug? > --- > 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 c2cd5bd..2b5581a 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -1235,9 +1235,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; > @@ -1258,8 +1260,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