From patchwork Tue Mar 27 14:15:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 891596 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 409Y6V3PfDz9s0b for ; Wed, 28 Mar 2018 01:19:14 +1100 (AEDT) Received: from localhost ([::1]:34537 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0pRP-0007VR-S2 for incoming@patchwork.ozlabs.org; Tue, 27 Mar 2018 10:19:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0pO9-000340-MY for qemu-devel@nongnu.org; Tue, 27 Mar 2018 10:15:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0pO5-0006WD-NP for qemu-devel@nongnu.org; Tue, 27 Mar 2018 10:15:49 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51258 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f0pO3-0006RA-7W; Tue, 27 Mar 2018 10:15:43 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CAECB722C5; Tue, 27 Mar 2018 14:15:42 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-135.ams2.redhat.com [10.36.116.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id D95286F9E6; Tue, 27 Mar 2018 14:15:40 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org Date: Tue, 27 Mar 2018 16:15:17 +0200 Message-Id: <1522160122-10744-4-git-send-email-eric.auger@redhat.com> In-Reply-To: <1522160122-10744-1-git-send-email-eric.auger@redhat.com> References: <1522160122-10744-1-git-send-email-eric.auger@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 27 Mar 2018 14:15:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 27 Mar 2018 14:15:42 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eric.auger@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [RFC 3/8] kvm: Expose kvm_max_vcpus() 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: wei@redhat.com, marc.zyngier@arm.com, drjones@redhat.com, cdall@kernel.org, zhaoshenglong@huawei.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make kvm_max_vcpus() public so that the machines can query this information easily. Signed-off-by: Eric Auger --- accel/kvm/kvm-all.c | 2 +- accel/stubs/kvm-stub.c | 5 +++++ include/sysemu/kvm.h | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index ffee68e..b04f4ef 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1462,7 +1462,7 @@ static int kvm_recommended_vcpus(KVMState *s) return (ret) ? ret : 4; } -static int kvm_max_vcpus(KVMState *s) +int kvm_max_vcpus(KVMState *s) { int ret = kvm_check_extension(s, KVM_CAP_MAX_VCPUS); return (ret) ? ret : kvm_recommended_vcpus(s); diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c index 02d5170..e816050 100644 --- a/accel/stubs/kvm-stub.c +++ b/accel/stubs/kvm-stub.c @@ -170,4 +170,9 @@ bool kvm_arm_supports_user_irq(void) { return false; } + +int kvm_max_vcpus(KVMState *s) +{ + return -ENOSYS; +} #endif diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 23669c4..1e7c621 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -546,6 +546,13 @@ int kvm_set_one_reg(CPUState *cs, uint64_t id, void *source); * Returns: 0 on success, or a negative errno on failure. */ int kvm_get_one_reg(CPUState *cs, uint64_t id, void *target); + +/** + * kvm_max_vcpus - return the number of supported vcpus + * @s: The KVMState pointer + */ +int kvm_max_vcpus(KVMState *s); + struct ppc_radix_page_info *kvm_get_radix_page_info(void); int kvm_get_max_memslots(void); #endif