From nobody Tue Mar 11 11:23:12 2025 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