From nobody Sun May 12 13:49:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1694466577; cv=none; d=zohomail.com; s=zohoarc; b=Xypmu3ON0L2DgG1ap8S3Rs+SKhXBdaG9t5IdAxx4r8Sjisi5G4X/VxC7WpkQqH/dSjaeiK4ItY7nHki0qUtJb5D/QJ9NC7x1HQ8/+Ga2Q2Kmd3nzhtO9il6T31B00NmvZD4NDuFqnL+qHQX7FS3pPf+iiB9kb05YgEET+l1cNao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694466577; 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; bh=K1ysU5wLojRCw/G6RWyhY0XRDRUbqUFbvmSLXqlLqOk=; b=gYeg3cU09AFh2TIfFPPifplaRWuiillf1Sl4MplRakgiaTkXo9a8UspqVSNgnwLeXHq+YFgo4XRXvCpgRYkULOSaRdtWNYDmqQLLrN/dTFq0Ap9F6WWsuqR60c3ckHUK65v0zyiBqG5Ypt3bOZAp0QYgRgjcoVTh6rTx8+lVzN0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=reject dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1694466577069198.8238088374536; Mon, 11 Sep 2023 14:09:37 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-160-UvfuRfl9NquQN0Dwc9QaUw-1; Mon, 11 Sep 2023 17:09:26 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 77A311C060D2; Mon, 11 Sep 2023 21:09:22 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E5F740C6EC1; Mon, 11 Sep 2023 21:09:21 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9F5B31946A4F; Mon, 11 Sep 2023 21:09:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6808A1946A40 for ; Mon, 11 Sep 2023 21:09:19 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 598B94405A; Mon, 11 Sep 2023 21:09:19 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5277244029 for ; Mon, 11 Sep 2023 21:09:19 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 313158019DC for ; Mon, 11 Sep 2023 21:09:19 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-599-DNmzaUYiOvCCT3Dky_vWrA-1; Mon, 11 Sep 2023 17:09:17 -0400 Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38BL7xwQ017511 for ; Mon, 11 Sep 2023 21:09:15 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t29dy9t9x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Sep 2023 21:09:15 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38BJtaIX022941 for ; Mon, 11 Sep 2023 21:09:14 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3t141ndrk5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Sep 2023 21:09:14 +0000 Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38BL9DAP65995080 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Sep 2023 21:09:13 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 630BC58056; Mon, 11 Sep 2023 21:09:13 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2402858063; Mon, 11 Sep 2023 21:09:13 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.ibm.com.com (unknown [9.67.49.93]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 11 Sep 2023 21:09:13 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694466576; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=K1ysU5wLojRCw/G6RWyhY0XRDRUbqUFbvmSLXqlLqOk=; b=eVgYC1DTYG+wYm6ocXW885zvGkW9Y3YeY+QA3nBejSlmP5vCwgBV2KjPmjT9HBPscVPmeN UpUTmvGvCpTZ+bNDgX1CLVcc6ehTlXpXnTM5C55qTPxHNWd9nsS1a4dLchtCPCSgOkFjeo CB0kqV6KE4OJbQzf95bv6xNJ/o/5xi8= X-MC-Unique: UvfuRfl9NquQN0Dwc9QaUw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: DNmzaUYiOvCCT3Dky_vWrA-1 From: Collin Walling To: libvir-list@redhat.com Subject: [PATCH v1 1/9] qemu: monitor: enable query for static-recommended CPU model Date: Mon, 11 Sep 2023 17:07:08 -0400 Message-ID: <20230911210716.75648-2-walling@linux.ibm.com> In-Reply-To: <20230911210716.75648-1-walling@linux.ibm.com> References: <20230911210716.75648-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: SV6ilBzw_6YNLgxDM3BStMDpvXQzT6fG X-Proofpoint-ORIG-GUID: SV6ilBzw_6YNLgxDM3BStMDpvXQzT6fG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_16,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 spamscore=0 phishscore=0 mlxlogscore=957 mlxscore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110194 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Fiuczynski Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linux.ibm.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1694466643256100003 Content-Type: text/plain; charset="utf-8"; x-default="true" Future S390 hardware generations may decide to drop CPU features completely, thus rendering guests running with such features incapable of migrating to newer machines. This results in a problem whereas the user must manually disable features ahead of time to prepare a guest for migration in a mixed environment. To circumvent this issue, a "host-recommended" CPU model has been introduced, which is the host-model with delta changes that disable features that have been flagged as deprecated. Signed-off-by: Collin Walling Reviewed-by: Boris Fiuczynski --- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 6c590933aa..d3f63e0703 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1144,6 +1144,7 @@ struct _qemuMonitorCPUModelInfo { typedef enum { QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC, QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_FULL, + QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_REC, QEMU_MONITOR_CPU_MODEL_EXPANSION_FULL, } qemuMonitorCPUModelExpansionType; =20 diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 5b9edadcf7..7b2aee7a42 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5062,7 +5062,9 @@ qemuMonitorJSONQueryCPUModelExpansionOne(qemuMonitor = *mon, case QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_FULL: typeStr =3D "static"; break; - + case QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_REC: + typeStr =3D "static-recommended"; + break; case QEMU_MONITOR_CPU_MODEL_EXPANSION_FULL: typeStr =3D "full"; break; --=20 2.41.0 From nobody Sun May 12 13:49:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1694466574; cv=none; d=zohomail.com; s=zohoarc; b=Ijzee6wUFWwQhfTNSRdIcuejHtA2Gnnk/hcAsUsJRKCYZCCfizUlEpIDkKzwAt0v0HihV8PHvUMnIktUGno4TA/trKjBGBZqqSO2gtbygY0oGlmQ0C9rAmICTOJaOcUv83eMbGHSfFx7v4kzo9s/MQl6da9PmOWw7VAwnKXP7OM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694466574; 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; bh=2SJyelgv6hFzkIRy/V3QkUyxw1jWm5+gKOECrSIVc3E=; b=RVcmXfth+BZ/E1Leg1Ib5L1Px2Avq+xbqVSgxC16BDZOWl/W27JGvqbIgcJhk2nrGvqr5Du+tZMhgER1IswVe9+k62Tpz/hrQYdh5WXLg35hS6sYyinNyouHs+K1kkzt/PD9bcgdWyNp6mWgbAv7SsnEF16GxNUpjhZ38ZpjoqI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=reject dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1694466574649259.29882274890906; Mon, 11 Sep 2023 14:09:34 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-180-IHPyiCC6OH2s6ReBmvEmBw-1; Mon, 11 Sep 2023 17:09:27 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B6F5F181A701; Mon, 11 Sep 2023 21:09:22 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9300B40C200B; Mon, 11 Sep 2023 21:09:22 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E4B041946A50; Mon, 11 Sep 2023 21:09:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DEB2A1946A67 for ; Mon, 11 Sep 2023 21:09:19 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B1E3740C200A; Mon, 11 Sep 2023 21:09:19 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA5F040C2009 for ; Mon, 11 Sep 2023 21:09:19 +0000 (UTC) Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-inbound-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8227180268A for ; Mon, 11 Sep 2023 21:09:19 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-475-ZoXYn2PmNnKFupH9CTMh9w-1; Mon, 11 Sep 2023 17:09:17 -0400 Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38BKjoAb026811 for ; Mon, 11 Sep 2023 21:09:16 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t2a7dgnbw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Sep 2023 21:09:15 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38BIpqvp012037 for ; Mon, 11 Sep 2023 21:09:14 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3t13dydybe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Sep 2023 21:09:14 +0000 Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38BL9DlL721652 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Sep 2023 21:09:13 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BE7F958052; Mon, 11 Sep 2023 21:09:13 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7DD8358062; Mon, 11 Sep 2023 21:09:13 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.ibm.com.com (unknown [9.67.49.93]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 11 Sep 2023 21:09:13 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694466573; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2SJyelgv6hFzkIRy/V3QkUyxw1jWm5+gKOECrSIVc3E=; b=MwNETl4k/rZlQOYMnpUN8jiKsvKRkC0HQvSAHue88v7VB2+dizqCJiCLCJmRTRmbhWOmVG aTloc7tiWW+WobKk+8dXJ15nk5HZUAHatWNdkMkZfN6G18fQN5/irWaDGcGgTdGaULU5E+ xhg005tBBmZhEAuua8qwTPeP7fz+5/k= X-MC-Unique: IHPyiCC6OH2s6ReBmvEmBw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: ZoXYn2PmNnKFupH9CTMh9w-1 From: Collin Walling To: libvir-list@redhat.com Subject: [PATCH v1 2/9] qemu: capabilities: add static-recommended capability Date: Mon, 11 Sep 2023 17:07:09 -0400 Message-ID: <20230911210716.75648-3-walling@linux.ibm.com> In-Reply-To: <20230911210716.75648-1-walling@linux.ibm.com> References: <20230911210716.75648-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: XL6WjmbSJXIASMyuuO1Aj2_-xiAlcN1t X-Proofpoint-ORIG-GUID: XL6WjmbSJXIASMyuuO1Aj2_-xiAlcN1t X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_16,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 malwarescore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 spamscore=0 impostorscore=0 phishscore=0 mlxlogscore=917 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110194 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Fiuczynski Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linux.ibm.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1694466640883100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Check for the QEMU capability to query for a static-recommended CPU model via CPU model expansion. Cache this capability for later. Signed-off-by: Collin Walling Reviewed-by: Boris Fiuczynski --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_8.1.0_s390x.replies | 6 +++++- tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 87412dd4ec..4ace8eea4a 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -697,6 +697,7 @@ VIR_ENUM_IMPL(virQEMUCaps, =20 /* 450 */ "run-with.async-teardown", /* QEMU_CAPS_RUN_WITH_ASYNC_TEARD= OWN */ + "query-cpu-model-expansion.static-recommended", /* QEMU_CAPS= _QUERY_CPU_MODEL_EXPANSION_STATIC_RECOMMENDED */ ); =20 =20 @@ -1557,6 +1558,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSc= hemaQueries[] =3D { { "object-add/arg-type/+iothread/thread-pool-max", QEMU_CAPS_IOTHREAD_= THREAD_POOL_MAX }, { "query-migrate/ret-type/blocked-reasons", QEMU_CAPS_MIGRATION_BLOCKE= D_REASONS }, { "screendump/arg-type/format/^png", QEMU_CAPS_SCREENSHOT_FORMAT_PNG }, + { "query-cpu-model-expansion/arg-type/type/^static-recommended", QEMU_= CAPS_QUERY_CPU_MODEL_EXPANSION_STATIC_RECOMMENDED }, }; =20 typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index e51d3fffdc..4fa64b6435 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -676,6 +676,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ =20 /* 450 */ QEMU_CAPS_RUN_WITH_ASYNC_TEARDOWN, /* asynchronous teardown -run-with = async-teardown=3Don|off */ + QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_STATIC_RECOMMENDED, /* query-cpu-m= odel-expansion supports type static-recommended*/ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_8.1.0_s390x.replies b/tests/qe= mucapabilitiesdata/caps_8.1.0_s390x.replies index 57ce64e88e..8cd7312bea 100644 --- a/tests/qemucapabilitiesdata/caps_8.1.0_s390x.replies +++ b/tests/qemucapabilitiesdata/caps_8.1.0_s390x.replies @@ -15398,12 +15398,16 @@ }, { "name": "full" + }, + { + "name": "static-recommended" } ], "meta-type": "enum", "values": [ "static", - "full" + "full", + "static-recommended" ] }, { diff --git a/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml b/tests/qemuca= pabilitiesdata/caps_8.1.0_s390x.xml index 427ee9d5c7..0bb4233383 100644 --- a/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml +++ b/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml @@ -112,6 +112,7 @@ + 8000050 39100245 v8.0.0-1270-g1c12355b --=20 2.41.0 From nobody Sun May 12 13:49:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1694466574; cv=none; d=zohomail.com; s=zohoarc; b=ScJ7WOI0w4GmeiCbGIWa8cGNSAoC/j9xmihxA9kgd5PksRNcjkEW6UOWlF6G1z6pcwJKF4GEB8dkxJcjFtcXAZgRRfB+DI7r8AOdGUOIwh/YmKIyMiE82JClwqEwAC3klgWnZibdjKkvl3qzZf0M+Nqa8Qd2V7raLGmFX4c8FoM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694466574; 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; bh=lxPUbYNGg6pmcQWIoDVugQyTb+CaHiTBA7wvpLG2TLQ=; b=gq7r4b/j5AnRQBe4HxCG6eUPnXHyyEd1/SLSHBjo3HoCcwsXqPoIGNX656q57f/opiJOTS8SqhchLooBRTSn9f//cGVOc6QBGq4KKz821Y9/HE2IofOl7ZFWhCtGFoJxoZHAEq2bnt+tIhreRz6Dk/bNX3AyrJ6REx61NYgOmQE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=reject dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1694466574191858.5597116209426; Mon, 11 Sep 2023 14:09:34 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-623-DlFauPGOPFu4NFVe0dYx-A-1; Mon, 11 Sep 2023 17:09:30 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 77C30865BF5; Mon, 11 Sep 2023 21:09:22 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 260B140C6EBF; Mon, 11 Sep 2023 21:09:19 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2A90419465A3; Mon, 11 Sep 2023 21:09:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9557F1946597 for ; Mon, 11 Sep 2023 21:09:18 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8485240C6EC0; Mon, 11 Sep 2023 21:09:18 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast08.extmail.prod.ext.rdu2.redhat.com [10.11.55.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D35B40C6EA8 for ; Mon, 11 Sep 2023 21:09:18 +0000 (UTC) Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-inbound-delivery-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5FC8E380391A for ; Mon, 11 Sep 2023 21:09:18 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-466-8J0qmAb8Mjy14UE6puZpDA-1; Mon, 11 Sep 2023 17:09:16 -0400 Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38BKd31K032734 for ; Mon, 11 Sep 2023 21:09:16 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t29vg8yhe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Sep 2023 21:09:15 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38BJtlqJ002752 for ; Mon, 11 Sep 2023 21:09:15 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3t14hknktb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Sep 2023 21:09:15 +0000 Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38BL9ECH37225062 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Sep 2023 21:09:14 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 259CE58052; Mon, 11 Sep 2023 21:09:14 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D8F8F5805E; Mon, 11 Sep 2023 21:09:13 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.ibm.com.com (unknown [9.67.49.93]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 11 Sep 2023 21:09:13 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694466573; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=lxPUbYNGg6pmcQWIoDVugQyTb+CaHiTBA7wvpLG2TLQ=; b=Ezo+7sggyrg/yg0/Sd+lEUYY40duE3CjwYWeqw5dxIvj+GjPu3DKYiTuVZBgHbrrpdeGnQ X08jY3zq98YPgOvC1C5M6k/3c02vrU5FP6c05d/mgZQNYYRWxMr5FafxI1OiJ4+JZJZ6Qd 6GiKgyRNvX0PWDlJ0vtn735CLmAB/WI= X-MC-Unique: DlFauPGOPFu4NFVe0dYx-A-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 8J0qmAb8Mjy14UE6puZpDA-1 From: Collin Walling To: libvir-list@redhat.com Subject: [PATCH v1 3/9] qemu: capabilities: refactor virQEMUCapsLoadHostCPUModelInfo Date: Mon, 11 Sep 2023 17:07:10 -0400 Message-ID: <20230911210716.75648-4-walling@linux.ibm.com> In-Reply-To: <20230911210716.75648-1-walling@linux.ibm.com> References: <20230911210716.75648-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 4fntNUA7ljJDvR-Bs5hw7N8clIuX9cDt X-Proofpoint-GUID: 4fntNUA7ljJDvR-Bs5hw7N8clIuX9cDt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_16,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 adultscore=0 mlxlogscore=457 spamscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 phishscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110194 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Fiuczynski Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linux.ibm.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1694466628333100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This will be used to load the host recommended CPU model, introduced in a subsequent patch. Also move ctxt auto restore to end of variable declarations to avoid a compiler warning. Signed-off-by: Collin Walling Reviewed-by: Boris Fiuczynski --- src/qemu/qemu_capabilities.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 4ace8eea4a..40cdcffbfe 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3894,19 +3894,18 @@ virQEMUCapsSetCPUModelInfo(virQEMUCaps *qemuCaps, =20 =20 static int -virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *caps, - xmlXPathContextPtr ctxt, - const char *typeStr) +virQEMUCapsLoadCPUModelInfo(qemuMonitorCPUModelInfo **modelInfo, + xmlXPathContextPtr ctxt, + char *xpath) { xmlNodePtr hostCPUNode; g_autofree xmlNodePtr *nodes =3D NULL; - VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autoptr(qemuMonitorCPUModelInfo) hostCPU =3D NULL; - g_autofree char *xpath =3D g_strdup_printf("./hostCPU[@type=3D'%s']", = typeStr); size_t i; int n; virTristateBool migratability; int val; + VIR_XPATH_NODE_AUTORESTORE(ctxt) =20 if (!(hostCPUNode =3D virXPathNode(xpath, ctxt))) { return 0; @@ -3991,11 +3990,22 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *c= aps, } } =20 - caps->hostCPU.info =3D g_steal_pointer(&hostCPU); + *modelInfo =3D g_steal_pointer(&hostCPU); return 0; } =20 =20 +static int +virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *caps, + xmlXPathContextPtr ctxt, + const char *typeStr) +{ + g_autofree char *xpath =3D g_strdup_printf("./hostCPU[@type=3D'%s']", = typeStr); + + return virQEMUCapsLoadCPUModelInfo(&caps->hostCPU.info, ctxt, xpath); +} + + static int virQEMUCapsLoadCPUModels(virArch arch, virQEMUCapsAccel *caps, --=20 2.41.0 From nobody Sun May 12 13:49:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1694466574; cv=none; d=zohomail.com; s=zohoarc; b=gyKBZSNx/2vQp6gBPSs7hGTu8vBewikI53/P+aIH+a80WQ/mG7c4HBSE6tkE/38W1fa+gV2X9Q8AcJFr49Yal3AwZFsGuKSsrMdxyYfBhOC8M4nhaUrC9wwCnSWZ1vZRqK7izdlKYfJwPEypXwe/yew/Og+P8VNAUsUEqJigFpg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694466574; 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; bh=NQVjoMf1d+TR8CSPMABmT7TBjWmcwAdEk28dYK/1Kjs=; b=QG8qGBUgEYg0w85KWYqIR+6qHyT1HP7HsWcebnDuOv3WbYz22d9EKOf8/JPoLhSkY4XaplBuEtcI67E6rZ08UnOcYv21+1xmBSg/FWnoqmajABRTqWwzhjNfbysnaYDoAafGKLHIqvb6pv5GWa/chV8+8qolcbvRqDCKcRYqg8s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=reject dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1694466574316746.8216174378607; Mon, 11 Sep 2023 14:09:34 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-272-vJLuivToP4icktTdoPaGog-1; Mon, 11 Sep 2023 17:09:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E3CB41C068DC; Mon, 11 Sep 2023 21:09:23 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCF351054FC1; Mon, 11 Sep 2023 21:09:23 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 891B619465BC; Mon, 11 Sep 2023 21:09:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 657B219465B6 for ; Mon, 11 Sep 2023 21:09:21 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 44B4544069; Mon, 11 Sep 2023 21:09:21 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3CEA144029 for ; Mon, 11 Sep 2023 21:09:21 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1BA313C18DD0 for ; Mon, 11 Sep 2023 21:09:21 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-626-zmT4We16MZi8Qyz8bPU4gw-1; Mon, 11 Sep 2023 17:09:18 -0400 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38BL8N0W018655 for ; Mon, 11 Sep 2023 21:09:17 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t29un0xrv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Sep 2023 21:09:16 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38BJcgAD023142 for ; Mon, 11 Sep 2023 21:09:15 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3t141ndrk7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Sep 2023 21:09:15 +0000 Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38BL9ENG21430538 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Sep 2023 21:09:14 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8B83058052; Mon, 11 Sep 2023 21:09:14 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 404E55805A; Mon, 11 Sep 2023 21:09:14 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.ibm.com.com (unknown [9.67.49.93]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 11 Sep 2023 21:09:14 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694466573; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=NQVjoMf1d+TR8CSPMABmT7TBjWmcwAdEk28dYK/1Kjs=; b=LshWBo5aP/3XCv2VEX5dIBmls4SqoBYHiElefzfOU9B3SL4pONfACDYrRnJXkAYJFUniMT j6wQdQnJ8lM85SlQjIOtK67ttlahCpiYVyGKIPwck8f1LpZjZ/U8g+XTFo9s+fg/7nJ0tl UE6hP+/1VCQ44XGEFhrXCoszoQDPDXY= X-MC-Unique: vJLuivToP4icktTdoPaGog-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: zmT4We16MZi8Qyz8bPU4gw-1 From: Collin Walling To: libvir-list@redhat.com Subject: [PATCH v1 4/9] qemu: capabilities: query and cache host-recommended CPU model Date: Mon, 11 Sep 2023 17:07:11 -0400 Message-ID: <20230911210716.75648-5-walling@linux.ibm.com> In-Reply-To: <20230911210716.75648-1-walling@linux.ibm.com> References: <20230911210716.75648-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: icdgSkmeJDvQiedAYZXKJW9YmDtAEFkw X-Proofpoint-ORIG-GUID: icdgSkmeJDvQiedAYZXKJW9YmDtAEFkw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_16,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110194 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Fiuczynski Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linux.ibm.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1694466638030100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Query the host-recommended CPU model from QEMU, if it is supported. This model will be stored in the QEMU capabilities file underneath the closing tag, labeled . An example follows, (shortened as to not overwhelm the commit message): ... Signed-off-by: Collin Walling Reviewed-by: Boris Fiuczynski --- src/conf/schemas/cputypes.rng | 1 + src/qemu/qemu_capabilities.c | 108 +++++++++++++++--- src/qemu/qemu_capabilities.h | 3 + src/qemu/qemu_capspriv.h | 6 +- tests/cputest.c | 4 +- .../caps_8.1.0_s390x.replies | 74 ++++++++++++ .../qemucapabilitiesdata/caps_8.1.0_s390x.xml | 54 +++++++++ 7 files changed, 231 insertions(+), 19 deletions(-) diff --git a/src/conf/schemas/cputypes.rng b/src/conf/schemas/cputypes.rng index db1aa57158..5e89d67c8e 100644 --- a/src/conf/schemas/cputypes.rng +++ b/src/conf/schemas/cputypes.rng @@ -10,6 +10,7 @@ host-model host-passthrough maximum + host-recommended diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 40cdcffbfe..59403808ee 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -724,6 +724,11 @@ struct _virQEMUCapsHostCPUData { qemuMonitorCPUModelInfo *info; /* Physical address size of the host CPU or 0 if unknown or not applic= able. */ unsigned int physAddrSize; + /* Host CPU model with delta changes reported by the hypervisor to ens= ure + * migration compatibility with newer machines that may exclude certain + * features available on older machines. + */ + qemuMonitorCPUModelInfo *hostRec; /* Host CPU definition reported in domain capabilities. */ virCPUDef *reported; /* Migratable host CPU definition used for updating guest CPU. */ @@ -732,6 +737,8 @@ struct _virQEMUCapsHostCPUData { * combined with features reported by QEMU. This is used for backward * compatible comparison between a guest CPU and a host CPU. */ virCPUDef *full; + /* CPU definition converted from hostRec model info */ + virCPUDef *recommended; }; =20 typedef struct _virQEMUCapsAccel virQEMUCapsAccel; @@ -1834,6 +1841,12 @@ virQEMUCapsHostCPUDataCopy(virQEMUCapsHostCPUData *d= st, =20 if (src->full) dst->full =3D virCPUDefCopy(src->full); + + if (src->hostRec) + dst->hostRec =3D qemuMonitorCPUModelInfoCopy(src->hostRec); + + if (src->recommended) + dst->recommended =3D virCPUDefCopy(src->recommended); } =20 =20 @@ -1841,9 +1854,11 @@ static void virQEMUCapsHostCPUDataClear(virQEMUCapsHostCPUData *cpuData) { qemuMonitorCPUModelInfoFree(cpuData->info); + qemuMonitorCPUModelInfoFree(cpuData->hostRec); virCPUDefFree(cpuData->reported); virCPUDefFree(cpuData->migratable); virCPUDefFree(cpuData->full); + virCPUDefFree(cpuData->recommended); =20 memset(cpuData, 0, sizeof(*cpuData)); } @@ -2190,6 +2205,9 @@ virQEMUCapsGetHostModel(virQEMUCaps *qemuCaps, /* 'full' is non-NULL only if we have data from both QEMU and * virCPUGetHost */ return cpuData->full ? cpuData->full : cpuData->reported; + + case VIR_QEMU_CAPS_HOST_CPU_RECOMMENDED: + return cpuData->recommended; } =20 return NULL; @@ -2202,7 +2220,8 @@ virQEMUCapsSetHostModel(virQEMUCaps *qemuCaps, unsigned int physAddrSize, virCPUDef *reported, virCPUDef *migratable, - virCPUDef *full) + virCPUDef *full, + virCPUDef *recommended) { virQEMUCapsHostCPUData *cpuData; =20 @@ -2211,6 +2230,7 @@ virQEMUCapsSetHostModel(virQEMUCaps *qemuCaps, cpuData->reported =3D reported; cpuData->migratable =3D migratable; cpuData->full =3D full; + cpuData->recommended =3D recommended; } =20 =20 @@ -3048,6 +3068,7 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps, { const char *model =3D virQEMUCapsTypeIsAccelerated(virtType) ? "host" = : "max"; g_autoptr(qemuMonitorCPUModelInfo) modelInfo =3D NULL; + g_autoptr(qemuMonitorCPUModelInfo) hostRecInfo =3D NULL; g_autoptr(qemuMonitorCPUModelInfo) nonMigratable =3D NULL; g_autoptr(virCPUDef) cpu =3D NULL; qemuMonitorCPUModelExpansionType type; @@ -3133,6 +3154,19 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps, return -1; } =20 + /* Retrieve the hypervisor recommended host CPU */ + if (virQEMUCapsTypeIsAccelerated(virtType) && + ARCH_IS_S390(qemuCaps->arch) && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_STATI= C_RECOMMENDED)) { + type =3D QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_REC; + + if (qemuMonitorGetCPUModelExpansion(mon, type, cpu, true, false, f= ail_no_props, + &hostRecInfo) < 0) + return -1; + + accel->hostCPU.hostRec =3D g_steal_pointer(&hostRecInfo); + } + accel->hostCPU.info =3D g_steal_pointer(&modelInfo); return 0; } @@ -3157,7 +3191,7 @@ virQEMUCapsGetCPUFeatures(virQEMUCaps *qemuCaps, size_t n; =20 *features =3D NULL; - modelInfo =3D virQEMUCapsGetCPUModelInfo(qemuCaps, virtType); + modelInfo =3D virQEMUCapsGetCPUModelInfo(qemuCaps, virtType, false); =20 if (!modelInfo) return 0; @@ -3725,14 +3759,19 @@ int virQEMUCapsInitCPUModel(virQEMUCaps *qemuCaps, virDomainVirtType type, virCPUDef *cpu, - bool migratable) + bool migratable, + bool recommended) { - qemuMonitorCPUModelInfo *modelInfo =3D virQEMUCapsGetCPUModelInfo(qemu= Caps, type); + qemuMonitorCPUModelInfo *modelInfo =3D virQEMUCapsGetCPUModelInfo(qemu= Caps, type, + recomm= ended); int ret =3D 1; =20 if (migratable && modelInfo && !modelInfo->migratability) return 1; =20 + if (recommended && !modelInfo) + return 2; + if (ARCH_IS_S390(qemuCaps->arch)) { ret =3D virQEMUCapsInitCPUModelS390(qemuCaps, type, modelInfo, cpu, migratable); @@ -3775,6 +3814,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps, virCPUDef *hostCPU =3D NULL; virCPUDef *fullCPU =3D NULL; unsigned int physAddrSize =3D 0; + virCPUDef *recCPU =3D NULL; size_t i; int rc; =20 @@ -3784,7 +3824,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps, if (!(cpu =3D virQEMUCapsNewHostCPUModel())) goto error; =20 - if ((rc =3D virQEMUCapsInitCPUModel(qemuCaps, type, cpu, false)) < 0) { + if ((rc =3D virQEMUCapsInitCPUModel(qemuCaps, type, cpu, false, false)= ) < 0) { goto error; } else if (rc =3D=3D 1) { g_autoptr(virDomainCapsCPUModels) cpuModels =3D NULL; @@ -3823,7 +3863,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps, if (!(migCPU =3D virQEMUCapsNewHostCPUModel())) goto error; =20 - if ((rc =3D virQEMUCapsInitCPUModel(qemuCaps, type, migCPU, true)) < 0= ) { + if ((rc =3D virQEMUCapsInitCPUModel(qemuCaps, type, migCPU, true, fals= e)) < 0) { goto error; } else if (rc =3D=3D 1) { VIR_DEBUG("CPU migratability not provided by QEMU"); @@ -3833,6 +3873,17 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps, goto error; } =20 + if (!(recCPU =3D virQEMUCapsNewHostCPUModel())) + goto error; + + if ((rc =3D virQEMUCapsInitCPUModel(qemuCaps, type, recCPU, false, tru= e)) < 0) { + goto error; + } else if (rc =3D=3D 2) { + VIR_DEBUG("CPU reccomendation not provided by QEMU"); + virCPUDefFree(recCPU); + recCPU =3D NULL; + } + if (ARCH_IS_X86(qemuCaps->arch) && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_UNAVAILABLE_FEATURES)) { if (cpu && @@ -3851,7 +3902,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps, if (virQEMUCapsTypeIsAccelerated(type)) virHostCPUGetPhysAddrSize(hostArch, &physAddrSize); =20 - virQEMUCapsSetHostModel(qemuCaps, type, physAddrSize, cpu, migCPU, ful= lCPU); + virQEMUCapsSetHostModel(qemuCaps, type, physAddrSize, cpu, migCPU, ful= lCPU, recCPU); =20 cleanup: virCPUDefFree(cpuExpanded); @@ -3862,6 +3913,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps, virCPUDefFree(cpu); virCPUDefFree(migCPU); virCPUDefFree(fullCPU); + virCPUDefFree(recCPU); virResetLastError(); goto cleanup; } @@ -3878,8 +3930,12 @@ virQEMUCapsUpdateHostCPUModel(virQEMUCaps *qemuCaps, =20 qemuMonitorCPUModelInfo * virQEMUCapsGetCPUModelInfo(virQEMUCaps *qemuCaps, - virDomainVirtType type) + virDomainVirtType type, + bool recommended) { + if (recommended) + return virQEMUCapsGetAccel(qemuCaps, type)->hostCPU.hostRec; + return virQEMUCapsGetAccel(qemuCaps, type)->hostCPU.info; } =20 @@ -4006,6 +4062,17 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *ca= ps, } =20 =20 +static int +virQEMUCapsLoadHostRecCPUModelInfo(virQEMUCapsAccel *caps, + xmlXPathContextPtr ctxt, + const char *typeStr) +{ + g_autofree char *xpath =3D g_strdup_printf("./hostRecCPU[@type=3D'%s']= ", typeStr); + + return virQEMUCapsLoadCPUModelInfo(&caps->hostCPU.hostRec, ctxt, xpath= ); +} + + static int virQEMUCapsLoadCPUModels(virArch arch, virQEMUCapsAccel *caps, @@ -4169,6 +4236,10 @@ virQEMUCapsLoadAccel(virQEMUCaps *qemuCaps, if (virQEMUCapsLoadHostCPUModelInfo(caps, ctxt, typeStr) < 0) return -1; =20 + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_STATI= C_RECOMMENDED) && + virQEMUCapsLoadHostRecCPUModelInfo(caps, ctxt, typeStr) < 0) + return -1; + if (virQEMUCapsLoadCPUModels(qemuCaps->arch, caps, ctxt, typeStr) < 0) return -1; =20 @@ -4705,18 +4776,24 @@ virQEMUCapsLoadCache(virArch hostArch, static void virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsAccel *caps, virBuffer *buf, - const char *typeStr) + const char *typeStr, + bool recommended) { - qemuMonitorCPUModelInfo *model =3D caps->hostCPU.info; + qemuMonitorCPUModelInfo *model; size_t i; =20 + if (recommended) + model =3D caps->hostCPU.hostRec; + else + model =3D caps->hostCPU.info; + if (!model) return; =20 virBufferAsprintf(buf, - "\n", - typeStr, model->name, - model->migratability ? "yes" : "no"); + "<%s type=3D'%s' model=3D'%s' migratability=3D'%s'>\= n", + recommended ? "hostRecCPU" : "hostCPU", typeStr, + model->name, model->migratability ? "yes" : "no"); virBufferAdjustIndent(buf, 2); =20 for (i =3D 0; i < model->nprops; i++) { @@ -4752,7 +4829,7 @@ virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsAccel *c= aps, } =20 virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "\n"); + virBufferAsprintf(buf, "\n", recommended ? "hostRecCPU" : "hostCP= U"); } =20 =20 @@ -4846,7 +4923,8 @@ virQEMUCapsFormatAccel(virQEMUCaps *qemuCaps, virQEMUCapsAccel *caps =3D virQEMUCapsGetAccel(qemuCaps, type); const char *typeStr =3D virQEMUCapsAccelStr(type); =20 - virQEMUCapsFormatHostCPUModelInfo(caps, buf, typeStr); + virQEMUCapsFormatHostCPUModelInfo(caps, buf, typeStr, false); + virQEMUCapsFormatHostCPUModelInfo(caps, buf, typeStr, true); virQEMUCapsFormatCPUModels(qemuCaps->arch, caps, buf, typeStr); virQEMUCapsFormatMachines(caps, buf, typeStr); =20 diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 4fa64b6435..bb68b74328 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -726,6 +726,9 @@ typedef enum { * combined with features reported by QEMU. This is used for backward * compatible comparison between a guest CPU and a host CPU. */ VIR_QEMU_CAPS_HOST_CPU_FULL, + /* Host CPU definition with a modified feature set based on dropped + * features on newer CPU models. */ + VIR_QEMU_CAPS_HOST_CPU_RECOMMENDED, } virQEMUCapsHostCPUType; =20 virCPUDef *virQEMUCapsGetHostModel(virQEMUCaps *qemuCaps, diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h index 06b36d2eb8..a97710eecf 100644 --- a/src/qemu/qemu_capspriv.h +++ b/src/qemu/qemu_capspriv.h @@ -64,11 +64,13 @@ int virQEMUCapsInitCPUModel(virQEMUCaps *qemuCaps, virDomainVirtType type, virCPUDef *cpu, - bool migratable); + bool migratable, + bool recommended); =20 qemuMonitorCPUModelInfo * virQEMUCapsGetCPUModelInfo(virQEMUCaps *qemuCaps, - virDomainVirtType type); + virDomainVirtType type, + bool recommended); =20 void virQEMUCapsSetCPUModelInfo(virQEMUCaps *qemuCaps, diff --git a/tests/cputest.c b/tests/cputest.c index b3253e3116..8d3a0dd4d9 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -857,7 +857,7 @@ cpuTestJSONCPUID(const void *arg) cpu->match =3D VIR_CPU_MATCH_EXACT; cpu->fallback =3D VIR_CPU_FALLBACK_FORBID; =20 - if (virQEMUCapsInitCPUModel(qemuCaps, VIR_DOMAIN_VIRT_KVM, cpu, false)= !=3D 0) + if (virQEMUCapsInitCPUModel(qemuCaps, VIR_DOMAIN_VIRT_KVM, cpu, false,= false) !=3D 0) return -1; =20 return cpuTestCompareXML(data->arch, cpu, result); @@ -875,7 +875,7 @@ cpuTestJSONSignature(const void *arg) if (!(qemuCaps =3D cpuTestMakeQEMUCaps(data))) return -1; =20 - modelInfo =3D virQEMUCapsGetCPUModelInfo(qemuCaps, VIR_DOMAIN_VIRT_KVM= ); + modelInfo =3D virQEMUCapsGetCPUModelInfo(qemuCaps, VIR_DOMAIN_VIRT_KVM= , false); if (!(hostData =3D virQEMUCapsGetCPUModelX86Data(qemuCaps, modelInfo, = false))) return -1; =20 diff --git a/tests/qemucapabilitiesdata/caps_8.1.0_s390x.replies b/tests/qe= mucapabilitiesdata/caps_8.1.0_s390x.replies index 8cd7312bea..2720408726 100644 --- a/tests/qemucapabilitiesdata/caps_8.1.0_s390x.replies +++ b/tests/qemucapabilitiesdata/caps_8.1.0_s390x.replies @@ -29649,6 +29649,80 @@ "id": "libvirt-37" } =20 +{ + "execute": "query-cpu-model-expansion", + "arguments": { + "type": "static-recommended", + "model": { + "name": "host" + } + }, + "id": "libvirt-38" +} + +{ + "return": { + "model": { + "name": "gen16a-base", + "props": { + "nnpa": true, + "aen": true, + "cmmnt": true, + "vxpdeh": true, + "aefsi": true, + "diag318": true, + "csske": false, + "mepoch": true, + "msa9": true, + "msa8": true, + "msa7": true, + "msa6": true, + "msa5": true, + "msa4": true, + "msa3": true, + "msa2": true, + "msa1": true, + "sthyi": true, + "edat": true, + "ri": true, + "deflate": true, + "edat2": true, + "etoken": true, + "vx": true, + "ipter": true, + "pai": true, + "paie": true, + "mepochptff": true, + "ap": true, + "vxeh": true, + "vxpd": true, + "esop": true, + "msa9_pckmo": true, + "vxeh2": true, + "esort": true, + "apqi": true, + "apft": true, + "els": true, + "iep": true, + "apqci": true, + "cte": false, + "ais": true, + "bpb": false, + "gs": true, + "ppa15": true, + "zpci": true, + "rdp": true, + "sea_esop2": true, + "beareh": true, + "te": false, + "cmm": true, + "vxpdeh2": true + } + } + }, + "id": "libvirt-38" +} + { "execute": "qmp_capabilities", "id": "libvirt-1" diff --git a/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml b/tests/qemuca= pabilitiesdata/caps_8.1.0_s390x.xml index 0bb4233383..c580cbb5b0 100644 --- a/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml +++ b/tests/qemucapabilitiesdata/caps_8.1.0_s390x.xml @@ -171,6 +171,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.41.0 From nobody Sun May 12 13:49:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1694466577; cv=none; d=zohomail.com; s=zohoarc; b=ZsxrD1acdydSbeOgXKCQPmxx6HVfM1TpywgETq1S7245BaR8KMmDt3930omc+Z/OU1zKjwor85Uf1ptCP2I+4AzgmG7ENvqNkEdo4hd+GIPJq1DztytLd7gyhTH1EiczHWu2PJEMg++tFAmjiS/i4MImVOTJt2IpR3iBucCKLTg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694466577; 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; bh=VDWx2nmUZotbZAP2LjtHNhpxoRZNKCZHSc6DW6R3zPg=; b=Xvbzk0DQZu6cAPso0NHURhcC7IURoneWYRstJfPjQ5RzfFwbya9eooWe1bdboSDR+XiwPwJ2G0GMADrL0uMXtFc35wpOU3kNP0oSrzwV252njsveuOy4UrtuzzHukSH3yQISSA34CmNJ72DJkBezftSJHBGgSdApZRFSfS6QH48= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=reject dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1694466577146873.3605608029644; Mon, 11 Sep 2023 14:09:37 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-113-0rhQwMzUOMGckugc2bme1w-1; Mon, 11 Sep 2023 17:09:29 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7253B8A4373; Mon, 11 Sep 2023 21:09:23 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D64C2156702; Mon, 11 Sep 2023 21:09:23 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 414121946597; Mon, 11 Sep 2023 21:09:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 319C919465B2 for ; Mon, 11 Sep 2023 21:09:21 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 12D432027045; Mon, 11 Sep 2023 21:09:21 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast08.extmail.prod.ext.rdu2.redhat.com [10.11.55.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0AD502026D68 for ; Mon, 11 Sep 2023 21:09:21 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E34E63803923 for ; Mon, 11 Sep 2023 21:09:20 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-642-ILTJexQ2OwOJa06y0XGR8w-1; Mon, 11 Sep 2023 17:09:19 -0400 Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38BL7ksw017223 for ; Mon, 11 Sep 2023 21:09:17 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t29dy9tad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Sep 2023 21:09:17 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38BJ53Y2012083 for ; Mon, 11 Sep 2023 21:09:16 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([172.16.1.68]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3t13dydybh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Sep 2023 21:09:16 +0000 Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38BL9FLx35979788 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Sep 2023 21:09:15 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E69E65805A; Mon, 11 Sep 2023 21:09:14 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A7FB158056; Mon, 11 Sep 2023 21:09:14 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.ibm.com.com (unknown [9.67.49.93]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 11 Sep 2023 21:09:14 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694466576; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VDWx2nmUZotbZAP2LjtHNhpxoRZNKCZHSc6DW6R3zPg=; b=EVhao28wY92/Asauu0DQ0CIzn2Tg40//a2WUv4F+xEIt6V1DwwJUpzkEBlwPtCEfltzvJk d8DyV9hO0HQWeeRo1JXmrEQCwTKuY+24MIUOTdFk3IF+JlZ+xaFnhmjRRV751oT5/WKFo8 HBHgc15oikiRl5IRh6+gEwN2R0LFk7M= X-MC-Unique: 0rhQwMzUOMGckugc2bme1w-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: ILTJexQ2OwOJa06y0XGR8w-1 From: Collin Walling To: libvir-list@redhat.com Subject: [PATCH v1 5/9] cpu: conf: add cpu mode for host-recommended Date: Mon, 11 Sep 2023 17:07:12 -0400 Message-ID: <20230911210716.75648-6-walling@linux.ibm.com> In-Reply-To: <20230911210716.75648-1-walling@linux.ibm.com> References: <20230911210716.75648-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: yK1vhDzjLbZIMYYIvRMdxENjbMppmZ4C X-Proofpoint-ORIG-GUID: yK1vhDzjLbZIMYYIvRMdxENjbMppmZ4C X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_16,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 spamscore=0 phishscore=0 mlxlogscore=784 mlxscore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110194 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Fiuczynski Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linux.ibm.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1694466635496100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Add VIR_CPU_MODE_HOST_RECOMMENDED for host-recommended CPU models and satisfy all switch cases. For the most part, host-recommended will follow similar paths as host-model, aside from touching any architecture specifics. Signed-off-by: Collin Walling Reviewed-by: Boris Fiuczynski --- src/conf/cpu_conf.c | 1 + src/conf/cpu_conf.h | 1 + src/cpu/cpu.c | 1 + src/cpu/cpu_ppc64.c | 2 ++ src/qemu/qemu_capabilities.c | 4 ++++ src/qemu/qemu_command.c | 1 + src/qemu/qemu_domain.c | 2 ++ src/qemu/qemu_validate.c | 1 + 8 files changed, 13 insertions(+) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 7abe489733..c0116808d8 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -43,6 +43,7 @@ VIR_ENUM_IMPL(virCPUMode, "host-model", "host-passthrough", "maximum", + "host-recommended", ); =20 VIR_ENUM_IMPL(virCPUMatch, diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index 3e4c53675c..f73d852e69 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -44,6 +44,7 @@ typedef enum { VIR_CPU_MODE_HOST_MODEL, VIR_CPU_MODE_HOST_PASSTHROUGH, VIR_CPU_MODE_MAXIMUM, + VIR_CPU_MODE_HOST_RECOMMENDED, =20 VIR_CPU_MODE_LAST } virCPUMode; diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index bb5737e938..805aff1bf5 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -587,6 +587,7 @@ virCPUUpdate(virArch arch, return 0; =20 case VIR_CPU_MODE_HOST_MODEL: + case VIR_CPU_MODE_HOST_RECOMMENDED: relative =3D true; break; =20 diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index e13cdbdf6b..dc42e869e7 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -483,6 +483,8 @@ ppc64Compute(virCPUDef *host, * look up guest CPU information */ guest_model =3D ppc64ModelFromCPU(cpu, map); break; + case VIR_CPU_MODE_HOST_RECOMMENDED: + break; } } else { /* Other host CPU information */ diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 59403808ee..d7096a08c2 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2340,6 +2340,10 @@ virQEMUCapsIsCPUModeSupported(virQEMUCaps *qemuCaps, case VIR_CPU_MODE_MAXIMUM: return virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_MAX); =20 + case VIR_CPU_MODE_HOST_RECOMMENDED: + return !!virQEMUCapsGetHostModel(qemuCaps, type, + VIR_QEMU_CAPS_HOST_CPU_RECOMMENDE= D); + case VIR_CPU_MODE_LAST: break; } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a912ed064f..a45e2fbb95 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6293,6 +6293,7 @@ qemuBuildCpuModelArgStr(virQEMUDriver *driver, virBufferAdd(buf, cpu->model, -1); break; =20 + case VIR_CPU_MODE_HOST_RECOMMENDED: case VIR_CPU_MODE_LAST: break; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c7d64e1b5c..f7493431ac 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4753,6 +4753,7 @@ qemuDomainDefCPUPostParse(virDomainDef *def, break; =20 case VIR_CPU_MODE_HOST_MODEL: + case VIR_CPU_MODE_HOST_RECOMMENDED: def->cpu->check =3D VIR_CPU_CHECK_PARTIAL; break; =20 @@ -6995,6 +6996,7 @@ qemuDomainObjCheckCPUTaint(virQEMUDriver *driver, } break; case VIR_CPU_MODE_HOST_MODEL: + case VIR_CPU_MODE_HOST_RECOMMENDED: case VIR_CPU_MODE_LAST: default: break; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 1346bbfb44..387c2f1fa8 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -372,6 +372,7 @@ qemuValidateDomainDefCpu(virQEMUDriver *driver, } break; =20 + case VIR_CPU_MODE_HOST_RECOMMENDED: case VIR_CPU_MODE_CUSTOM: case VIR_CPU_MODE_LAST: break; --=20 2.41.0 From nobody Sun May 12 13:49:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1694466579; cv=none; d=zohomail.com; s=zohoarc; b=MpTsdCRSZvTb+u2tgImHqQYvWdxHJcF+R0riJLsUofpj6/KlQ16affSE5J3pVmCuNSQHpFfHYlaw7vzpJniAegXGoZEZOK3adlsn6/pElLcfpULm4HMu+PeXDvzSKF/THH74r5SafqZYtnuUsv5B/EFEoUMyf251gaC+qLoi3bI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694466579; 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; bh=RvCfTY8NM64j55CE/Xf+OWAhxkjRaRsJQYNSCNghtTM=; b=cgm3wBqI9hqhbdwDZwHX0Nk4L5HFl8C845NfjFmTacHCiD5GxnB9QSzVGnApTv2qXQMzifGeH6JPZzReR8vNJTuy1ZUNCvqqFwm2Su5VZB0LuKYOLlyVNFkAbrdSWmHn7ZOEl8dlAZWc0EZTRxHU301Rd7X0iIui52YMeMapmiA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=reject dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1694466579189592.6640295506195; Mon, 11 Sep 2023 14:09:39 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-156-oDPIH-AHNEm7TvuL867J6A-1; Mon, 11 Sep 2023 17:09:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7A544816514; Mon, 11 Sep 2023 21:09:22 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0EF0D1054FC3; Mon, 11 Sep 2023 21:09:22 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 660F719465B7; Mon, 11 Sep 2023 21:09:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 73E3519465A4 for ; Mon, 11 Sep 2023 21:09:20 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 63AFC2027019; Mon, 11 Sep 2023 21:09:20 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5BDFA2026D4B for ; Mon, 11 Sep 2023 21:09:20 +0000 (UTC) Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-inbound-delivery-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3A6D4101FAA2 for ; Mon, 11 Sep 2023 21:09:20 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-182-Q-9V5IdCNA64K48KmWnSwg-1; Mon, 11 Sep 2023 17:09:18 -0400 Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38BKd6g6000531 for ; Mon, 11 Sep 2023 21:09:17 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t29vg8yjb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Sep 2023 21:09:17 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38BKrPSa024034 for ; Mon, 11 Sep 2023 21:09:16 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([172.16.1.68]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3t131sx50n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Sep 2023 21:09:16 +0000 Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38BL9FAx35652064 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Sep 2023 21:09:15 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 52D2D58056; Mon, 11 Sep 2023 21:09:15 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0D11558052; Mon, 11 Sep 2023 21:09:15 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.ibm.com.com (unknown [9.67.49.93]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 11 Sep 2023 21:09:14 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694466577; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=RvCfTY8NM64j55CE/Xf+OWAhxkjRaRsJQYNSCNghtTM=; b=D7Li+Y921j+2UE+8RqxV4iv16i5e3/mIG0Scax8VSC5omh2Z5ebtax6eSLZytg/OCkqImM ygoGuKyzet0wra1QB0MuX4w/2x0mWD14LNcHeGbyn2juJKgUHBvvsDRoPxUlum1wdn+lNE fxw7/MvP5HtLjq0ExlClpS9N+prkW0s= X-MC-Unique: oDPIH-AHNEm7TvuL867J6A-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: Q-9V5IdCNA64K48KmWnSwg-1 From: Collin Walling To: libvir-list@redhat.com Subject: [PATCH v1 6/9] domain: capabilities: report host-recommended CPU model Date: Mon, 11 Sep 2023 17:07:13 -0400 Message-ID: <20230911210716.75648-7-walling@linux.ibm.com> In-Reply-To: <20230911210716.75648-1-walling@linux.ibm.com> References: <20230911210716.75648-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: xADgctp3SHttphnDHpTjZTk0mj8XrGAp X-Proofpoint-GUID: xADgctp3SHttphnDHpTjZTk0mj8XrGAp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_16,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 adultscore=0 mlxlogscore=941 spamscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 phishscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110194 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Fiuczynski Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linux.ibm.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1694466643941100007 Content-Type: text/plain; charset="utf-8"; x-default="true" Report the host-recommended CPU definition in the domaincapabilities. Currently, only s390x supports this model, but the formatting remains open if other archs decide to support this as well. Signed-off-by: Collin Walling Reviewed-by: Boris Fiuczynski --- src/conf/domain_capabilities.c | 16 +++++++ src/conf/domain_capabilities.h | 1 + src/conf/schemas/domaincaps.rng | 24 ++++++++++ src/qemu/qemu_capabilities.c | 8 ++++ tests/domaincapsdata/qemu_8.1.0.s390x.xml | 55 +++++++++++++++++++++++ 5 files changed, 104 insertions(+) diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 2fa5756184..4b9019f252 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -450,6 +450,22 @@ virDomainCapsCPUFormat(virBuffer *buf, virBufferAddLit(buf, "supported=3D'no'/>\n"); } =20 + if (cpu->hostRecommended) { + virBufferAsprintf(buf, "hostRecommended) { + virBufferAddLit(buf, "supported=3D'yes'>\n"); + virBufferAdjustIndent(buf, 2); + + virCPUDefFormatBuf(buf, cpu->hostRecommended); + + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); + } else { + virBufferAddLit(buf, "supported=3D'no'/>\n"); + } + } + virBufferAsprintf(buf, "custom && cpu->custom->nmodels) { diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index 01bcfa2e39..893101ee97 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -201,6 +201,7 @@ struct _virDomainCapsCPU { bool maximum; virDomainCapsEnum maximumMigratable; virCPUDef *hostModel; + virCPUDef *hostRecommended; virDomainCapsCPUModels *custom; }; =20 diff --git a/src/conf/schemas/domaincaps.rng b/src/conf/schemas/domaincaps.= rng index 99ef148d44..91657555dd 100644 --- a/src/conf/schemas/domaincaps.rng +++ b/src/conf/schemas/domaincaps.rng @@ -93,6 +93,9 @@ + + + @@ -142,6 +145,27 @@ =20 + + + + host-recommended + + + + + + + + + + + + + + + + + diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index d7096a08c2..6ac8aaf248 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -6250,6 +6250,14 @@ virQEMUCapsFillDomainCPUCaps(virQEMUCaps *qemuCaps, domCaps->cpu.custom =3D NULL; } } + + if (virQEMUCapsIsCPUModeSupported(qemuCaps, hostarch, domCaps->virttyp= e, + VIR_CPU_MODE_HOST_RECOMMENDED, + domCaps->machine)) { + virCPUDef *cpu =3D virQEMUCapsGetHostModel(qemuCaps, domCaps->virt= type, + VIR_QEMU_CAPS_HOST_CPU_RE= COMMENDED); + domCaps->cpu.hostRecommended =3D virCPUDefCopy(cpu); + } } =20 =20 diff --git a/tests/domaincapsdata/qemu_8.1.0.s390x.xml b/tests/domaincapsda= ta/qemu_8.1.0.s390x.xml index 37c7c3b8bf..68a456645c 100644 --- a/tests/domaincapsdata/qemu_8.1.0.s390x.xml +++ b/tests/domaincapsdata/qemu_8.1.0.s390x.xml @@ -90,6 +90,61 @@ + + gen16a-base + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gen16a-base gen16a --=20 2.41.0 From nobody Sun May 12 13:49:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1694466581; cv=none; d=zohomail.com; s=zohoarc; b=aFVonKK9J8NeC4KKxDsSliXfybI+Yv5rcr/kUM8EIrhuSsBGNxs9HA3tfWinVRnVFktsmobWgd4NcxjY9qYmE53Jo8ZHie3gWGmJ236/QJCuEopDL0JgdUCFbjr9MWU60dPJ1dYHb2klJnhesXeBA0fpAmy9b3/HdghHCaR2GJ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694466581; 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; bh=Qlol5rDKgoofkYOQ5N1b1UJNlXu4MkB3CYqoquYqgrQ=; b=GODAzOmD9KT3dSWF1eRntBcva/dd6KW3wXfNDiAOYRFnm0+XNgbU3Draegyp+zUWkJOqlv9s6J9qR4PKMCqZW+PU4lNipZTLRaGW95XzAOpJVV9i1K7b9IkH+eo0sdmzfSbUp4QbKgQ1HmDgYqrqd3Iu5AKPvihzz7/XMfgWrqw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=reject dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 169446658169696.6080268844928; Mon, 11 Sep 2023 14:09:41 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-475-_Vk4cawjMWq5myLLZa2Fxg-1; Mon, 11 Sep 2023 17:09:29 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 744C1816536; Mon, 11 Sep 2023 21:09:25 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C02240C6EC0; Mon, 11 Sep 2023 21:09:25 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3ED8319465A8; Mon, 11 Sep 2023 21:09:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3B37B1946A47 for ; Mon, 11 Sep 2023 21:09:24 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2B1A744029; Mon, 11 Sep 2023 21:09:24 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2360444069 for ; Mon, 11 Sep 2023 21:09:24 +0000 (UTC) Received: from us-smtp-inbound-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E4A068A4378 for ; Mon, 11 Sep 2023 21:09:23 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-441-A-Y8NbdsM0i82cC1mCjH3Q-1; Mon, 11 Sep 2023 17:09:19 -0400 Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38BKuauN011916 for ; Mon, 11 Sep 2023 21:09:18 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t2acfrkfg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Sep 2023 21:09:17 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38BKex37002352 for ; Mon, 11 Sep 2023 21:09:17 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([172.16.1.68]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3t158jwcp6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Sep 2023 21:09:17 +0000 Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38BL9FGO35652066 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Sep 2023 21:09:16 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AE93C5805A; Mon, 11 Sep 2023 21:09:15 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6DC025805E; Mon, 11 Sep 2023 21:09:15 +0000 (GMT) Received: from li-d664314c-3171-11b2-a85c-fa8047ef35bd.ibm.com.com (unknown [9.67.49.93]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 11 Sep 2023 21:09:15 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694466580; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Qlol5rDKgoofkYOQ5N1b1UJNlXu4MkB3CYqoquYqgrQ=; b=A3TH3p/U8GMB1NerJnAWJCtYoMK3NOl8iCbWvxC9TLLR7W9p4e/dNnMifYpRPgq06FPYPF 9NeaOMlDB+Wzw0sVaMGqIpYE8MuQJpiB9r8EsSg1//bvg4SzOX4RV7qK6+0f7iHTJq5dek LNgjWQSUai/VbYvWLrp+bfIyCmHiBas= X-MC-Unique: _Vk4cawjMWq5myLLZa2Fxg-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: A-Y8NbdsM0i82cC1mCjH3Q-1 From: Collin Walling To: libvir-list@redhat.com Subject: [PATCH v1 7/9] qemu: process: allow guest to use host-recommended CPU model Date: Mon, 11 Sep 2023 17:07:14 -0400 Message-ID: <20230911210716.75648-8-walling@linux.ibm.com> In-Reply-To: <20230911210716.75648-1-walling@linux.ibm.com> References: <20230911210716.75648-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: K8T5ocht5zInuscql9hd149PhFBvU6P_ X-Proofpoint-GUID: K8T5ocht5zInuscql9hd149PhFBvU6P_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-11_16,2023-09-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 phishscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 priorityscore=1501 spamscore=0 adultscore=0 bulkscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309110194 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Fiuczynski Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linux.ibm.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1694466583576100001 Content-Type: text/plain; charset="utf-8"; x-default="true" A guest may enable the host-recommended CPU model via the following domain XML: Once the guest is running, the deprecated features will nest under the tag paired with the "disable" policy, e.g.: gen16a-base ... Though existing guests must restart for the CPU model to update with these changes, this at least removes a requirement of the user to manually stay up-to-date on which features are recommended to be disabled as future hardware updates come into play -- so long as the hypervisor maintains the most up-to-date CPU model definitions. Signed-off-by: Collin Walling Reviewed-by: Boris Fiuczynski --- src/cpu/cpu.c | 1 + src/qemu/qemu_command.c | 4 +++ src/qemu/qemu_process.c | 9 ++++-- src/qemu/qemu_validate.c | 7 ++++ ...c-cpu-kvm-ccw-virtio-8.1.s390x-latest.args | 32 +++++++++++++++++++ .../s390-host-rec-cpu-kvm-ccw-virtio-8.1.xml | 17 ++++++++++ tests/qemuxml2argvtest.c | 2 ++ ...ec-cpu-kvm-ccw-virtio-8.1.s390x-latest.xml | 25 +++++++++++++++ tests/qemuxml2xmltest.c | 1 + 9 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/s390-host-rec-cpu-kvm-ccw-virtio= -8.1.s390x-latest.args create mode 100644 tests/qemuxml2argvdata/s390-host-rec-cpu-kvm-ccw-virtio= -8.1.xml create mode 100644 tests/qemuxml2xmloutdata/s390-host-rec-cpu-kvm-ccw-virt= io-8.1.s390x-latest.xml diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 805aff1bf5..4ac34a5efb 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -981,6 +981,7 @@ virCPUTranslate(virArch arch, =20 if (cpu->mode =3D=3D VIR_CPU_MODE_HOST_MODEL || cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASSTHROUGH || + cpu->mode =3D=3D VIR_CPU_MODE_HOST_RECOMMENDED || cpu->mode =3D=3D VIR_CPU_MODE_MAXIMUM) return 0; =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a45e2fbb95..ace9deb246 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6294,6 +6294,10 @@ qemuBuildCpuModelArgStr(virQEMUDriver *driver, break; =20 case VIR_CPU_MODE_HOST_RECOMMENDED: + if (ARCH_IS_S390(def->os.arch)) + virBufferAddLit(buf, "host-recommended"); + break; + case VIR_CPU_MODE_LAST: break; } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 7a1cdb0302..4ff8c1c87a 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6303,6 +6303,7 @@ qemuProcessUpdateGuestCPU(virDomainDef *def, if (def->cpu->mode !=3D VIR_CPU_MODE_HOST_PASSTHROUGH && def->cpu->mode !=3D VIR_CPU_MODE_MAXIMUM) { g_autoptr(virDomainCapsCPUModels) cpuModels =3D NULL; + virQEMUCapsHostCPUType cpuType; =20 if (def->cpu->check =3D=3D VIR_CPU_CHECK_PARTIAL && virCPUCompare(hostarch, @@ -6311,9 +6312,13 @@ qemuProcessUpdateGuestCPU(virDomainDef *def, def->cpu, true) < 0) return -1; =20 + if (def->cpu->mode =3D=3D VIR_CPU_MODE_HOST_RECOMMENDED) + cpuType =3D VIR_QEMU_CAPS_HOST_CPU_RECOMMENDED; + else + cpuType =3D VIR_QEMU_CAPS_HOST_CPU_MIGRATABLE; + if (virCPUUpdate(def->os.arch, def->cpu, - virQEMUCapsGetHostModel(qemuCaps, def->virtType, - VIR_QEMU_CAPS_HOST_CPU_MI= GRATABLE)) < 0) + virQEMUCapsGetHostModel(qemuCaps, def->virtType, = cpuType)) < 0) return -1; =20 cpuModels =3D virQEMUCapsGetCPUModels(qemuCaps, def->virtType, NUL= L, NULL); diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 387c2f1fa8..a60445f686 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -373,6 +373,13 @@ qemuValidateDomainDefCpu(virQEMUDriver *driver, break; =20 case VIR_CPU_MODE_HOST_RECOMMENDED: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANS= ION_STATIC_RECOMMENDED)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("host-recommended CPU is not supported by= QEMU binary")); + return -1; + } + break; + case VIR_CPU_MODE_CUSTOM: case VIR_CPU_MODE_LAST: break; diff --git a/tests/qemuxml2argvdata/s390-host-rec-cpu-kvm-ccw-virtio-8.1.s3= 90x-latest.args b/tests/qemuxml2argvdata/s390-host-rec-cpu-kvm-ccw-virtio-8= .1.s390x-latest.args new file mode 100644 index 0000000000..78546380d7 --- /dev/null +++ b/tests/qemuxml2argvdata/s390-host-rec-cpu-kvm-ccw-virtio-8.1.s390x-lat= est.args @@ -0,0 +1,32 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/var/lib/libvirt/qemu/domain--1-test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/var/lib/libvirt/qemu/domain--1-test/.local/share \ +XDG_CACHE_HOME=3D/var/lib/libvirt/qemu/domain--1-test/.cache \ +XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-test/.config \ +/usr/bin/qemu-system-s390x \ +-name guest=3Dtest,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/va= r/lib/libvirt/qemu/domain--1-test/master-key.aes"}' \ +-machine s390-ccw-virtio-8.1,usb=3Doff,dump-guest-core=3Doff,memory-backen= d=3Ds390.ram \ +-accel kvm \ +-cpu gen16a-base,nnpa=3Don,aen=3Don,cmmnt=3Don,vxpdeh=3Don,aefsi=3Don,diag= 318=3Don,csske=3Doff,mepoch=3Don,msa9=3Don,msa8=3Don,msa7=3Don,msa6=3Don,ms= a5=3Don,msa4=3Don,msa3=3Don,msa2=3Don,msa1=3Don,sthyi=3Don,edat=3Don,ri=3Do= n,deflate=3Don,edat2=3Don,etoken=3Don,vx=3Don,ipter=3Don,pai=3Don,paie=3Don= ,mepochptff=3Don,ap=3Don,vxeh=3Don,vxpd=3Don,esop=3Don,msa9_pckmo=3Don,vxeh= 2=3Don,esort=3Don,apqi=3Don,apft=3Don,els=3Don,iep=3Don,apqci=3Don,cte=3Dof= f,ais=3Don,bpb=3Doff,gs=3Don,ppa15=3Don,zpci=3Don,rdp=3Don,sea_esop2=3Don,b= eareh=3Don,te=3Doff,cmm=3Don,vxpdeh2=3Don \ +-m size=3D262144k \ +-object '{"qom-type":"memory-backend-ram","id":"s390.ram","size":268435456= }' \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 9aa4b45c-b9dd-45ef-91fe-862b27b4231f \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-ccw","id":"balloon0","devno":"fe.0.0000= "}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/s390-host-rec-cpu-kvm-ccw-virtio-8.1.xm= l b/tests/qemuxml2argvdata/s390-host-rec-cpu-kvm-ccw-virtio-8.1.xml new file mode 100644 index 0000000000..cacc1933dd --- /dev/null +++ b/tests/qemuxml2argvdata/s390-host-rec-cpu-kvm-ccw-virtio-8.1.xml @@ -0,0 +1,17 @@ + + test + 9aa4b45c-b9dd-45ef-91fe-862b27b4231f + 262144 + 262144 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 2d06e2a0d1..4c3b698b83 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2295,6 +2295,8 @@ mymain(void) DO_TEST_CAPS_ARCH_LATEST("s390-async-teardown-disabled", "s390x"); DO_TEST_CAPS_ARCH_VER("s390-async-teardown-disabled", "s390x", "6.0.0"= ); =20 + DO_TEST_CAPS_ARCH_LATEST("s390-host-rec-cpu-kvm-ccw-virtio-8.1", "s390= x"); + qemuTestDriverFree(&driver); virFileWrapperClearPrefixes(); =20 diff --git a/tests/qemuxml2xmloutdata/s390-host-rec-cpu-kvm-ccw-virtio-8.1.= s390x-latest.xml b/tests/qemuxml2xmloutdata/s390-host-rec-cpu-kvm-ccw-virti= o-8.1.s390x-latest.xml new file mode 100644 index 0000000000..177694afe8 --- /dev/null +++ b/tests/qemuxml2xmloutdata/s390-host-rec-cpu-kvm-ccw-virtio-8.1.s390x-l= atest.xml @@ -0,0 +1,25 @@ + + test + 9aa4b45c-b9dd-45ef-91fe-862b27b4231f + 262144 + 262144 + 1 + + hvm + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + +