From nobody Tue Feb 10 17:53:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1570104408; cv=none; d=zoho.com; s=zohoarc; b=U0dkNPAghrgzXpCyCUjBxdTctTCJHqfhkHlsmMOQiU+HqshE2hA6eNmF2jYtPY/YnUIs9FozQzkNCrLSva+tJ7Rvzc4Eq0yrV/3Q6OIwtK/uTABwc/MlRahlVfoSliQ0yOzEkgrPEK1VqKTkkQ1i5HSsNyNMHCpvTrAse54oFPI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570104408; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=GxEinlYnbriz4qjTgzfcfJa3s3xkMFy/tGCqp1G1DbA=; b=MgRZtPDjVGFxqnkxh7EYlKOp4cOGD648/SLZhzDgcJc5r5auPhGDrpWWMKqP5s+BhlQphRPEfFTTOW1+1j2kENKh6VTQEy+ddYnKLNL5MZlFQ3BuXcmTzgcDplD4foenGKzUQvbGKzi5Pn/j7q52AvSSqrYG3j9xpPty1gWHfq0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1570104408361366.12682686572884; Thu, 3 Oct 2019 05:06:48 -0700 (PDT) Received: from localhost ([::1]:35616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFzsd-0005Sl-0Z for importer@patchew.org; Thu, 03 Oct 2019 08:06:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40119) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iFzoC-0000Z7-6d for qemu-devel@nongnu.org; Thu, 03 Oct 2019 08:02:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iFzo6-0008M8-U5 for qemu-devel@nongnu.org; Thu, 03 Oct 2019 08:02:12 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38400) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iFzo3-0008FF-05 for qemu-devel@nongnu.org; Thu, 03 Oct 2019 08:02:04 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x93BvBZr138378 for ; Thu, 3 Oct 2019 08:01:59 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2vd1gye6ym-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 03 Oct 2019 08:01:59 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 3 Oct 2019 13:01:57 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 3 Oct 2019 13:01:54 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x93C1rYu51052772 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 Oct 2019 12:01:53 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D0026A4068; Thu, 3 Oct 2019 12:01:53 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9DE3DA4060; Thu, 3 Oct 2019 12:01:53 +0000 (GMT) Received: from bahia.lan (unknown [9.145.67.254]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 3 Oct 2019 12:01:53 +0000 (GMT) Subject: [PATCH 6/7] spapr/xive: Configure number of servers in KVM From: Greg Kurz To: David Gibson , =?utf-8?q?C=C3=A9dric?= Le Goater Date: Thu, 03 Oct 2019 14:01:53 +0200 In-Reply-To: <157010404888.246126.9768030542733152637.stgit@bahia.lan> References: <157010404888.246126.9768030542733152637.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19100312-0016-0000-0000-000002B3A9F2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19100312-0017-0000-0000-00003314B3CB Message-Id: <157010411139.246126.16419749660388287086.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-10-03_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=787 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910030113 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" The XIVE KVM devices now has an attribute to configure the number of interrupt servers. This allows to greatly optimize the usage of the VP space in the XIVE HW, and thus to start a lot more VMs. Only set this attribute if available in order to support older POWER9 KVM. The XIVE KVM device now reports the exhaustion of VPs upon the connection of the first VCPU. Check that in order to have a chance to provide an hint to the user. Signed-off-by: Greg Kurz Reviewed-by: C=C3=A9dric Le Goater --- hw/intc/spapr_xive_kvm.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c index 51b334b676a1..2a3a9ef22b6f 100644 --- a/hw/intc/spapr_xive_kvm.c +++ b/hw/intc/spapr_xive_kvm.c @@ -152,7 +152,8 @@ void kvmppc_xive_cpu_synchronize_state(XiveTCTX *tctx, = Error **errp) =20 void kvmppc_xive_cpu_connect(XiveTCTX *tctx, Error **errp) { - SpaprXive *xive =3D SPAPR_MACHINE(qdev_get_machine())->xive; + MachineState *ms =3D MACHINE(qdev_get_machine()); + SpaprXive *xive =3D SPAPR_MACHINE(ms)->xive; unsigned long vcpu_id; int ret; =20 @@ -171,8 +172,15 @@ void kvmppc_xive_cpu_connect(XiveTCTX *tctx, Error **e= rrp) ret =3D kvm_vcpu_enable_cap(tctx->cs, KVM_CAP_PPC_IRQ_XIVE, 0, xive->f= d, vcpu_id, 0); if (ret < 0) { - error_setg(errp, "XIVE: unable to connect CPU%ld to KVM device: %s= ", + Error *err =3D NULL; + + error_setg(&err, "XIVE: unable to connect CPU%ld to KVM device: %s= ", vcpu_id, strerror(errno)); + if (errno =3D=3D ENOSPC) { + error_append_hint(&local_err, "Try -smp maxcpus=3DN with N < %= u\n", + ms->smp.max_cpus); + } + error_propagate(errp, err); return; } =20 @@ -768,6 +776,16 @@ void kvmppc_xive_connect(SpaprXive *xive, Error **errp) return; } =20 + /* Tell KVM about the # of VCPUs we may have */ + if (kvm_device_check_attr(xive->fd, KVM_DEV_XIVE_GRP_CTRL, + KVM_DEV_XIVE_NR_SERVERS)) { + if (kvm_device_access(xive->fd, KVM_DEV_XIVE_GRP_CTRL, + KVM_DEV_XIVE_NR_SERVERS, &xive->nr_servers, = true, + &local_err)) { + goto fail; + } + } + /* * 1. Source ESB pages - KVM mapping */