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: 10545233 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 53719A635 for ; Thu, 26 Jul 2018 05:44:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41B1C2A944 for ; Thu, 26 Jul 2018 05:44:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35DA62A96A; Thu, 26 Jul 2018 05:44:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3B272A944 for ; Thu, 26 Jul 2018 05:44:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728899AbeGZG74 (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-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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