From patchwork Tue Jun 7 10:47:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 631493 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rP8Qh10zZz9sDC for ; Tue, 7 Jun 2016 21:26:20 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b=cxVQjGHk; dkim-atps=neutral Received: from localhost ([::1]:48685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAF9G-00071E-6T for incoming@patchwork.ozlabs.org; Tue, 07 Jun 2016 07:26:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAEZ7-0007WU-8A for qemu-devel@nongnu.org; Tue, 07 Jun 2016 06:48:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAEZ1-0005Iq-7J for qemu-devel@nongnu.org; Tue, 07 Jun 2016 06:48:57 -0400 Received: from ozlabs.org ([103.22.144.67]:60539) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAEZ0-0005IO-T7; Tue, 07 Jun 2016 06:48:51 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3rP7Zn2BY6z9t5l; Tue, 7 Jun 2016 20:48:16 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1465296497; bh=FKvHgElxsEHSY9Vv+OT3YlgCehkj62XnQKiXOiw6oPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cxVQjGHkiijo3UBTKN3zp3ePMszj5nOuEbofHnT2hOeVnVigUBDeR/j84SOwKh3wU nfAH9Mpuow7nrbgfnsrpijAUGOCk0iDqREwyw+0ffllFNpAk8CV1kNwRSMp1GOuwdS uHu3u9f4BFWK3iwKbcHIwwCpNpf707d+2olU9QfY= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 7 Jun 2016 20:47:56 +1000 Message-Id: <1465296493-10851-10-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465296493-10851-1-git-send-email-david@gibson.dropbear.id.au> References: <1465296493-10851-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 09/26] spapr: Increase hotpluggable memory slots to 256 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: Bharata B Rao , qemu-ppc@nongnu.org, agraf@suse.de, David Gibson , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Bharata B Rao KVM now supports 512 memslots on PowerPC (earlier it was 32). Allow half of it (256) to be used as hotpluggable memory slots. Instead of hard coding the max value, use the KVM supplied value if KVM is enabled. Otherwise resort to the default value of 32. Signed-off-by: Bharata B Rao Reviewed-by: Thomas Huth Signed-off-by: David Gibson --- hw/ppc/spapr.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 44e401a..14cc6ae 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1816,11 +1816,21 @@ static void ppc_spapr_init(MachineState *machine) /* initialize hotplug memory address space */ if (machine->ram_size < machine->maxram_size) { ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size; + /* + * Limit the number of hotpluggable memory slots to half the number + * slots that KVM supports, leaving the other half for PCI and other + * devices. However ensure that number of slots doesn't drop below 32. + */ + int max_memslots = kvm_enabled() ? kvm_get_max_memslots() / 2 : + SPAPR_MAX_RAM_SLOTS; - if (machine->ram_slots > SPAPR_MAX_RAM_SLOTS) { + if (max_memslots < SPAPR_MAX_RAM_SLOTS) { + max_memslots = SPAPR_MAX_RAM_SLOTS; + } + if (machine->ram_slots > max_memslots) { error_report("Specified number of memory slots %" PRIu64" exceeds max supported %d", - machine->ram_slots, SPAPR_MAX_RAM_SLOTS); + machine->ram_slots, max_memslots); exit(1); }