From nobody Mon Feb 9 12:25:13 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=1641892274; cv=none; d=zohomail.com; s=zohoarc; b=UhNr/AqnU4zKj/Sg0ttdh8V2SRf4pydtBtTlLvsevkXbvtSeH0gWcvaZQBcFPENGdkNY5NQn681ceNCQ90lbxjQCp2XbarFBzsrDfAyeElyHEtAWkcEtgzDEI/Xwc4EoF4ahm6OQxZft2Xfd2YsGh5KtCWOvdshotQon3s4ikF8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641892274; 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=vHqnE6ALQh63cVgLkR/MNoqnUGlNiKum+e9nf3hmGPU=; b=HW6zZYtkVbcb1x9cNxdB82xBjIQhOqIbkMmUgsw6VesohgnQ8DaKNwEgJCc2ZMlJB50ctAwhycjONhDuY49XXWQ4Vqd0+6kZwZo+/240ogPilf+hvmlzzHqo2QM7TBgxbE4AtnuGzRZgro4Xe5yvZlTGtfcnJoM44Qb47aiz6bg= 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 16418922748131004.8455481979964; Tue, 11 Jan 2022 01:11:14 -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-348-af-wN723NeyUKH66Z3LVvA-1; Tue, 11 Jan 2022 04:10:13 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A6EEE100F94D; Tue, 11 Jan 2022 09:10:03 +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 655EB7AB5E; Tue, 11 Jan 2022 09:10:03 +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 1AB781809CB9; Tue, 11 Jan 2022 09:10:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20B9A0ql029452 for ; Tue, 11 Jan 2022 04:10:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 031D16F126; Tue, 11 Jan 2022 09:10:00 +0000 (UTC) Received: from kinshicho.usersys.redhat.com (unknown [10.40.195.37]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 05D1B6F116; Tue, 11 Jan 2022 09:09:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641892273; 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=vHqnE6ALQh63cVgLkR/MNoqnUGlNiKum+e9nf3hmGPU=; b=TLVIf6zphHIMN2e+F+WlEGgq1Hu8YynEacF2iJ/4xo7beDV/c4/7jcyUpL3PfQzMaX8tMF j7FVRaGP2kjm0eswOMf25oNuRl/xFW+OCNOYBlzmYVdBZvi3/Jtt5KjttER+8njhzrQuRZ ZMynK6q5okDWDAgU161xhGFsHlRkqj8= X-MC-Unique: af-wN723NeyUKH66Z3LVvA-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v5 10/20] qemu: Introduce virQEMUCapsHaveAccel Date: Tue, 11 Jan 2022 10:09:30 +0100 Message-Id: <20220111090940.1315732-11-abologna@redhat.com> In-Reply-To: <20220111090940.1315732-1-abologna@redhat.com> References: <20220111090940.1315732-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1641892275521100001 From: Roman Bolshakov The function should be used to check if qemu capabilities include a hardware acceleration, i.e. accel is not TCG. Signed-off-by: Roman Bolshakov Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_capabilities.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index eaf2905f4b..ee4955056d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -809,6 +809,13 @@ virQEMUCapsTypeIsAccelerated(virDomainVirtType type) } =20 =20 +static bool +virQEMUCapsHaveAccel(virQEMUCaps *qemuCaps) +{ + return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM); +} + + /* Checks whether a domain with @guest arch can run natively on @host. */ bool @@ -5029,7 +5036,7 @@ virQEMUCapsIsValid(void *data, return false; } =20 - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) { + if (virQEMUCapsHaveAccel(qemuCaps)) { if (STRNEQ_NULLABLE(priv->hostCPUSignature, qemuCaps->hostCPUSigna= ture)) { VIR_DEBUG("Outdated capabilities for '%s': host CPU changed " "('%s' vs '%s')", @@ -5063,7 +5070,9 @@ virQEMUCapsIsValid(void *data, qemuCaps->binary); return false; } + } =20 + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) { kvmSupportsNesting =3D virQEMUCapsKVMSupportsNesting(); if (kvmSupportsNesting !=3D qemuCaps->kvmSupportsNesting) { VIR_DEBUG("Outdated capabilities for '%s': kvm kernel nested " @@ -5528,7 +5537,7 @@ virQEMUCapsInitQMP(virQEMUCaps *qemuCaps, * for TCG capabilities by asking the same binary again and turning KVM * off. */ - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) && + if (virQEMUCapsHaveAccel(qemuCaps) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_TCG) && virQEMUCapsInitQMPSingle(qemuCaps, libDir, runUid, runGid, true) <= 0) return -1; @@ -5592,13 +5601,15 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch, virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KV= M); virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_QEMU); =20 - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) { + if (virQEMUCapsHaveAccel(qemuCaps)) { qemuCaps->hostCPUSignature =3D g_strdup(hostCPUSignature); qemuCaps->microcodeVersion =3D microcodeVersion; qemuCaps->cpuData =3D virCPUDataNewCopy(cpuData); =20 qemuCaps->kernelVersion =3D g_strdup(kernelVersion); + } =20 + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) { qemuCaps->kvmSupportsNesting =3D virQEMUCapsKVMSupportsNesting(); =20 qemuCaps->kvmSupportsSecureGuest =3D virQEMUCapsKVMSupportsSecureG= uest(); --=20 2.31.1