From patchwork Mon May 9 09:26:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 9044111 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 37BF4BF29F for ; Mon, 9 May 2016 09:34:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A26D12012B for ; Mon, 9 May 2016 09:34:03 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DB37B2012D for ; Mon, 9 May 2016 09:34:02 +0000 (UTC) Received: from localhost ([::1]:40223 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azhZh-0008JE-0k for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 May 2016 05:34:01 -0400 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 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B8FC9B0F1; Mon, 9 May 2016 09:27:31 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u499R2fV014884; Mon, 9 May 2016 05:27:29 -0400 From: Igor Mammedov To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH RFC 12/14] pc: add 'etc/boot-cpus' fw_cfg file for machine with more than 255 CPUs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, ehabkost@redhat.com, mst@redhat.com, rkrcmar@redhat.com, peterx@redhat.com, jan.kiszka@web.de, pbonzini@redhat.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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.