From nobody Tue Feb 10 12:57:53 2026 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1641548991; cv=none; d=zohomail.com; s=zohoarc; b=W7Csv4qaFKefmk5UoLzU89d23Jw1CkR92fPw9sw4LsWrR6UD7fmgj1MTBqblK7Npv8d4OKFSvE3CJckQ/NwQAJvU8zhT+EYOzI+6KC33g5UKGfPOfHYa/Friw7HQCpJ4EbqwmRD3neWksbDd6o9DiQIoO8Uj7NBfzrL3W8qAPDA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641548991; 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=PZ1BTCT9qSGtk8a/l2ksx/cQ6q2dcyzwaCQFHF+ZasM=; b=gpp1nA8UZ0ZYMOquWMjU0vS1TGHna1/HaUPhZtXxsRXON1QAgDV5b5kB/eIoNjNY9sD4LXYaKg0bkmuq1Cw+iRWckQOqOQdf3yhik0Jj3OhXIKyKeW19gT4yaJS1R6XzAKrSkM1nM2rz7nfAVOX6tWxCOWFs3anm5uXLL4lVZO4= 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=pass header.from= (p=none 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 1641548991745414.2648817779823; Fri, 7 Jan 2022 01:49:51 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-588--GSF-AxhPA-82KvDI9D4xw-1; Fri, 07 Jan 2022 04:49:43 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1958E345C1; Fri, 7 Jan 2022 09:49:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F038770D53; Fri, 7 Jan 2022 09:49:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C30C84A700; Fri, 7 Jan 2022 09:49:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 2079nb9e009950 for ; Fri, 7 Jan 2022 04:49:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6CBDF60C47; Fri, 7 Jan 2022 09:49:37 +0000 (UTC) Received: from kinshicho.usersys.redhat.com (unknown [10.40.192.224]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 841D567C99; Fri, 7 Jan 2022 09:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641548986; 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=PZ1BTCT9qSGtk8a/l2ksx/cQ6q2dcyzwaCQFHF+ZasM=; b=iG77WNJh4UVOSdqhdv+DVlGNirJW9sPcWq2OMIhhvnvhqy+pQr6xJKqNr1pNh8MjzcRkA9 rFnQrdWPWIR1nzHeBmMUUcxcBggOVK07LfR4kBKFznjvmQhVUaLji3GJBxUcZ8DnUTSQ+E I+HYoRBBL69I2s/pwbFYs36Ra0OxfbE= X-MC-Unique: -GSF-AxhPA-82KvDI9D4xw-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v4 07/19] qemu: Introduce virQEMUCapsAccelStr Date: Fri, 7 Jan 2022 10:47:34 +0100 Message-Id: <20220107094746.1042621-8-abologna@redhat.com> In-Reply-To: <20220107094746.1042621-1-abologna@redhat.com> References: <20220107094746.1042621-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: r.bolshakov@yadro.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1641548992534100001 Content-Type: text/plain; charset="utf-8" From: Roman Bolshakov This makes possible to add more accelerators by touching less code and reduces code duplication. Signed-off-by: Roman Bolshakov Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 081c43e728..c246e1b6ce 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -792,6 +792,16 @@ const char *virQEMUCapsArchToString(virArch arch) } =20 =20 +static const char * +virQEMUCapsAccelStr(virDomainVirtType type) +{ + if (type =3D=3D VIR_DOMAIN_VIRT_QEMU) + return "tcg"; + + return virDomainVirtTypeToString(type); +} + + /* Checks whether a domain with @guest arch can run natively on @host. */ bool @@ -4069,7 +4079,7 @@ virQEMUCapsLoadAccel(virQEMUCaps *qemuCaps, virDomainVirtType type) { virQEMUCapsAccel *caps =3D virQEMUCapsGetAccel(qemuCaps, type); - const char *typeStr =3D type =3D=3D VIR_DOMAIN_VIRT_KVM ? "kvm" : "tcg= "; + const char *typeStr =3D virQEMUCapsAccelStr(type); =20 if (virQEMUCapsLoadHostCPUModelInfo(caps, ctxt, typeStr) < 0) return -1; @@ -4622,7 +4632,7 @@ virQEMUCapsFormatAccel(virQEMUCaps *qemuCaps, virDomainVirtType type) { virQEMUCapsAccel *caps =3D virQEMUCapsGetAccel(qemuCaps, type); - const char *typeStr =3D type =3D=3D VIR_DOMAIN_VIRT_KVM ? "kvm" : "tcg= "; + const char *typeStr =3D virQEMUCapsAccelStr(type); =20 virQEMUCapsFormatHostCPUModelInfo(caps, buf, typeStr); virQEMUCapsFormatCPUModels(caps, buf, typeStr); --=20 2.31.1