From patchwork Mon Jul 23 10:47:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dunrong huang X-Patchwork-Id: 172623 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0BC152C0349 for ; Mon, 23 Jul 2012 20:47:49 +1000 (EST) Received: from localhost ([::1]:48068 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StGB1-00018F-6i for incoming@patchwork.ozlabs.org; Mon, 23 Jul 2012 06:47:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StGAm-00017y-Sp for qemu-devel@nongnu.org; Mon, 23 Jul 2012 06:47:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1StGAi-0007xv-QS for qemu-devel@nongnu.org; Mon, 23 Jul 2012 06:47:32 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:37884) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StGAi-0007xj-Jy for qemu-devel@nongnu.org; Mon, 23 Jul 2012 06:47:28 -0400 Received: by pbbro12 with SMTP id ro12so10569334pbb.4 for ; Mon, 23 Jul 2012 03:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=P5VXFAXiWo2FkirXvQS800SWRCo4Zr5T5YG5tZeJu1I=; b=XiO9FJM1F9lQJOdWEch1oCNfsq9GNAT/U5LIuyKhuf8WWJLOp/mzsDIsiwfS2irWmQ kcLskA5qsx/OQbp8t/8ZuJq3Nr3Sl6oUJe34A1lU3fsgQff4444RnRof4DBW1+Tg5YFH Qs5oPTL+gRMtj2I6S6dRx5/snj7NKJGX5etVRHJMvOEuryS5yAP+HSn4HvBIWltV+Kwa HwH4jDg04u618nBmNmxWOTAfYDsdQmQlvTPlzI1IRil+loa6ogK+3HLkF1p754b6UaZ+ TBlnDm9+nYfkEIXk9z+wYcpz6KrmtO6bp3E/wnno6G1kqgA39l5TJRMp1Xufqva+l7Vo HP4Q== Received: by 10.68.213.67 with SMTP id nq3mr34429346pbc.142.1343040447193; Mon, 23 Jul 2012 03:47:27 -0700 (PDT) Received: from localhost.localdomain ([111.196.231.218]) by mx.google.com with ESMTPS id nv10sm9742419pbb.49.2012.07.23.03.47.22 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Jul 2012 03:47:26 -0700 (PDT) From: riegamaths@gmail.com To: qemu-devel Date: Mon, 23 Jul 2012 18:47:35 +0800 Message-Id: <1343040455-30206-1-git-send-email-riegamaths@gmail.com> X-Mailer: git-send-email 1.7.8.6 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: Anthony Liguori , Stefan Hajnoczi , Dunrong Huang Subject: [Qemu-devel] [PATCH] pc: Fix max_cpus X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Dunrong Huang The VCPU count limit in kernel now is 254, defined by KVM_MAX_VCPUS in kernel's header files. But the count limit in QEMU is 255, so QEMU will failed to start if user passes "-enable-kvm" and "-smp 255" to it. This patch intruduces a Macro MAX_VCPUS whose value is KVM_MAX_VCPUS if CONFIG_KVM is defined. If user do not use kvm, set it's value to 255. Signed-off-by: Dunrong Huang --- hw/pc_piix.c | 28 +++++++++++++++++++--------- 1 files changed, 19 insertions(+), 9 deletions(-) diff --git a/hw/pc_piix.c b/hw/pc_piix.c index 0c0096f..49cda51 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -49,6 +49,16 @@ #define MAX_IDE_BUS 2 +#ifndef KVM_MAX_VCPUS +#define KVM_MAX_VCPUS 254 +#endif + +#ifdef CONFIG_KVM +#define MAX_VCPUS KVM_MAX_VCPUS +#else +#define MAX_VCPUS 255 +#endif + static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 }; static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 }; static const int ide_irq[MAX_IDE_BUS] = { 14, 15 }; @@ -354,7 +364,7 @@ static QEMUMachine pc_machine_v1_2 = { .alias = "pc", .desc = "Standard PC", .init = pc_init_pci, - .max_cpus = 255, + .max_cpus = MAX_VCPUS, .is_default = 1, }; @@ -381,7 +391,7 @@ static QEMUMachine pc_machine_v1_1 = { .name = "pc-1.1", .desc = "Standard PC", .init = pc_init_pci, - .max_cpus = 255, + .max_cpus = MAX_VCPUS, .compat_props = (GlobalProperty[]) { PC_COMPAT_1_1, { /* end of list */ } @@ -416,7 +426,7 @@ static QEMUMachine pc_machine_v1_0 = { .name = "pc-1.0", .desc = "Standard PC", .init = pc_init_pci, - .max_cpus = 255, + .max_cpus = MAX_VCPUS, .compat_props = (GlobalProperty[]) { PC_COMPAT_1_0, { /* end of list */ } @@ -431,7 +441,7 @@ static QEMUMachine pc_machine_v0_15 = { .name = "pc-0.15", .desc = "Standard PC", .init = pc_init_pci, - .max_cpus = 255, + .max_cpus = MAX_VCPUS, .compat_props = (GlobalProperty[]) { PC_COMPAT_0_15, { /* end of list */ } @@ -463,7 +473,7 @@ static QEMUMachine pc_machine_v0_14 = { .name = "pc-0.14", .desc = "Standard PC", .init = pc_init_pci, - .max_cpus = 255, + .max_cpus = MAX_VCPUS, .compat_props = (GlobalProperty[]) { PC_COMPAT_0_14, { @@ -496,7 +506,7 @@ static QEMUMachine pc_machine_v0_13 = { .name = "pc-0.13", .desc = "Standard PC", .init = pc_init_pci_no_kvmclock, - .max_cpus = 255, + .max_cpus = MAX_VCPUS, .compat_props = (GlobalProperty[]) { PC_COMPAT_0_13, { @@ -533,7 +543,7 @@ static QEMUMachine pc_machine_v0_12 = { .name = "pc-0.12", .desc = "Standard PC", .init = pc_init_pci_no_kvmclock, - .max_cpus = 255, + .max_cpus = MAX_VCPUS, .compat_props = (GlobalProperty[]) { PC_COMPAT_0_12, { @@ -566,7 +576,7 @@ static QEMUMachine pc_machine_v0_11 = { .name = "pc-0.11", .desc = "Standard PC, qemu 0.11", .init = pc_init_pci_no_kvmclock, - .max_cpus = 255, + .max_cpus = MAX_VCPUS, .compat_props = (GlobalProperty[]) { PC_COMPAT_0_11, { @@ -587,7 +597,7 @@ static QEMUMachine pc_machine_v0_10 = { .name = "pc-0.10", .desc = "Standard PC, qemu 0.10", .init = pc_init_pci_no_kvmclock, - .max_cpus = 255, + .max_cpus = MAX_VCPUS, .compat_props = (GlobalProperty[]) { PC_COMPAT_0_11, {