From patchwork Thu Jul 26 05:43:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Mackerras X-Patchwork-Id: 949488 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=kvm-ppc-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="wLdLAP2C"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41bgz56Fslz9s55 for ; Thu, 26 Jul 2018 15:44:49 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728824AbeGZG74 (ORCPT ); Thu, 26 Jul 2018 02:59:56 -0400 Received: from ozlabs.org ([203.11.71.1]:45483 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728146AbeGZG7z (ORCPT ); Thu, 26 Jul 2018 02:59:55 -0400 Received: by ozlabs.org (Postfix, from userid 1003) id 41bgz06h3Mz9rvt; Thu, 26 Jul 2018 15:44:44 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1532583884; bh=Fd9y5t21KQV4bJzo8aawwtOUwgXqVmn1pLf7ZEeSe6M=; h=Date:From:To:Cc:Subject:From; b=wLdLAP2C7KeYTowfX0/NVAKBIVNiItr/Ps6QRYvl8yMUd+VMkDcvPRQogBYNpIfXJ dMG9FTStR7w/0u/suEfieIhPh9j5mQUFCB7LFuiwGfAUG0yHSw7Poq6SftIgHSWesy E2SSe8pwMSlpXhAKlt7gfNGhslwhgQ3FMeFqCXOnQqXKL7/jEFhBg04eAZkXnnOks/ NEv1wyUIrXhuMu1lGGwQQoEpadWHqTUhkgAdmbSyyH75v+JeMDQ+vL8wOzEZ4+OyGZ EZ0QOXTCRSoSLX+CiHhA+K/gRZtWRn6VDcATIroX1lnYRAORid6lsFkvY84Yns/YcB bO8EDmEq9M+KQ== Date: Thu, 26 Jul 2018 15:43:54 +1000 From: Paul Mackerras To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: Sam Bobroff , David Gibson Subject: [PATCH 1/2] KVM: PPC: Book3S HV: Allow creating max number of VCPUs on POWER9 Message-ID: <20180726054353.GB1672@fergus> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org Commit 1e175d2 ("KVM: PPC: Book3S HV: Pack VCORE IDs to access full VCPU ID space", 2018-07-25) allowed use of VCPU IDs up to KVM_MAX_VCPU_ID on POWER9 in all guest SMT modes and guest emulated hardware SMT modes. However, with the current definition of KVM_MAX_VCPU_ID, a guest SMT mode of 1 and an emulated SMT mode of 8, it is only possible to create KVM_MAX_VCPUS / 2 VCPUS, because threads_per_subcore is 4 on POWER9 CPUs. (Using an emulated SMT mode of 8 is useful when migrating VMs to or from POWER8 hosts.) This increases KVM_MAX_VCPU_ID to 8 * KVM_MAX_VCPUS when HV KVM is configured in, so that a full complement of KVM_MAX_VCPUS VCPUs can be created on POWER9 in all guest SMT modes and emulated hardware SMT modes. Signed-off-by: Paul Mackerras Tested-by: Sam Bobroff --- This and the next patch apply on my kvm-ppc-next branch, which includes Sam Bobroff's patch "KVM: PPC: Book3S HV: Pack VCORE IDs to access full VCPU ID space". arch/powerpc/include/asm/kvm_host.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index 5b9e660..906bcbdf 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h @@ -42,7 +42,14 @@ #define KVM_USER_MEM_SLOTS 512 #include -#define KVM_MAX_VCPU_ID (threads_per_subcore * KVM_MAX_VCORES) + +#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE +#include /* for MAX_SMT_THREADS */ +#define KVM_MAX_VCPU_ID (MAX_SMT_THREADS * KVM_MAX_VCORES) + +#else +#define KVM_MAX_VCPU_ID KVM_MAX_VCPUS +#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */ #define __KVM_HAVE_ARCH_INTC_INITIALIZED