From nobody Fri Dec 19 17:37:36 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1679065003; cv=none; d=zohomail.com; s=zohoarc; b=iez6lJ/cmRIIY9IEJ2bUsR8w4cfKvdEYTxIgWvaNxkcgAehBe61kQ338nmy0Ekql2hXPIVpU3DX7crsbxPSEvVxhgtgpmYDvBcUPiquU8FTE8wjd5godPZGyyEWDrPLZIA1vn/brXkHPqlByYF8szikaTfKY+yRgX4fVYylbaH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679065003; h=Content-Type:Content-Transfer-Encoding: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=gQZ9sL2i2io97uDEyWur6Z95bu3ABBWR386W5hckfuo=; b=fJauL3+JiW4tUd/0r4sixgcAd9eGuQbX18skINJr4EoSB52p0RUoVBnrzxEeU/BbFcNUrvhurJe1IE5zDOEXkbo1v3AOsz87wSFCG1eQjPtwkIaBJwCTarTkVzwOyOgK8zQjYZh+WnUz2Z/UaItwJuUYGJSZu9NAKPLouEIWIDg= 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=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.129.124]) by mx.zohomail.com with SMTPS id 1679065002847562.4769503793857; Fri, 17 Mar 2023 07:56:42 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.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-295-Adoi5FWMOt2L_DJj9iyQxg-1; Fri, 17 Mar 2023 10:56:36 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6948C1C189C4; Fri, 17 Mar 2023 14:56:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5326C1410F1B; Fri, 17 Mar 2023 14:56:32 +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 9DA5F1946A6A; Fri, 17 Mar 2023 14:56:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CEA821946587 for ; Thu, 16 Mar 2023 16:12:29 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B279C2166B29; Thu, 16 Mar 2023 16:12:29 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE2372166B26 for ; Thu, 16 Mar 2023 16:12:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679065001; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=gQZ9sL2i2io97uDEyWur6Z95bu3ABBWR386W5hckfuo=; b=guYiZsktjzd82kLtuIGFaKIeSl3F9rrCZpHCU/U6LIV5Ovzeu0vhqgAVl4umk8f7AS/nVd 181HxJhg++Q0MhbZLOw6AbiKcpW6J5xQ6F0zQTT+XO5zjhDPvZsPaB0Ex3zqusTo60nlGF jJgt/qA2wj1HG/7VtqJTbJ/zcGf5HFE= X-MC-Unique: Adoi5FWMOt2L_DJj9iyQxg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 13/24] qemu: capabilities: Fix testing of 'TCG' capabilities probing Date: Thu, 16 Mar 2023 17:11:42 +0100 Message-Id: <95f93fa923c49ec865732ceb81063173c7ad260c.1678982996.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: 1679065004251100007 Content-Type: text/plain; charset="utf-8" The logic in 'virQEMUCapsInitQMP' invokes a second probe of qemu in case when acceleration is used and TCG is supported to specifically probe the CPU and features of non-accelerated guests. The same logic must then be used in 'qemucapabilitiestest' when replaying the data for testing otherwise the test would fail. Export 'virQEMUCapsHaveAccel' for test usage and use the same logic in 'testQemuCaps'. Fix the comment in 'virQEMUCapsInitQMP' to outline what's happening. Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 6 +++--- src/qemu/qemu_capspriv.h | 3 +++ tests/qemucapabilitiestest.c | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 22b0d2ca86..9a310a0f2d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -883,7 +883,7 @@ virQEMUCapsTypeIsAccelerated(virDomainVirtType type) } -static bool +bool virQEMUCapsHaveAccel(virQEMUCaps *qemuCaps) { return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) || @@ -5751,8 +5751,8 @@ virQEMUCapsInitQMP(virQEMUCaps *qemuCaps, return -1; /* - * If KVM was enabled during the first probe, we need to explicitly pr= obe - * for TCG capabilities by asking the same binary again and turning KVM + * If acceleration was enabled during the first probe, we need to expl= icitly + * probe for TCG capabilities by asking the same binary again and turn= ing KVM * off. */ if (virQEMUCapsHaveAccel(qemuCaps) && diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h index 60fdf02f06..be83b13ab5 100644 --- a/src/qemu/qemu_capspriv.h +++ b/src/qemu/qemu_capspriv.h @@ -116,3 +116,6 @@ virQEMUCapsAddMachine(virQEMUCaps *qemuCaps, const char *defaultRAMid, bool deprecated, virTristateBool acpi); + +bool +virQEMUCapsHaveAccel(virQEMUCaps *qemuCaps); diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c index 081f14a6c3..7575f9fd44 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -101,7 +101,8 @@ testQemuCaps(const void *opaque) if (virQEMUCapsInitQMPMonitor(capsActual, qemuMonitorTestGetMonitor(mo= n)) < 0) return -1; - if (virQEMUCapsGet(capsActual, QEMU_CAPS_KVM)) { + if (virQEMUCapsHaveAccel(capsActual) && + virQEMUCapsGet(capsActual, QEMU_CAPS_TCG)) { qemuMonitorResetCommandID(qemuMonitorTestGetMonitor(mon)); if (qemuProcessQMPInitMonitor(qemuMonitorTestGetMonitor(mon)) < 0) --=20 2.39.2