From nobody Tue May 13 14:11:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=yadro.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1540046378913790.5972811045837; Sat, 20 Oct 2018 07:39:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0CE7F19CB84; Sat, 20 Oct 2018 14:39:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D1F2861533; Sat, 20 Oct 2018 14:39:36 +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 820F6180B61F; Sat, 20 Oct 2018 14:39:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9KEKulo012274 for ; Sat, 20 Oct 2018 10:20:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id F3AA970460; Sat, 20 Oct 2018 14:20:55 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EC7DA6E6E2 for ; Sat, 20 Oct 2018 14:20:53 +0000 (UTC) Received: from mta-01.yadro.com (mta-01.yadro.com [89.207.88.251]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B102B308424C for ; Sat, 20 Oct 2018 14:20:52 +0000 (UTC) Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 1E2F741908 for ; Sat, 20 Oct 2018 14:20:51 +0000 (UTC) Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9HtD7CfMFZtA for ; Sat, 20 Oct 2018 17:20:50 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 51F0941206 for ; Sat, 20 Oct 2018 17:20:50 +0300 (MSK) Received: from localhost (172.17.128.60) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Sat, 20 Oct 2018 17:20:49 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received:received; s=mta-01; t=1540045250; x= 1541859651; bh=lgBRIiRziDv8xUnKZWTlt/nZaEW65F+O6ET4mbGspgc=; b=t PD2dX0cjrrCcvSSScWNFTVv+CZPU5ghs7doqQwGrHyZy3/6OdE0GSM21jWHFPCvk +dsDC2qozqaWHy7vwEqZQrG4dBi5vrQ5Rj5mZVTITqn4Oq9562i1tOgsjyMSKdkc Z3z8WV+CYbMDwAHvKU8PwUBBKwULJ7k7nOzN5SI+fU= X-Virus-Scanned: amavisd-new at yadro.com From: Roman Bolshakov To: Date: Sat, 20 Oct 2018 17:19:52 +0300 Message-ID: <20181020141958.59397-8-r.bolshakov@yadro.com> In-Reply-To: <20181020141958.59397-1-r.bolshakov@yadro.com> References: <20181020141958.59397-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.128.60] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Sat, 20 Oct 2018 14:20:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Sat, 20 Oct 2018 14:20:52 +0000 (UTC) for IP:'89.207.88.251' DOMAIN:'mta-01.yadro.com' HELO:'mta-01.yadro.com' FROM:'r.bolshakov@yadro.com' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE, SPF_PASS) 89.207.88.251 mta-01.yadro.com 89.207.88.251 mta-01.yadro.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Roman Bolshakov Subject: [libvirt] [PATCH 07/13] qemu: Introduce virQEMUCapsHaveAccel 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sat, 20 Oct 2018 14:39:37 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The function should be used to check if qemu capabilities include a hardware acceleration, i.e. QEMU accel is not TCG. Signed-off-by: Roman Bolshakov --- src/qemu/qemu_capabilities.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index eb3148038a..648e5bd585 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -636,6 +636,12 @@ virQEMUCapsTypeIsAccelerated(virDomainVirtType type) return type =3D=3D VIR_DOMAIN_VIRT_KVM; } =20 +static bool +virQEMUCapsHaveAccel(virQEMUCapsPtr qemuCaps) +{ + return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM); +} + /* Checks whether a domain with @guest arch can run natively on @host. */ bool @@ -2365,7 +2371,7 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemu= Caps, if (!(models =3D virQEMUCapsFetchCPUDefinitions(mon))) return -1; =20 - if (tcg || !virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) + if (tcg || !virQEMUCapsHaveAccel(qemuCaps)) qemuCaps->tcgCPUModels =3D models; else qemuCaps->accelCPUModels =3D models; @@ -2391,7 +2397,7 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps, if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION)) return 0; =20 - if (tcg || !virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) { + if (tcg || !virQEMUCapsHaveAccel(qemuCaps)) { virtType =3D VIR_DOMAIN_VIRT_QEMU; model =3D "max"; } else { @@ -4495,7 +4501,7 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps, if (virQEMUCapsInitQMPMonitor(qemuCaps, cmd->mon) < 0) goto cleanup; =20 - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) { + if (virQEMUCapsHaveAccel(qemuCaps)) { virQEMUCapsInitQMPCommandAbort(cmd); if ((rc =3D virQEMUCapsInitQMPCommandRun(cmd, true)) !=3D 0) { if (rc =3D=3D 1) --=20 2.17.1 (Apple Git-112) -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list