Received: from eggs.gnu.org ([2001:4830:134:3::10]:38786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azhTT-0001oQ-K7 for qemu-devel@nongnu.org; Mon, 09 May 2016 05:27:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azhTQ-0006fx-1m for qemu-devel@nongnu.org; Mon, 09 May 2016 05:27:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40832) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azhTP-0006fd-Rm for qemu-devel@nongnu.org; Mon, 09 May 2016 05:27:31 -0400 From: Igor Mammedov Date: Mon, 9 May 2016 11:26:58 +0200 Message-Id: <1462786020-144172-13-git-send-email-imammedo@redhat.com> In-Reply-To: <1462786020-144172-1-git-send-email-imammedo@redhat.com> References: <1462786020-144172-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH RFC 12/14] 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: qemu-devel@nongnu.org Cc: ehabkost@redhat.com, david@gibson.dropbear.id.au, mst@redhat.com, peter.maydell@linaro.org, rkrcmar@redhat.com, peterx@redhat.com, jan.kiszka@web.de, pbonzini@redhat.com 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 --- 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. -- 1.8.3.1