From nobody Thu May 2 00:15:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1515957948278308.0352476431286; Sun, 14 Jan 2018 11:25:48 -0800 (PST) Received: from localhost ([::1]:58644 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eanua-0001aq-5J for importer@patchew.org; Sun, 14 Jan 2018 14:25:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eant5-0000mC-E6 for qemu-devel@nongnu.org; Sun, 14 Jan 2018 14:24:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eant2-0005R7-Kj for qemu-devel@nongnu.org; Sun, 14 Jan 2018 14:24:11 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57366) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eant2-0005QZ-CQ for qemu-devel@nongnu.org; Sun, 14 Jan 2018 14:24:08 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0EJNsbi067441 for ; Sun, 14 Jan 2018 14:24:07 -0500 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0a-001b2d01.pphosted.com with ESMTP id 2fgbbdkg4q-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Sun, 14 Jan 2018 14:24:06 -0500 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 14 Jan 2018 14:24:05 -0500 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 14 Jan 2018 14:24:03 -0500 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0EJO38Z55771208; Sun, 14 Jan 2018 19:24:03 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 94906AE034; Sun, 14 Jan 2018 14:25:15 -0500 (EST) Received: from pacoca.ibmmodules.com (unknown [9.85.202.57]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id EBACAAE03B; Sun, 14 Jan 2018 14:25:13 -0500 (EST) From: Jose Ricardo Ziviani To: qemu-ppc@nongnu.org Date: Sun, 14 Jan 2018 17:23:48 -0200 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180114192349.22212-1-joserz@linux.vnet.ibm.com> References: <20180114192349.22212-1-joserz@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18011419-2213-0000-0000-0000025AC19C X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008377; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000245; SDB=6.00975014; UDB=6.00494131; IPR=6.00754940; BA=6.00005775; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00019034; XFM=3.00000015; UTC=2018-01-14 19:24:05 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18011419-2214-0000-0000-000058C3885E Message-Id: <20180114192349.22212-2-joserz@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-01-14_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801140278 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v2 1/2] ppc: Change Power9 compat table to support at most 8 threads/core 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: lvivier@redhat.com, groug@kaod.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Increases the max smt mode to 8 for Power9. That's because KVM supports smt emulation in this platform so QEMU should allow users to use it as well. Today if we try to pass -smp ...,threads=3D8, QEMU will silently truncate it to smt4 mode and may cause a crash if we try to perform a cpu hotplug. Signed-off-by: Jose Ricardo Ziviani --- target/ppc/compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/compat.c b/target/ppc/compat.c index ad8f93c064..d1770cdc6f 100644 --- a/target/ppc/compat.c +++ b/target/ppc/compat.c @@ -73,7 +73,7 @@ static const CompatInfo compat_table[] =3D { .pvr =3D CPU_POWERPC_LOGICAL_3_00, .pcr =3D PCR_COMPAT_3_00, .pcr_level =3D PCR_COMPAT_3_00, - .max_threads =3D 4, + .max_threads =3D 8, }, }; =20 --=20 2.14.3 From nobody Thu May 2 00:15:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1515958052016899.0275755955996; Sun, 14 Jan 2018 11:27:32 -0800 (PST) Received: from localhost ([::1]:58760 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eanwF-0002mW-NU for importer@patchew.org; Sun, 14 Jan 2018 14:27:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eant9-0000pn-WF for qemu-devel@nongnu.org; Sun, 14 Jan 2018 14:24:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eant6-0005TN-Rd for qemu-devel@nongnu.org; Sun, 14 Jan 2018 14:24:15 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54566) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eant6-0005St-Jy for qemu-devel@nongnu.org; Sun, 14 Jan 2018 14:24:12 -0500 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0EJO3wY074230 for ; Sun, 14 Jan 2018 14:24:10 -0500 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ffpquws5q-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Sun, 14 Jan 2018 14:24:09 -0500 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 14 Jan 2018 14:24:08 -0500 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 14 Jan 2018 14:24:06 -0500 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0EJO6it262484; Sun, 14 Jan 2018 19:24:06 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9BE9FAE043; Sun, 14 Jan 2018 14:25:18 -0500 (EST) Received: from pacoca.ibmmodules.com (unknown [9.85.202.57]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id 09261AE034; Sun, 14 Jan 2018 14:25:16 -0500 (EST) From: Jose Ricardo Ziviani To: qemu-ppc@nongnu.org Date: Sun, 14 Jan 2018 17:23:49 -0200 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180114192349.22212-1-joserz@linux.vnet.ibm.com> References: <20180114192349.22212-1-joserz@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18011419-0040-0000-0000-000003E1BF5A X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008377; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000245; SDB=6.00975014; UDB=6.00494131; IPR=6.00754940; BA=6.00005775; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00019034; XFM=3.00000015; UTC=2018-01-14 19:24:08 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18011419-0041-0000-0000-000007D71D82 Message-Id: <20180114192349.22212-3-joserz@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-01-14_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801140278 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v2 2/2] ppc: spapr: Check if thread argument is supported by host KVM 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: lvivier@redhat.com, groug@kaod.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" QEMU currently checks whether SMT passed is valid or not. However, it doesn't check if KVM supports such mode when kvm is enabled. This patch relies on KVM_CAP_PPC_SMT_POSSIBLE to make it sure that QEMU will either set a valid SMT mode or warn an error message and quit. Signed-off-by: Jose Ricardo Ziviani --- hw/ppc/spapr.c | 10 ++++++++++ target/ppc/kvm.c | 5 +++++ target/ppc/kvm_ppc.h | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index d1acfe8858..aed4d25fc4 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2261,12 +2261,22 @@ static void spapr_set_vsmt_mode(sPAPRMachineState *= spapr, Error **errp) "on a pseries machine"); goto out; } + if (!is_power_of_2(smp_threads)) { error_setg(&local_err, "Cannot support %d threads/core on a pserie= s " "machine because it must be a power of 2", smp_thread= s); goto out; } =20 + if (kvm_enabled() && kvmppc_cap_smt_possible() > 0) { + if ((kvmppc_cap_smt_possible() & smp_threads) !=3D smp_threads) { + error_setg(&local_err, "KVM does not support %d threads/core.", + smp_threads); + kvmppc_hint_smt_possible(&local_err); + goto out; + } + } + /* Detemine the VSMT mode to use: */ if (vsmt_user) { if (spapr->vsmt < smp_threads) { diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 914be687e7..4a8ff4d63c 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2456,6 +2456,11 @@ bool kvmppc_has_cap_mmu_hash_v3(void) return cap_mmu_hash_v3; } =20 +int kvmppc_cap_smt_possible(void) +{ + return cap_ppc_smt_possible; +} + PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void) { uint32_t host_pvr =3D mfpvr(); diff --git a/target/ppc/kvm_ppc.h b/target/ppc/kvm_ppc.h index ecb55493cc..2221850723 100644 --- a/target/ppc/kvm_ppc.h +++ b/target/ppc/kvm_ppc.h @@ -59,6 +59,7 @@ bool kvmppc_has_cap_fixup_hcalls(void); bool kvmppc_has_cap_htm(void); bool kvmppc_has_cap_mmu_radix(void); bool kvmppc_has_cap_mmu_hash_v3(void); +int kvmppc_cap_smt_possible(void); int kvmppc_enable_hwrng(void); int kvmppc_put_books_sregs(PowerPCCPU *cpu); PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void); @@ -290,6 +291,11 @@ static inline bool kvmppc_has_cap_mmu_hash_v3(void) return false; } =20 +static inline int kvmppc_cap_smt_possible(void) +{ + return 0; +} + static inline int kvmppc_enable_hwrng(void) { return -1; --=20 2.14.3