From nobody Sun Apr 28 20:44:41 2024 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=1642416813; cv=none; d=zohomail.com; s=zohoarc; b=CpEZAQEb05dQhf4N7bLQwKjT92PJfciSWD3Fk7wHNqYarHPWBqv0olLSH4y/WL4Tq9cj04jn8pJk9jriv2j52M5jaXgjWFmmzvGRcJsimE7IkDn3U0dBk+Mfo9OdoTVvvrqIF5ZE2YwKzHUjaJVkH+1FdpyOODbE/+HdVYaIpV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642416813; 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=yCzG/PzTbHW0F4kx85remGtW6XCIVZn1gZcmNd/k6qQ=; b=IWYfZSp6SfW1++2596Mjsy318umHnTOXyiBT0igl6+O0GqfnI2q9ojpKMxP8eLzfT0g4U4h7zAsmAemv+K65eaxjL8y2AWDLnsgkvL0vU+BYUG33VlUMeYrOxIdBZAlY2BAPtlst17RcrnUkYMQGJBGAiZYiAB2/L2MReBXuBgI= 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 1642416813505189.59088663863668; Mon, 17 Jan 2022 02:53:33 -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-166-vlsDPJZyPQGeTGJjsJXZiA-1; Mon, 17 Jan 2022 05:53:31 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 984F76408E; Mon, 17 Jan 2022 10:53:25 +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 CB7B57316C; Mon, 17 Jan 2022 10:53:23 +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 E73294CA93; Mon, 17 Jan 2022 10:53:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HAr4j0008977 for ; Mon, 17 Jan 2022 05:53:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id DF40E1059596; Mon, 17 Jan 2022 10:53:04 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1BB7D1059A79; Mon, 17 Jan 2022 10:53:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642416812; 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=yCzG/PzTbHW0F4kx85remGtW6XCIVZn1gZcmNd/k6qQ=; b=UlSdYidM5uohSDaHbecv2uDuGYGEtYS2nuf0oxBBXZx3jz58046w8mwzPYn+TCP6wdkYaJ YUy8+zEQ4RTcqrFuWTSwRENouHE3ZTQSGzJF6xoiLY8Hk8GaIyvq0DKsWG5Z9u79Eb7N4q wqf7XbyDih5fdGR3BypGEoIbd3XnxoU= X-MC-Unique: vlsDPJZyPQGeTGJjsJXZiA-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 01/20] qemu: Only probe KVM on Linux Date: Mon, 17 Jan 2022 11:52:41 +0100 Message-Id: <20220117105300.15759-2-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.13 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: 1642416815919100001 We already know it's not going to be available on other platforms. Suggested-by: Daniel P. Berrang=C3=A9 Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Reviewed-by: Ani Sinha Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Christophe Fergeau --- src/qemu/qemu_process.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 5c9ca0fe4f..c2c10d282a 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -9269,6 +9269,12 @@ qemuProcessQMPInit(qemuProcessQMP *proc) } =20 =20 +#if defined(__linux__) +# define hwaccel "kvm:tcg" +#else +# define hwaccel "tcg" +#endif + static int qemuProcessQMPLaunch(qemuProcessQMP *proc) { @@ -9279,7 +9285,7 @@ qemuProcessQMPLaunch(qemuProcessQMP *proc) if (proc->forceTCG) machine =3D "none,accel=3Dtcg"; else - machine =3D "none,accel=3Dkvm:tcg"; + machine =3D "none,accel=3D" hwaccel; =20 VIR_DEBUG("Try to probe capabilities of '%s' via QMP, machine %s", proc->binary, machine); --=20 2.34.1 From nobody Sun Apr 28 20:44:41 2024 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=1642416967; cv=none; d=zohomail.com; s=zohoarc; b=QzVoS728IvHnVmMd7vg/zqiOqYuSy1sDeU7+euN9tr3xXOnuPdPQ+hD0YSP0N7iK+JwRC92DXN37pKk1pxfKTPVotEiZyYoniGp3b/o8iGkEDAi6wl7U69BrAqkL4CWkCGqhOQfXEZGIwAPB4axfvfLqYkpI8gXmpU53S24p3aM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642416967; 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=essw77yRzm73IC4/bK5hNwdr+NdzWbNCDIp++BXTUJI=; b=Ma3C7e0agw59p1vAua6yR5H1qHZUvkMOsrF70RZDmts6NbfsjrLHjy2dEZ/3JyxsS1vGli9r/YSkWuJr4hTZvQHoNM4Y6n2efz5uU5oSSDjbcVkSUyPL6ae37KsCZT/bGirTR+Ira8yxmAqhvfPJdZouMvoi8tl2NNs0YZnGizY= 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 16424169672411005.4557339586195; Mon, 17 Jan 2022 02:56:07 -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-246-vttNQ62uM9SiGOEYjMC-Dg-1; Mon, 17 Jan 2022 05:56:02 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB4AE1083F67; Mon, 17 Jan 2022 10:55:57 +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 CC8CB1059596; Mon, 17 Jan 2022 10:55:57 +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 9C7D31802FEA; Mon, 17 Jan 2022 10:55:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HAr6Xw008984 for ; Mon, 17 Jan 2022 05:53:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1CBDC1059596; Mon, 17 Jan 2022 10:53:06 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B22E1059A7C; Mon, 17 Jan 2022 10:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642416966; 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=essw77yRzm73IC4/bK5hNwdr+NdzWbNCDIp++BXTUJI=; b=SFiq3/DO4Z6iQrsxpF7nw5PgSt6D2s7uVmmPXdiUx6bYfyoKLdwfjd5ZFUjkqdtsDKc4Go DCOnZb4EH49xh4Zr0pM/hjzaQT+5X6/M9vQKAH7+pM4wyAKGgPL+wPqtMly7XMLdA31sBf O9UP7iTfq8pzE2tWIpCY04JggkyGTL0= X-MC-Unique: vttNQ62uM9SiGOEYjMC-Dg-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 02/20] qemu: Add KVM CPUs into cache only if KVM is present Date: Mon, 17 Jan 2022 11:52:42 +0100 Message-Id: <20220117105300.15759-3-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.84 on 10.5.11.22 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: 1642416969002100001 Content-Type: text/plain; charset="utf-8" From: Roman Bolshakov virQEMUCapsFormatCache/virQEMUCapsLoadCache adds/reads KVM CPUs to/from capabilities cache regardless of QEMU_CAPS_KVM. That can cause undesired side-effects when KVM CPUs are present in the cache on a platform that doesn't support it, e.g. macOS or Linux without KVM support. Signed-off-by: Roman Bolshakov Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Christophe Fergeau --- src/qemu/qemu_capabilities.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index a71d3b912f..c2d56dfc9d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4423,8 +4423,11 @@ virQEMUCapsLoadCache(virArch hostArch, return -1; } =20 - if (virQEMUCapsLoadAccel(qemuCaps, ctxt, VIR_DOMAIN_VIRT_KVM) < 0 || - virQEMUCapsLoadAccel(qemuCaps, ctxt, VIR_DOMAIN_VIRT_QEMU) < 0) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) && + virQEMUCapsLoadAccel(qemuCaps, ctxt, VIR_DOMAIN_VIRT_KVM) < 0) { + return -1; + } + if (virQEMUCapsLoadAccel(qemuCaps, ctxt, VIR_DOMAIN_VIRT_QEMU) < 0) return -1; =20 if (virQEMUCapsParseGIC(qemuCaps, ctxt) < 0) @@ -4433,7 +4436,8 @@ virQEMUCapsLoadCache(virArch hostArch, if (virQEMUCapsParseSEVInfo(qemuCaps, ctxt) < 0) return -1; =20 - virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KVM); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) + virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KV= M); virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_QEMU); =20 if (virXPathBoolean("boolean(./kvmSupportsNesting)", ctxt) > 0) @@ -4666,7 +4670,8 @@ virQEMUCapsFormatCache(virQEMUCaps *qemuCaps) virBufferAsprintf(&buf, "%s\n", virArchToString(qemuCaps->arch)); =20 - virQEMUCapsFormatAccel(qemuCaps, &buf, VIR_DOMAIN_VIRT_KVM); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) + virQEMUCapsFormatAccel(qemuCaps, &buf, VIR_DOMAIN_VIRT_KVM); virQEMUCapsFormatAccel(qemuCaps, &buf, VIR_DOMAIN_VIRT_QEMU); =20 for (i =3D 0; i < qemuCaps->ngicCapabilities; i++) { @@ -5520,7 +5525,8 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch, qemuCaps->libvirtCtime =3D virGetSelfLastChanged(); qemuCaps->libvirtVersion =3D LIBVIR_VERSION_NUMBER; =20 - virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KVM); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) + virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KV= M); virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_QEMU); =20 if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) { --=20 2.34.1 From nobody Sun Apr 28 20:44:41 2024 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=1642416971; cv=none; d=zohomail.com; s=zohoarc; b=ay6n33XUy0tETKd14WLUq6C7tkeBfdf5CNmi2cwMz1APvlabOghpP8SqBUsv8LV+PcF/q+oZBGGboGDsdOoUKdFgrFi2P76Di5Ath4L8YhRu4K6V1sO5r17JQEKbZXzYZmxGl4+tGi6UvnOIcr39RFJCP6hVRS+wLYf3fz1TlWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642416971; 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=aKpFibKRwzVcMs0I7oHUGxYziyZxiydJzp/M5wuJ/68=; b=FfO3XidZIPIOmK/YEKjCNtZd4aItCKHi9fi713M4/sQ5GZo8IrKoOM0VEGEOUhaslzRHAKVAbIPPfv96fD24iaio9e94MpajmTHAF4ftfeuJ3TXXoGF7iKfTfJBUIHkalRRAvpDB+S7hlpy/Me0h7IQmjGP82uU+r1bmTEERhoA= 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 1642416971201531.7174439433496; Mon, 17 Jan 2022 02:56:11 -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-549-zXJReV3WOLmyyHi89fRv_Q-1; Mon, 17 Jan 2022 05:56:06 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 02F2E6D4E4; Mon, 17 Jan 2022 10:56:01 +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 D236D4D717; Mon, 17 Jan 2022 10:56:00 +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 9E90A1802E2B; Mon, 17 Jan 2022 10:56:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HAr795008994 for ; Mon, 17 Jan 2022 05:53:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4C3A71059A7A; Mon, 17 Jan 2022 10:53:07 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7DA3F1059596; Mon, 17 Jan 2022 10:53:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642416970; 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=aKpFibKRwzVcMs0I7oHUGxYziyZxiydJzp/M5wuJ/68=; b=Uv79MxviZhHWRgJx3FsY+c2XXz+S5YihhyGChpW9xk7OicG3wwKgQnk59XI5gzRNnRQ8Qk JvWAM1NrjIj592v47ohjRYqrJ2nA8W0AMdWZe4/IUUL0uVa14242CJOikzzivFzEoX5Spj usCn6TPsR2/vqPIWttyGh2hBfmpKcvM= X-MC-Unique: zXJReV3WOLmyyHi89fRv_Q-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 03/20] conf: Add hvf domain type Date: Mon, 17 Jan 2022 11:52:43 +0100 Message-Id: <20220117105300.15759-4-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.13 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: 1642416973340100001 From: Roman Bolshakov QEMU supports Hypervisor.framework since 2.12 as hvf accel. Hypervisor.framework provides a lightweight interface to run a virtual cpu on macOS without the need to install third-party kernel extensions (KEXTs). It's supported since macOS 10.10 on machines with Intel VT-x feature set that includes Extended Page Tables (EPT) and Unrestricted Mode. Signed-off-by: Roman Bolshakov Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Christophe Fergeau --- docs/formatdomain.rst | 3 ++- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 1 + src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 4 ++++ 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index c0b2d935f3..7bb7107ea3 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -20,7 +20,8 @@ Element and attribute overview =20 The root element required for all virtual machines is named ``domain``. It= has two attributes, the ``type`` specifies the hypervisor used for running the -domain. The allowed values are driver specific, but include "xen", "kvm", = "qemu" +domain. The allowed values are driver specific, but include "xen", "kvm", +"hvf" (:since:`since 8.0.0 and QEMU 2.12`), "qemu" and "lxc". The second attribute is ``id`` which is a unique integer identi= fier for the running guest machine. Inactive machines have no id value. =20 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 169b8d8dee..64a797de46 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -230,6 +230,7 @@ phyp vz bhyve + hvf diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a805f7f6a3..cbeb69d77d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -125,6 +125,7 @@ VIR_ENUM_IMPL(virDomainVirt, "parallels", "bhyve", "vz", + "hvf", ); =20 VIR_ENUM_IMPL(virDomainOS, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e2f35fe20b..011826da64 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -139,6 +139,7 @@ typedef enum { VIR_DOMAIN_VIRT_PARALLELS, VIR_DOMAIN_VIRT_BHYVE, VIR_DOMAIN_VIRT_VZ, + VIR_DOMAIN_VIRT_HVF, =20 VIR_DOMAIN_VIRT_LAST } virDomainVirtType; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ed9dda4feb..1548bdcd8e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7229,6 +7229,10 @@ qemuBuildAccelCommandLine(virCommand *cmd, } break; =20 + case VIR_DOMAIN_VIRT_HVF: + virBufferAddLit(&buf, "hvf"); + break; + case VIR_DOMAIN_VIRT_KQEMU: case VIR_DOMAIN_VIRT_XEN: case VIR_DOMAIN_VIRT_LXC: --=20 2.34.1 From nobody Sun Apr 28 20:44:41 2024 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=1642416826; cv=none; d=zohomail.com; s=zohoarc; b=F0Zrvvdnzwy6VLFC39zdlU+rK0PDazS1S8OrwrMbixSJWchHXGVdJzZywBs/X2Np6XbablKfXDZdRJog8dp1R6xxQxu0MIVKnLhiiFieE6ukV8eF7WM2GD3OTzAcClBFNMnWLKYL67fWX28AQD/nszAl13BT7I2SyplIpsPH+sY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642416826; 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=2MOIksdPmhexRV/RB/UJRb1kuB9bSPlptaGqI4Bk+A8=; b=XiMp3vcf5ehRwFLUBrW2jGz9si2dcRiRUmCwhBX1j/BDw/y0WkiwrDVJc2SiHkAmpAL4RbI0Zip++1uxczskyBCQp2Vepg/+hpSB09/BAlbJ5BS3gKeQ3YtmOgoInjJojAfLzQf+bT41IvgREjIbvkiEO7uvqoCYwcwnASMs+nw= 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 1642416826183204.22262412070324; Mon, 17 Jan 2022 02:53:46 -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-59-CZHVkFnAPdeu5UjAZZSAxQ-1; Mon, 17 Jan 2022 05:53:41 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A8055801B26; Mon, 17 Jan 2022 10:53:36 +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 53CD81059596; Mon, 17 Jan 2022 10:53:35 +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 DDEB44A7CA; Mon, 17 Jan 2022 10:53:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HAr8gG009005 for ; Mon, 17 Jan 2022 05:53:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7CE781059A79; Mon, 17 Jan 2022 10:53:08 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD4DC1059596; Mon, 17 Jan 2022 10:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642416825; 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=2MOIksdPmhexRV/RB/UJRb1kuB9bSPlptaGqI4Bk+A8=; b=Dui5PKEx1FzM0VG1cORcsPV3X9y8YoSOrH4ps5m3QCWscL1wqU2xZ0ioF9+TnKYvgcm8gh zWeESNwWRcO9uN8g0Ucwf50pHJl/pWV+FVgzehpzong1KOWGpykkIapRQ8KrBekjcnmzmc m/mJ7ItEYrgPhSCoYfR76EF9TvU48sg= X-MC-Unique: CZHVkFnAPdeu5UjAZZSAxQ-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 04/20] qemu: Define hvf capability Date: Mon, 17 Jan 2022 11:52:44 +0100 Message-Id: <20220117105300.15759-5-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.84 on 10.5.11.22 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: 1642416827844100001 From: Roman Bolshakov Signed-off-by: Roman Bolshakov Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Christophe Fergeau --- src/qemu/qemu_capabilities.c | 1 + src/qemu/qemu_capabilities.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index c2d56dfc9d..5e6fbb82b6 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -657,6 +657,7 @@ VIR_ENUM_IMPL(virQEMUCaps, =20 /* 420 */ "device.json+hotplug", /* QEMU_CAPS_DEVICE_JSON */ + "hvf", /* QEMU_CAPS_HVF */ ); =20 =20 diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 2c1b6a99c4..166224bc57 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -636,6 +636,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ =20 /* 420 */ QEMU_CAPS_DEVICE_JSON, /* -device accepts JSON (and works with hot-unp= lug) */ + QEMU_CAPS_HVF, /* Whether Hypervisor.framework is available */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; --=20 2.34.1 From nobody Sun Apr 28 20:44:41 2024 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=1642416827; cv=none; d=zohomail.com; s=zohoarc; b=HgUQkhyozwSIPbV8SSXeDmV2aL6od7AaQovhFSTZMdDJsJkLk+xjwT1kco0fdQS2M+h4bKJ6gfiid4F3Piou9zVNswboarWBlzklcr1QS/MAKLAYUzqwh2XgIdNm2Cvv74su36Gm+ELYAvCeouJ2nBMGaMIyMIhsu/p7kImD1Fw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642416827; 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=Ex+euSpufIcr2Zb/nJaUf1JbBqW/Jhzp9ZMT3vEkbMg=; b=eufOEgYhACTfFSdujMIZaFpfInrZLJHctgdMkWmAMec3dk71wqxsM4XTlvXweKsz/XI1G1IrLlYrd7ByJBeyBZYrsaC9KA+WBZ1n38+5Mc1c3eo5dwJM94tlg82pqJByZGpMP0qsTO4ReumZNJBzk96ADjQlQa3EYB/B/O/VXCw= 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 1642416827503364.5824865679998; Mon, 17 Jan 2022 02:53:47 -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-279-jXbWKfFzMAq01d9_lI_p8w-1; Mon, 17 Jan 2022 05:53:43 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 30CAB801B2D; Mon, 17 Jan 2022 10:53:38 +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 0AE6B1059596; Mon, 17 Jan 2022 10:53: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 A59F81809CB8; Mon, 17 Jan 2022 10:53:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HAr9nm009024 for ; Mon, 17 Jan 2022 05:53:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id ACD9C1059A7A; Mon, 17 Jan 2022 10:53:09 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DDB831059A79; Mon, 17 Jan 2022 10:53:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642416826; 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=Ex+euSpufIcr2Zb/nJaUf1JbBqW/Jhzp9ZMT3vEkbMg=; b=IvE48TC/7vtsxUB5Qm4AyB3MbN+q8TabmuuYkLiQGCazb6lwJ7gKagZDnkomy36q/AWnx0 bGifaOmv02//62vohS8DbEdmgBts7d7qY3v1fWsYb32H8ALrcyJ8gRBvySq6VmlY6FqsZt +Z30KmPSocvMaWlV4bzxVTfQ0tMDsIE= X-MC-Unique: jXbWKfFzMAq01d9_lI_p8w-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 05/20] qemu: Query hvf capability on macOS Date: Mon, 17 Jan 2022 11:52:45 +0100 Message-Id: <20220117105300.15759-6-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.84 on 10.5.11.22 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: 1642416828139100003 From: Roman Bolshakov There's no QMP command for querying if hvf is supported, therefore we use sysctl interface that tells if Hypervisor.framework works/available on the host. Signed-off-by: Roman Bolshakov Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Christophe Fergeau --- src/qemu/qemu_capabilities.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 5e6fbb82b6..146bbb97f8 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -56,6 +56,10 @@ #include #include #include +#ifdef __APPLE__ +# include +# include +#endif =20 #define VIR_FROM_THIS VIR_FROM_QEMU =20 @@ -3196,6 +3200,32 @@ virQEMUCapsProbeQMPKVMState(virQEMUCaps *qemuCaps, return 0; } =20 +#ifdef __APPLE__ +static int +virQEMUCapsProbeHVF(virQEMUCaps *qemuCaps) +{ + int hv_support; + size_t len =3D sizeof(hv_support); + + if (sysctlbyname("kern.hv_support", &hv_support, &len, NULL, 0) < 0) + hv_support =3D 0; + + if (qemuCaps->version >=3D 2012000 && + ARCH_IS_X86(qemuCaps->arch) && + hv_support) { + virQEMUCapsSet(qemuCaps, QEMU_CAPS_HVF); + } + + return 0; +} +#else +static int +virQEMUCapsProbeHVF(virQEMUCaps *qemuCaps G_GNUC_UNUSED) +{ + return 0; +} +#endif + struct virQEMUCapsCommandLineProps { const char *option; const char *param; @@ -5345,6 +5375,9 @@ virQEMUCapsInitQMPMonitor(virQEMUCaps *qemuCaps, if (virQEMUCapsProbeQMPKVMState(qemuCaps, mon) < 0) return -1; =20 + if (virQEMUCapsProbeHVF(qemuCaps) < 0) + return -1; + type =3D virQEMUCapsGetVirtType(qemuCaps); accel =3D virQEMUCapsGetAccel(qemuCaps, type); =20 --=20 2.34.1 From nobody Sun Apr 28 20:44:41 2024 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=1642416972; cv=none; d=zohomail.com; s=zohoarc; b=dA/21HhEINzkx4Jv1v2SgFsp+K5GEri7eV9BftERyaks5SyJ8BqdTY4rCxCGIgl5A/z5idaeLVXG95bxIJrGheuZd5OWOBELlT9Mp2AxK0wk7Tdhg6FPOsFbFm+2+ch1poUkUWe+0JcJ4BeKvltr7/Je8Nc9b49rsLF2LP0aIpY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642416972; 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=k7Lrgwdqwu0Prk2eJb2C3ZO2iZw/C5/ZB7YZXo8gq0s=; b=MPwAqnSDlchiEGgAP8jszXoMoM3FLD8NVklbgHuUq6PMGKGknI6rKxh0mwqTnwg6+QgNkM9LjTdvnigtAOeSfESZ1XFvqxv6aNyEpsUokZju2XJeht8N0e7+Ft/aG3jS8ym5A97EDryH8/PLYxl3qfFnsOiAdtFGWOnQoV1NAWk= 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 1642416972158921.0777392646605; Mon, 17 Jan 2022 02:56:12 -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-563-lGzEzRxJNHWCw_wvWf92vQ-1; Mon, 17 Jan 2022 05:56:09 -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 1F3D61966320; Mon, 17 Jan 2022 10:56:04 +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 F265A70D4C; Mon, 17 Jan 2022 10:56: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 BF51E4A706; Mon, 17 Jan 2022 10:56:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HArASN009029 for ; Mon, 17 Jan 2022 05:53:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id DCB431059A79; Mon, 17 Jan 2022 10:53:10 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 19AA21059596; Mon, 17 Jan 2022 10:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642416971; 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=k7Lrgwdqwu0Prk2eJb2C3ZO2iZw/C5/ZB7YZXo8gq0s=; b=Ta1VLUjRIYy81GMNT3qesbfBMsFO8hhQbpxk7GR6X2gxjKGph6Tn3KizYduuYudr74D0Yh oqjQp7Mmxru0cK50TtxpqGGeBm+5B9ND6xGWeMKjhhEZKSbvT3yN6kWmHJ2fPfvGAOjduP o0UDogO7E3cbqrEZWBFLV1eNRkDXAK0= X-MC-Unique: lGzEzRxJNHWCw_wvWf92vQ-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 06/20] fixup! qemu: Fix / improve virQEMUCapsProbeHVF() Date: Mon, 17 Jan 2022 11:52:46 +0100 Message-Id: <20220117105300.15759-7-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: 1642416973497100003 Content-Type: text/plain; charset="utf-8" Fix the architecture check so that hardware acceleration is only ever advertised when the guest and host architecture match; exit early if possible instead of calling sysctl every single time; add some comments. Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Tested-by: Christophe Fergeau --- 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 146bbb97f8..f1f1b37678 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3204,17 +3204,27 @@ virQEMUCapsProbeQMPKVMState(virQEMUCaps *qemuCaps, static int virQEMUCapsProbeHVF(virQEMUCaps *qemuCaps) { - int hv_support; + int hv_support =3D 0; size_t len =3D sizeof(hv_support); + virArch hostArch =3D virArchFromHost(); =20 + /* Guest and host arch need to match for hardware acceleration + * to be usable */ + if (qemuCaps->arch !=3D hostArch) + return 0; + + /* We don't have a nice way to probe whether the QEMU binary + * contains HVF support, but we know that versions older than + * QEMU 2.12 didn't have the feature at all */ + if (qemuCaps->version < 2012000) + return 0; + + /* We need the OS to report Hypervisor.framework availability */ if (sysctlbyname("kern.hv_support", &hv_support, &len, NULL, 0) < 0) - hv_support =3D 0; + return 0; =20 - if (qemuCaps->version >=3D 2012000 && - ARCH_IS_X86(qemuCaps->arch) && - hv_support) { + if (hv_support) virQEMUCapsSet(qemuCaps, QEMU_CAPS_HVF); - } =20 return 0; } --=20 2.34.1 From nobody Sun Apr 28 20:44:41 2024 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=1642416832; cv=none; d=zohomail.com; s=zohoarc; b=c5LwaJDtiZU+g1PJrp6czWD+4r99oAur9H4csrN9QXydJXIT/GEqLjeMyzF3F9cku6TduI1dOIjKFH74uTNW9Qyxm5iESU36oX6LOCpeI1LiUDQZXLelcYkyPA22RHEX69SJ7lVK/+pz9KS6j6BNsdYihlvogGSsOe6OHpofuaE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642416832; 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=zrLXwawaW1R1QXimTSuZOuGvuCQb7OS3Zn3PRoDE4nY=; b=Azx+m7+14ekDDL0IN31/dxHowSK51KGlzs96jZiyowKeR9LezsZb9UavDXNlpXGP/zBIQ/8gxUsvRgm1IvycblKNLb3mVNbtv6h7kHGZP9DCAUwU/d5hXKNOrV2x1SazvBzpNSArZ3l0MoTPcAvfOI0m2sIrGLlug9uVkc+i34c= 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 1642416832608663.6293576764676; Mon, 17 Jan 2022 02:53:52 -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-f6bSHeV1P0yQClHMavhk5g-1; Mon, 17 Jan 2022 05:53:48 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7149C64083; Mon, 17 Jan 2022 10:53:43 +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 5369E60C2D; Mon, 17 Jan 2022 10:53:42 +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 255424A706; Mon, 17 Jan 2022 10:53:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HArCce009047 for ; Mon, 17 Jan 2022 05:53:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 19AEB1059A79; Mon, 17 Jan 2022 10:53:12 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 49FEB1059596; Mon, 17 Jan 2022 10:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642416831; 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=zrLXwawaW1R1QXimTSuZOuGvuCQb7OS3Zn3PRoDE4nY=; b=W/yfinMver+WGab0inx7vKuvxiWQcIBu7SChIWaZD2DUVDCc7GeKBg7Kg6Nd1TENj9Qi74 rKms4y8iB0okIj/Em56ltbo8AxZv97Ad+/8dbtnu3F72dMugdWnN3BAddQ/hpt1nkvA/jF VGQlt8MGbuFUnK2Oa23afxiBeOgHzlg= X-MC-Unique: f6bSHeV1P0yQClHMavhk5g-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 07/20] qemu: Expose hvf domain type if hvf is supported Date: Mon, 17 Jan 2022 11:52:47 +0100 Message-Id: <20220117105300.15759-8-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.14 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: 1642416833133100003 From: Roman Bolshakov Signed-off-by: Roman Bolshakov Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Christophe Fergeau --- src/qemu/qemu_capabilities.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f1f1b37678..401ffe89c9 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1085,6 +1085,10 @@ virQEMUCapsInitGuestFromBinary(virCaps *caps, virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, NULL, NULL, 0, NULL); } + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF)) { + virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_HVF, + NULL, NULL, 0, NULL); + } =20 if ((ARCH_IS_X86(guestarch) || guestarch =3D=3D VIR_ARCH_AARCH64)) virCapabilitiesAddGuestFeatureWithToggle(guest, VIR_CAPS_GUEST_FEA= TURE_TYPE_ACPI, --=20 2.34.1 From nobody Sun Apr 28 20:44:41 2024 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=1642417031; cv=none; d=zohomail.com; s=zohoarc; b=hKgFYAeupDd+aT3XQloMcwYLXX/kl8QyFYRY10ThRp8CwTjAQ8Xx2HYo8B7mXXNi06a182q1paLwcJ4tJ474X/UE+yYp10HBsRDVE6CnwI5/CkxuwAktovR920Mrfj34PEUOpXJScDSwZJHTkanRNKBRxA4mzNyYtmSglu7PBFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642417031; 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=XHVxTb6oGNfiIlT6jLUNDMQVKw2PaQ5T5750+z/FRwE=; b=SFyTyMwPAh8nkgHFw5A1lGDSSeg4WUwygWIrNkX04a+cGzqdI/iStxP38FmfEeYUKMqU+izf4Mjd/uN49KeNOqJ3OrGlFZ1B8cvgOs/pblB6Z4jhouob3eONpyLGJZxLHcMfZaJwX2JQmflWXpQo2hNVNpWGtxL3sJniJG6c0Do= 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 1642417031627569.4198265123102; Mon, 17 Jan 2022 02:57:11 -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-595-Dv-znd7UNVO0Z3BqsdgjCg-1; Mon, 17 Jan 2022 05:56:12 -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 4AF171006AA8; Mon, 17 Jan 2022 10:56:07 +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 2821A7AB5A; Mon, 17 Jan 2022 10:56:07 +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 BAD901802E2E; Mon, 17 Jan 2022 10:56:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HArHpn009074 for ; Mon, 17 Jan 2022 05:53:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8AD451059596; Mon, 17 Jan 2022 10:53:17 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC0AB1059A79; Mon, 17 Jan 2022 10:53:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642417030; 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=XHVxTb6oGNfiIlT6jLUNDMQVKw2PaQ5T5750+z/FRwE=; b=bUHq8UYM+OEDoes6Pbr8441zsvPLjwmKGebwHtOX1KYheaVyclpnDP5mOLJIG/+wMn3MVP sd5BXRYrRiIxrP+cwFmyq7+PB+zWevgzcP8yDUwDOcgQKP2AVYkiL5y8aM8NlPxFYkYTmC KfsxppCoWsHVLGxFysGLrnVXZiev6bo= X-MC-Unique: Dv-znd7UNVO0Z3BqsdgjCg-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 08/20] qemu: Introduce virQEMUCapsAccelStr Date: Mon, 17 Jan 2022 11:52:48 +0100 Message-Id: <20220117105300.15759-9-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642417032095100001 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 Tested-by: Brad Laue Tested-by: Christophe Fergeau --- 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 401ffe89c9..8d3e8b3afb 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -793,6 +793,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 @@ -4079,7 +4089,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; @@ -4632,7 +4642,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.34.1 From nobody Sun Apr 28 20:44:41 2024 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=1642416980; cv=none; d=zohomail.com; s=zohoarc; b=OQkcMiXo2As0ihoD0E8kFrgfUaUjc9L9sOUgzm/5OyTDb8AGvSou62q/8khE6ovZ6lHPjrSh3BQNQQONe3q3//gTUR86+px3/anVDZo/CULsuJGYKPm0+emWZUFJux2RW84IgcNChv0/JAD9pLAAGXOiAklJNwhZ86QTVrkW4yA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642416980; 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=HVS0bLeMCmyJ0RFYkrhcq9xsWh/jh6ITNTQpX1XTp60=; b=n4atMRp00eqCOpLxyyZw/+Ym4MJwbQx+dk/XWlLZ+47p4UuOKg+6e9JtYaUzlLXWb01Rpq/v5DivofAZcwno7V4syErVE2pZDfZxiqzCC+LIQqhLS78+Icw/2AUsE5lfL51RF86uGf9pT1LzgDDoWj/j0VSXx3Gpmzrr3XCj68M= 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 1642416980184337.96942042615694; Mon, 17 Jan 2022 02:56:20 -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-658-HBuJ_AzhM8qFrAQ1FTyt_w-1; Mon, 17 Jan 2022 05:56:15 -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 0555186A062; Mon, 17 Jan 2022 10:56:10 +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 D7BBC7AB5D; Mon, 17 Jan 2022 10:56:09 +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 A9CDD1802E38; Mon, 17 Jan 2022 10:56:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HArIjb009083 for ; Mon, 17 Jan 2022 05:53:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id B95E41059A79; Mon, 17 Jan 2022 10:53:18 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EB0A11059596; Mon, 17 Jan 2022 10:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642416979; 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=HVS0bLeMCmyJ0RFYkrhcq9xsWh/jh6ITNTQpX1XTp60=; b=HWoLRUVMzGgDVDM22FxwlWcfoU1OsdOtjS70RIGgvRjSBK9bDq1HiElmDtU8B6c3laTC1d bpwgimtgbnYp2ul8bKpU5eSL1MEES0ZxlEStkIvNdLRJ8mD4ivsWJXHGvvT0eAv9LyNC0A UOKPCY8GsibbRPg4X6AlPDAyJwHEbOQ= X-MC-Unique: HBuJ_AzhM8qFrAQ1FTyt_w-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 09/20] qemu: Introduce virQEMUCapsTypeIsAccelerated Date: Mon, 17 Jan 2022 11:52:49 +0100 Message-Id: <20220117105300.15759-10-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642416980755100003 Content-Type: text/plain; charset="utf-8" From: Roman Bolshakov It replaces hardcoded checks for KVM. It'll be cleaner to use the function once multiple accelerators are supported in the QEMU driver. Explicit KVM domain checks should be done only when a feature is available only for KVM. Signed-off-by: Roman Bolshakov Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Tested-by: Christophe Fergeau --- src/qemu/qemu_capabilities.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 8d3e8b3afb..85dd36e274 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -803,6 +803,13 @@ virQEMUCapsAccelStr(virDomainVirtType type) } =20 =20 +static bool +virQEMUCapsTypeIsAccelerated(virDomainVirtType type) +{ + return type =3D=3D VIR_DOMAIN_VIRT_KVM; +} + + /* Checks whether a domain with @guest arch can run natively on @host. */ bool @@ -2343,7 +2350,7 @@ virQEMUCapsIsCPUModeSupported(virQEMUCaps *qemuCaps, =20 switch (mode) { case VIR_CPU_MODE_HOST_PASSTHROUGH: - return type =3D=3D VIR_DOMAIN_VIRT_KVM && + return virQEMUCapsTypeIsAccelerated(type) && virQEMUCapsGuestIsNative(hostarch, qemuCaps->arch); =20 case VIR_CPU_MODE_HOST_MODEL: @@ -3005,7 +3012,7 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps, qemuMonitor *mon, virDomainVirtType virtType) { - const char *model =3D virtType =3D=3D VIR_DOMAIN_VIRT_KVM ? "host" : "= max"; + const char *model =3D virQEMUCapsTypeIsAccelerated(virtType) ? "host" = : "max"; g_autoptr(qemuMonitorCPUModelInfo) modelInfo =3D NULL; g_autoptr(qemuMonitorCPUModelInfo) nonMigratable =3D NULL; g_autoptr(GHashTable) hash =3D NULL; @@ -3725,7 +3732,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps, virArchToString(qemuCaps->arch), virDomainVirtTypeToString(type)); goto error; - } else if (type =3D=3D VIR_DOMAIN_VIRT_KVM && + } else if (virQEMUCapsTypeIsAccelerated(type) && virCPUGetHostIsSupported(qemuCaps->arch)) { if (!(fullCPU =3D virQEMUCapsProbeHostCPU(qemuCaps->arch, NULL))) goto error; @@ -5858,10 +5865,10 @@ virQEMUCapsCacheLookupDefault(virFileCache *cache, if (virttype =3D=3D VIR_DOMAIN_VIRT_NONE) virttype =3D capsType; =20 - if (virttype =3D=3D VIR_DOMAIN_VIRT_KVM && capsType =3D=3D VIR_DOMAIN_= VIRT_QEMU) { + if (virQEMUCapsTypeIsAccelerated(virttype) && capsType =3D=3D VIR_DOMA= IN_VIRT_QEMU) { virReportError(VIR_ERR_INVALID_ARG, - _("KVM is not supported by '%s' on this host"), - binary); + _("the accel '%s' is not supported by '%s' on this = host"), + virQEMUCapsAccelStr(virttype), binary); return NULL; } =20 --=20 2.34.1 From nobody Sun Apr 28 20:44:41 2024 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=1642416979; cv=none; d=zohomail.com; s=zohoarc; b=Qcd3gKaJu0eDuVmJwC1XfpmxAaDbx05Fj28Dd7YH3VmPn9uDpI53c13DlrvZbi6Tjw9Niho/15KULnl8NqJP5kUzvfOM8KcZsgchQ/h9IOHZ3v5QPDcZYLW9ROQ6LpHyzX5hQ5tzd5hdjya2L/8z6U3jW6qgp89wR9hAT3N8NAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642416979; 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=rP3rWAPkqxPWPTCOGUbGguICCFF3Ws6plEMwf4GIBIg=; b=JS2NCeAQyIpncx+Fm7wQqOOrAkzHA/jxsHgrMPTyc7aL6vyXwDsXg4layGEXK6hRAEOTpahWOnxi2dK9640WFd5y0rmznSxGDH3+KbyU12RR7sjVVNLq7tnJo48vOvHuVAk4CjzDudIRSid+zubuBpfr63uwlacUp7+1ZSFoZ+A= 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 1642416979751631.9035800111869; Mon, 17 Jan 2022 02:56:19 -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-193-kyBi-E_aOm-veEdHKCsakA-1; Mon, 17 Jan 2022 05:56:17 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 81F9386A065; Mon, 17 Jan 2022 10:56:12 +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 63C4272414; Mon, 17 Jan 2022 10:56:12 +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 351FE180126E; Mon, 17 Jan 2022 10:56:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HArJK2009093 for ; Mon, 17 Jan 2022 05:53:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id E946A1059A79; Mon, 17 Jan 2022 10:53:19 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 260011059596; Mon, 17 Jan 2022 10:53:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642416978; 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=rP3rWAPkqxPWPTCOGUbGguICCFF3Ws6plEMwf4GIBIg=; b=ejULPhOIrugMlI27NByVD2Q9OcEZ2iBx9/tfFjZeHki/ouTcpVkFAQE34n6MbRnaEqppWC wpkkgq5qu1x7jzTn8uP1rRXV/6F1SPKpMj6yZQmp51KgEZMdNC916//CYEKTwAiwtULgwC d3OgV3908OA9J6cvt1uD3g211aeMe+8= X-MC-Unique: kyBi-E_aOm-veEdHKCsakA-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 10/20] qemu: Introduce virQEMUCapsHaveAccel Date: Mon, 17 Jan 2022 11:52:50 +0100 Message-Id: <20220117105300.15759-11-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.15 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: 1642416980652100001 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 Tested-by: Christophe Fergeau --- 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 85dd36e274..79e80dd288 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -810,6 +810,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 @@ -5031,7 +5038,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')", @@ -5065,7 +5072,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 " @@ -5530,7 +5539,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; @@ -5594,13 +5603,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.34.1 From nobody Sun Apr 28 20:44:41 2024 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=1642416832; cv=none; d=zohomail.com; s=zohoarc; b=HlFhSAm/rEL80uj7OvKGCo+z1O4NVwPqmwsm5Ont/DiTSrjm8chSsFoE/r3+BrmRInuKb3bGRkxLwk89rfo1vPe0yD/HwmTUrz09C7Rwm4LF3h7N5bdcILG3kloTGwT9NOFQcRdcPnxKFD3Yv8O6ewZ917Aic8ArBnl9Bnl21B4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642416832; 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=w/v+a3oeJLHpOaIQ+a8J7Ptp7MMsp+gmf+v7RFPswi4=; b=Y5yPWV/9oaR0HjFmgP5T3ssH5BE5CdNs1nSSLD3Wlp0m87yosTa1KjanEIajW3gkKKVxpf+aJzE25sx714bYace3rTV5AXYvJm+5jAcaYr9sTyHbn1qUKjw0x9dSbwq/Zb5nQ+eAtMOzOkZyzKtJvxbbxIWXRZ1Cb8aoHE4cBrM= 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 1642416832831701.1923652546732; Mon, 17 Jan 2022 02:53:52 -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-296-MH46onMhNs6Gu1AFM6nxmQ-1; Mon, 17 Jan 2022 05:53:50 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4CFBD101AFA8; Mon, 17 Jan 2022 10:53:45 +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 0374A7CAD6; Mon, 17 Jan 2022 10:53:45 +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 C6EEA180B617; Mon, 17 Jan 2022 10:53:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HArLbo009107 for ; Mon, 17 Jan 2022 05:53:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 259FD1059A79; Mon, 17 Jan 2022 10:53:21 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 562E11059596; Mon, 17 Jan 2022 10:53:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642416831; 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=w/v+a3oeJLHpOaIQ+a8J7Ptp7MMsp+gmf+v7RFPswi4=; b=L4jqE0LCVEw7XPDwwoe6wmXWDSp9+W+Sk3ZlZkjHSNPAvZCKaL7Cr4GzGTY5He3RF4/8+9 LuFsXzXkGckWXrPIB01WnAo23EmBmCYB5R0UFywdl+GTi/+wIRUH1drVoRlDdQeVH6ZekL YWMAk/ult9zu1wdGKk3lRcVa/oolNFI= X-MC-Unique: MH46onMhNs6Gu1AFM6nxmQ-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 11/20] qemu: Correct CPU capabilities probing for hvf Date: Mon, 17 Jan 2022 11:52:51 +0100 Message-Id: <20220117105300.15759-12-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.12 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: 1642416835215100001 Content-Type: text/plain; charset="utf-8" From: Roman Bolshakov With this change virsh domcapabilites shows: https://gitlab.com/libvirt/libvirt/-/issues/147 Signed-off-by: Roman Bolshakov Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Christophe Fergeau --- src/qemu/qemu_capabilities.c | 35 ++++++++++++++++++++++++++++++++--- src/qemu/qemu_process.c | 2 ++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 79e80dd288..c5d00225b8 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -745,6 +745,7 @@ struct _virQEMUCaps { =20 /* Capabilities which may differ depending on the accelerator. */ virQEMUCapsAccel kvm; + virQEMUCapsAccel hvf; virQEMUCapsAccel tcg; }; =20 @@ -806,14 +807,16 @@ virQEMUCapsAccelStr(virDomainVirtType type) static bool virQEMUCapsTypeIsAccelerated(virDomainVirtType type) { - return type =3D=3D VIR_DOMAIN_VIRT_KVM; + return type =3D=3D VIR_DOMAIN_VIRT_KVM || + type =3D=3D VIR_DOMAIN_VIRT_HVF; } =20 =20 static bool virQEMUCapsHaveAccel(virQEMUCaps *qemuCaps) { - return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM); + return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF); } =20 =20 @@ -869,6 +872,8 @@ virQEMUCapsGetAccel(virQEMUCaps *qemuCaps, { if (type =3D=3D VIR_DOMAIN_VIRT_KVM) return &qemuCaps->kvm; + else if (type =3D=3D VIR_DOMAIN_VIRT_HVF) + return &qemuCaps->hvf; =20 return &qemuCaps->tcg; } @@ -999,6 +1004,8 @@ virQEMUCapsGetMachineTypesCaps(virQEMUCaps *qemuCaps, * take the set of machine types we probed first. */ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) accel =3D &qemuCaps->kvm; + else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF)) + accel =3D &qemuCaps->hvf; else accel =3D &qemuCaps->tcg; =20 @@ -2017,6 +2024,7 @@ virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps) ret->cpuData =3D virCPUDataNewCopy(qemuCaps->cpuData); =20 if (virQEMUCapsAccelCopy(&ret->kvm, &qemuCaps->kvm) < 0 || + virQEMUCapsAccelCopy(&ret->hvf, &qemuCaps->hvf) < 0 || virQEMUCapsAccelCopy(&ret->tcg, &qemuCaps->tcg) < 0) return NULL; =20 @@ -2070,6 +2078,7 @@ void virQEMUCapsDispose(void *obj) virSEVCapabilitiesFree(qemuCaps->sevCapabilities); =20 virQEMUCapsAccelClear(&qemuCaps->kvm); + virQEMUCapsAccelClear(&qemuCaps->hvf); virQEMUCapsAccelClear(&qemuCaps->tcg); } =20 @@ -2321,6 +2330,10 @@ virQEMUCapsIsVirtTypeSupported(virQEMUCaps *qemuCaps, virQEMUCapsGet(qemuCaps, QEMU_CAPS_TCG)) return true; =20 + if (virtType =3D=3D VIR_DOMAIN_VIRT_HVF && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF)) + return true; + if (virtType =3D=3D VIR_DOMAIN_VIRT_KVM && virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) return true; @@ -2798,7 +2811,9 @@ bool virQEMUCapsHasMachines(virQEMUCaps *qemuCaps) { =20 - return !!qemuCaps->kvm.nmachineTypes || !!qemuCaps->tcg.nmachineTypes; + return !!qemuCaps->kvm.nmachineTypes || + !!qemuCaps->hvf.nmachineTypes || + !!qemuCaps->tcg.nmachineTypes; } =20 =20 @@ -4496,6 +4511,10 @@ virQEMUCapsLoadCache(virArch hostArch, virQEMUCapsLoadAccel(qemuCaps, ctxt, VIR_DOMAIN_VIRT_KVM) < 0) { return -1; } + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF) && + virQEMUCapsLoadAccel(qemuCaps, ctxt, VIR_DOMAIN_VIRT_HVF) < 0) { + return -1; + } if (virQEMUCapsLoadAccel(qemuCaps, ctxt, VIR_DOMAIN_VIRT_QEMU) < 0) return -1; =20 @@ -4507,6 +4526,8 @@ virQEMUCapsLoadCache(virArch hostArch, =20 if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KV= M); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF)) + virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_HV= F); virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_QEMU); =20 if (virXPathBoolean("boolean(./kvmSupportsNesting)", ctxt) > 0) @@ -4741,6 +4762,8 @@ virQEMUCapsFormatCache(virQEMUCaps *qemuCaps) =20 if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) virQEMUCapsFormatAccel(qemuCaps, &buf, VIR_DOMAIN_VIRT_KVM); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF)) + virQEMUCapsFormatAccel(qemuCaps, &buf, VIR_DOMAIN_VIRT_HVF); virQEMUCapsFormatAccel(qemuCaps, &buf, VIR_DOMAIN_VIRT_QEMU); =20 for (i =3D 0; i < qemuCaps->ngicCapabilities; i++) { @@ -5363,6 +5386,9 @@ virQEMUCapsGetVirtType(virQEMUCaps *qemuCaps) if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) return VIR_DOMAIN_VIRT_KVM; =20 + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF)) + return VIR_DOMAIN_VIRT_HVF; + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_TCG)) return VIR_DOMAIN_VIRT_QEMU; =20 @@ -5601,6 +5627,8 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch, =20 if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KV= M); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF)) + virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_HV= F); virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_QEMU); =20 if (virQEMUCapsHaveAccel(qemuCaps)) { @@ -6595,5 +6623,6 @@ void virQEMUCapsStripMachineAliases(virQEMUCaps *qemuCaps) { virQEMUCapsStripMachineAliasesForVirtType(qemuCaps, VIR_DOMAIN_VIRT_KV= M); + virQEMUCapsStripMachineAliasesForVirtType(qemuCaps, VIR_DOMAIN_VIRT_HV= F); virQEMUCapsStripMachineAliasesForVirtType(qemuCaps, VIR_DOMAIN_VIRT_QE= MU); } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c2c10d282a..ff13ac66d7 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -9271,6 +9271,8 @@ qemuProcessQMPInit(qemuProcessQMP *proc) =20 #if defined(__linux__) # define hwaccel "kvm:tcg" +#elif defined(__APPLE__) +# define hwaccel "hvf:tcg" #else # define hwaccel "tcg" #endif --=20 2.34.1 From nobody Sun Apr 28 20:44:41 2024 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=1642416830; cv=none; d=zohomail.com; s=zohoarc; b=EbpMi8JzoryqpNX9c9AcKLapYG8JQxRoNEXT1SdC9FEbogQFqvoznjzXHIMaxnqk67L0bRcxd5yHq78ivZ5sR/D7+RuRF4fTha2+e7ys7S1sxSrGUsL255H7hFADJFp4BFN+teEQ75nYHfrFmz1FWxZUA5AN2qCYmdChSFOyUUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642416830; 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=Djm02tzXTTQSotVBqz4JanzAKpyXx4Ry6sGrCF7j1/U=; b=MUtwNQpOjBvzM46TvvYVFCHxIJGYuHNZKDE1+oBrO8NjNJTfkU4fQfCkbm8awu8yjEtTNO9Xb4ya1a1EgdKq+H7QhG4HB/soMBOFaekZySeAseLrcOi5L/tZhGtIynl3GQ6qcxOJxQVIWBSLIM27BYFbqhGEplhofEFdr4iO0cg= 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 1642416830278665.6909929105784; Mon, 17 Jan 2022 02:53:50 -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-132-83BvGSccMzGYYm7dH28U8g-1; Mon, 17 Jan 2022 05:53:45 -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 0D42D100CCC3; Mon, 17 Jan 2022 10:53:41 +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 DC35870D4C; Mon, 17 Jan 2022 10:53:40 +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 A62571809CBA; Mon, 17 Jan 2022 10:53:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HArMNM009113 for ; Mon, 17 Jan 2022 05:53:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 554501059A79; Mon, 17 Jan 2022 10:53:22 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8696F1059596; Mon, 17 Jan 2022 10:53:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642416829; 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=Djm02tzXTTQSotVBqz4JanzAKpyXx4Ry6sGrCF7j1/U=; b=SVUrIx1uQLlCA2hDf6cvzy6/MiPP63xfcdra/2LeN3leffNLXe9928FfTx/w0eADeENEZc 18T5Hc2Uy7n11tjVpYi+zK16EuNZtLHT5FpwBjf2nHA5a8FcOAdQFuhKqgayKXjQKTDdom mRTPqE5rU9EnCuwYBJFLb5agACItxms= X-MC-Unique: 83BvGSccMzGYYm7dH28U8g-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 12/20] tests: Introduce testQemuHostOS Date: Mon, 17 Jan 2022 11:52:52 +0100 Message-Id: <20220117105300.15759-13-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: 1642416832572100001 Content-Type: text/plain; charset="utf-8" This new enumeration provides a way to specify the host OS that a specific test case expects. The default is Linux, which has been the implicit host OS until now; when Linux is selected as the host OS, KVM support is advertised in capabilies data exposed to test cases. This commit doesn't result in any functional change, and simply sets the stage for introducing macOS host OS support later. Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Tested-by: Christophe Fergeau --- tests/testutilsqemu.c | 86 +++++++++++++++++++++++++++---------------- tests/testutilsqemu.h | 4 ++ 2 files changed, 58 insertions(+), 32 deletions(-) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index cb665e501b..a27e290c6b 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -160,7 +160,8 @@ virHostCPUX86GetCPUID(uint32_t leaf, =20 static int testQemuAddGuest(virCaps *caps, - virArch arch) + virArch arch, + testQemuHostOS hostOS) { size_t nmachines; virCapsGuestMachine **machines =3D NULL; @@ -193,16 +194,18 @@ testQemuAddGuest(virCaps *caps, virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_QEMU, NULL, NULL, 0, NULL); =20 - if (kvm_machines[emu_arch] !=3D NULL) { - nmachines =3D g_strv_length((char **)kvm_machines[emu_arch]); - machines =3D virCapabilitiesAllocMachines(kvm_machines[emu_arch], - nmachines); - if (machines =3D=3D NULL) - goto error; - - virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, - qemu_emulators[emu_arch], - NULL, nmachines, machines); + if (hostOS =3D=3D HOST_OS_LINUX) { + if (kvm_machines[emu_arch] !=3D NULL) { + nmachines =3D g_strv_length((char **)kvm_machines[emu_arch]); + machines =3D virCapabilitiesAllocMachines(kvm_machines[emu_arc= h], + nmachines); + if (machines =3D=3D NULL) + goto error; + + virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_KVM, + qemu_emulators[emu_arch], + NULL, nmachines, machines); + } } =20 return 0; @@ -213,7 +216,8 @@ testQemuAddGuest(virCaps *caps, } =20 =20 -virCaps *testQemuCapsInit(void) +static virCaps* +testQemuCapsInitImpl(testQemuHostOS hostOS) { virCaps *caps; size_t i; @@ -233,7 +237,7 @@ virCaps *testQemuCapsInit(void) goto cleanup; =20 for (i =3D 0; i < VIR_ARCH_LAST; i++) { - if (testQemuAddGuest(caps, i) < 0) + if (testQemuAddGuest(caps, i, hostOS) < 0) goto cleanup; } =20 @@ -255,6 +259,12 @@ virCaps *testQemuCapsInit(void) return NULL; } =20 +virCaps* +testQemuCapsInit(void) +{ + return testQemuCapsInitImpl(HOST_OS_LINUX); +} + =20 void qemuTestSetHostArch(virQEMUDriver *driver, @@ -338,7 +348,8 @@ void qemuTestDriverFree(virQEMUDriver *driver) =20 static void qemuTestCapsPopulateFakeMachines(virQEMUCaps *caps, - virArch arch) + virArch arch, + testQemuHostOS hostOS) { size_t i; const char *defaultRAMid =3D NULL; @@ -366,20 +377,22 @@ qemuTestCapsPopulateFakeMachines(virQEMUCaps *caps, virQEMUCapsSet(caps, QEMU_CAPS_TCG); } =20 - if (kvm_machines[arch] !=3D NULL) { - for (i =3D 0; kvm_machines[arch][i] !=3D NULL; i++) { - virQEMUCapsAddMachine(caps, - VIR_DOMAIN_VIRT_KVM, - kvm_machines[arch][i], - NULL, - NULL, - 0, - false, - false, - true, - defaultRAMid, - false); - virQEMUCapsSet(caps, QEMU_CAPS_KVM); + if (hostOS =3D=3D HOST_OS_LINUX) { + if (kvm_machines[arch] !=3D NULL) { + for (i =3D 0; kvm_machines[arch][i] !=3D NULL; i++) { + virQEMUCapsAddMachine(caps, + VIR_DOMAIN_VIRT_KVM, + kvm_machines[arch][i], + NULL, + NULL, + 0, + false, + false, + true, + defaultRAMid, + false); + virQEMUCapsSet(caps, QEMU_CAPS_KVM); + } } } } @@ -399,8 +412,10 @@ qemuTestCapsCacheInsertData(virFileCache *cache, } =20 =20 -int qemuTestCapsCacheInsert(virFileCache *cache, - virQEMUCaps *caps) +static int +qemuTestCapsCacheInsertImpl(virFileCache *cache, + virQEMUCaps *caps, + testQemuHostOS hostOS) { size_t i; =20 @@ -425,7 +440,7 @@ int qemuTestCapsCacheInsert(virFileCache *cache, if (!(copyCaps =3D effCaps =3D virQEMUCapsNewCopy(caps))) return -1; =20 - qemuTestCapsPopulateFakeMachines(copyCaps, arch); + qemuTestCapsPopulateFakeMachines(copyCaps, arch, hostOS); } =20 if (qemuTestCapsCacheInsertData(cache, qemu_emulators[arch], e= ffCaps) < 0) @@ -460,7 +475,7 @@ int qemuTestCapsCacheInsert(virFileCache *cache, if (!tmp) return -1; =20 - qemuTestCapsPopulateFakeMachines(tmp, i); + qemuTestCapsPopulateFakeMachines(tmp, i, hostOS); =20 if (qemuTestCapsCacheInsertData(cache, qemu_emulators[i], tmp)= < 0) return -1; @@ -470,6 +485,13 @@ int qemuTestCapsCacheInsert(virFileCache *cache, return 0; } =20 +int +qemuTestCapsCacheInsert(virFileCache *cache, + virQEMUCaps *caps) +{ + return qemuTestCapsCacheInsertImpl(cache, caps, HOST_OS_LINUX); +} + =20 # define STATEDIRTEMPLATE abs_builddir "/qemustatedir-XXXXXX" # define CONFIGDIRTEMPLATE abs_builddir "/qemuconfigdir-XXXXXX" diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index d59fa53239..a8de6eb52b 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -33,6 +33,10 @@ enum { GIC_BOTH, }; =20 +typedef enum { + HOST_OS_LINUX =3D 0, +} testQemuHostOS; + typedef enum { ARG_QEMU_CAPS =3D QEMU_CAPS_LAST + 1, ARG_GIC, --=20 2.34.1 From nobody Sun Apr 28 20:44:41 2024 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=1642416847; cv=none; d=zohomail.com; s=zohoarc; b=WVrNKCW5YcYv92SNKNxmAA8s7zRZ4XmHCN33ojiJ1gOSs+J71IKeB8ZVU/kc9zTI109w6CH+y+JrLDgOvtIWvpovmaMpryMD+0BW6pLQ+ZdKlgnVolxS7pVOP7xp3tt5keu5omUltxzOLDyX6QaVqE3AnFtEAFi/ezeCXOKWsnM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642416847; 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=0YM99i8qCKNpY+SltC6FTRSdp5iPeD1adtnKVw0Jzjc=; b=O5g0YBxCyr9dSPIFJO7eNDEY07Qeg6C5VMcuKliyOKD2ZEMwPRbGkpHf+FxNzV0Qs4M2cKMzYQVIT8lNLO1NpI7KWYL5RSe31P7fvEYHn5gDQogOPS9GT0zmgsYJfJtwFQ7zWZnF5gY8ckEFYIhwdT5Tgf9emMSYdKrTDvYc2dI= 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 1642416847794472.0485664918482; Mon, 17 Jan 2022 02:54:07 -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-616-wh4tCZfZNdW5HLg8I686ZQ-1; Mon, 17 Jan 2022 05:53:54 -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 3F56684DA40; Mon, 17 Jan 2022 10:53:49 +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 19A0C795B0; Mon, 17 Jan 2022 10:53:48 +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 DD7834A70A; Mon, 17 Jan 2022 10:53:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HArN35009123 for ; Mon, 17 Jan 2022 05:53:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8548C1059A79; Mon, 17 Jan 2022 10:53:23 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B65AF1059596; Mon, 17 Jan 2022 10:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642416846; 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=0YM99i8qCKNpY+SltC6FTRSdp5iPeD1adtnKVw0Jzjc=; b=aa63ypjXY/TN5dVwa6PwJdVpz17irkWPsIwOWgf95DAkxC7eCIy6zuoLskpV8ML7hlc4kz YA2grP1x7XKJoHlNml/2u2kuYBQyUwaf/v2lGD1I3gS9oj5H2/Ii54a0hXn96V0cVPbxRn 6A1TxjukTDkAQgEUc9B/twO9YfTzPTA= X-MC-Unique: wh4tCZfZNdW5HLg8I686ZQ-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 13/20] tests: Add macOS support to testutilsqemu Date: Mon, 17 Jan 2022 11:52:53 +0100 Message-Id: <20220117105300.15759-14-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642416849687100001 Content-Type: text/plain; charset="utf-8" This exposes a couple of macOS-specific variants of existing APIs, which can be used when implementing test programs and result in HVF support being advertised. Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Christophe Fergeau --- tests/testutilsqemu.c | 58 +++++++++++++++++++++++++++++++++++++++++++ tests/testutilsqemu.h | 4 +++ 2 files changed, 62 insertions(+) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index a27e290c6b..e48e449f02 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -97,6 +97,18 @@ static const char *const *kvm_machines[VIR_ARCH_LAST] = =3D { [VIR_ARCH_S390X] =3D s390x_machines, }; =20 +static const char *const *hvf_machines[VIR_ARCH_LAST] =3D { + [VIR_ARCH_I686] =3D NULL, + [VIR_ARCH_X86_64] =3D x86_64_machines, + [VIR_ARCH_AARCH64] =3D aarch64_machines, + [VIR_ARCH_ARMV7L] =3D NULL, + [VIR_ARCH_PPC64] =3D NULL, + [VIR_ARCH_PPC] =3D NULL, + [VIR_ARCH_RISCV32] =3D NULL, + [VIR_ARCH_RISCV64] =3D NULL, + [VIR_ARCH_S390X] =3D NULL, +}; + static const char *qemu_default_ram_id[VIR_ARCH_LAST] =3D { [VIR_ARCH_I686] =3D "pc.ram", [VIR_ARCH_X86_64] =3D "pc.ram", @@ -208,6 +220,20 @@ testQemuAddGuest(virCaps *caps, } } =20 + if (hostOS =3D=3D HOST_OS_MACOS) { + if (hvf_machines[emu_arch] !=3D NULL) { + nmachines =3D g_strv_length((char **)hvf_machines[emu_arch]); + machines =3D virCapabilitiesAllocMachines(hvf_machines[emu_arc= h], + nmachines); + if (machines =3D=3D NULL) + goto error; + + virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_HVF, + qemu_emulators[emu_arch], + NULL, nmachines, machines); + } + } + return 0; =20 error: @@ -265,6 +291,12 @@ testQemuCapsInit(void) return testQemuCapsInitImpl(HOST_OS_LINUX); } =20 +virCaps* +testQemuCapsInitMacOS(void) +{ + return testQemuCapsInitImpl(HOST_OS_MACOS); +} + =20 void qemuTestSetHostArch(virQEMUDriver *driver, @@ -395,6 +427,25 @@ qemuTestCapsPopulateFakeMachines(virQEMUCaps *caps, } } } + + if (hostOS =3D=3D HOST_OS_MACOS) { + if (hvf_machines[arch] !=3D NULL) { + for (i =3D 0; hvf_machines[arch][i] !=3D NULL; i++) { + virQEMUCapsAddMachine(caps, + VIR_DOMAIN_VIRT_HVF, + hvf_machines[arch][i], + NULL, + NULL, + 0, + false, + false, + true, + defaultRAMid, + false); + virQEMUCapsSet(caps, QEMU_CAPS_HVF); + } + } + } } =20 =20 @@ -492,6 +543,13 @@ qemuTestCapsCacheInsert(virFileCache *cache, return qemuTestCapsCacheInsertImpl(cache, caps, HOST_OS_LINUX); } =20 +int +qemuTestCapsCacheInsertMacOS(virFileCache *cache, + virQEMUCaps *caps) +{ + return qemuTestCapsCacheInsertImpl(cache, caps, HOST_OS_MACOS); +} + =20 # define STATEDIRTEMPLATE abs_builddir "/qemustatedir-XXXXXX" # define CONFIGDIRTEMPLATE abs_builddir "/qemuconfigdir-XXXXXX" diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index a8de6eb52b..a9202d2ae6 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -35,6 +35,7 @@ enum { =20 typedef enum { HOST_OS_LINUX =3D 0, + HOST_OS_MACOS, } testQemuHostOS; =20 typedef enum { @@ -92,6 +93,7 @@ struct testQemuInfo { }; =20 virCaps *testQemuCapsInit(void); +virCaps *testQemuCapsInitMacOS(void); virDomainXMLOption *testQemuXMLConfInit(void); =20 =20 @@ -113,6 +115,8 @@ int qemuTestDriverInit(virQEMUDriver *driver); void qemuTestDriverFree(virQEMUDriver *driver); int qemuTestCapsCacheInsert(virFileCache *cache, virQEMUCaps *caps); +int qemuTestCapsCacheInsertMacOS(virFileCache *cache, + virQEMUCaps *caps); =20 int testQemuCapsSetGIC(virQEMUCaps *qemuCaps, int gic); --=20 2.34.1 From nobody Sun Apr 28 20:44:41 2024 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=1642416843; cv=none; d=zohomail.com; s=zohoarc; b=NYpwHxUsiIJeSTBFw/2yxLbEfEK8dGPNWjfYIoX3JVafrKlbog3pCP6wff4re5E61Vlkv6EQI5033KO4RDTtd9OoYxF3cP19FfBbAqvBGdpXM6epIzF9pLZqIq2oGxU5eODlDry27bDGV7neLUGsdcW7HqfMG6UxWstX8njNuWE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642416843; 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=3TVGXYFXhtXuJ0+RUoSxQ9Xmc0esElrQFR4ADAUzf1U=; b=G1aTzKeT9YidPuMx2NxB8EbgMQF8sulDK63rk2fGneu12gHSkA7dMZliq946gnjaRbWbAs3nQSwHyLS5F/VWCmN2Me7Q/qgcn6vjvNBr9eCWa9lIOuMBuTccU3UdyNueQEZtwddY2Nf/258N0GEDjlvlrUYouaKasZXhNsxr1pQ= 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 1642416843489547.7035368754096; Mon, 17 Jan 2022 02:54:03 -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-619-SoYNZwhKPUeckt6yD0qNvw-1; Mon, 17 Jan 2022 05:53:54 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 139886409E; Mon, 17 Jan 2022 10:53:48 +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 E87CE7CAEF; Mon, 17 Jan 2022 10:53:47 +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 B79D31806D1D; Mon, 17 Jan 2022 10:53:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HArOhh009138 for ; Mon, 17 Jan 2022 05:53:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id B4D9B1059A79; Mon, 17 Jan 2022 10:53:24 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E653B1059596; Mon, 17 Jan 2022 10:53:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642416842; 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=3TVGXYFXhtXuJ0+RUoSxQ9Xmc0esElrQFR4ADAUzf1U=; b=Pf2hoAGNyiw+kgoMR7RAYY2mlzDxd+79Yq4p1Xlx2aLx6RlEP+/rEHi7Vtz/JmtXtgj+zN fkrS0LUKOVHeTRNk7HtTkepH6QZED2z3i+0/jQt303IyjlGilOVUCnoTdE6zkDxHIBAWFb wvqDOtlvuBe2EQkyfBOCCwhARIzv53Y= X-MC-Unique: SoYNZwhKPUeckt6yD0qNvw-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 14/20] tests: Add macOS support to qemuxml2*test Date: Mon, 17 Jan 2022 11:52:54 +0100 Message-Id: <20220117105300.15759-15-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.12 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: 1642416845103100001 Content-Type: text/plain; charset="utf-8" The new DO_TEST_MACOS() macro makes it possible to create test cases that verify the behavior of libvirt on a macOS machine with HVF support available. Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Christophe Fergeau --- tests/qemuxml2argvtest.c | 25 ++++++++++++++++++++++++- tests/qemuxml2xmltest.c | 27 ++++++++++++++++++++++++++- tests/testutilsqemu.c | 4 ++++ tests/testutilsqemu.h | 2 ++ 4 files changed, 56 insertions(+), 2 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index cc67d806e4..b10850dcce 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -39,6 +39,8 @@ # define VIR_FROM_THIS VIR_FROM_QEMU =20 static virQEMUDriver driver; +static virCaps *linuxCaps; +static virCaps *macOSCaps; =20 static unsigned char * fakeSecretGetValue(virSecretPtr obj G_GNUC_UNUSED, @@ -716,12 +718,18 @@ testCompareXMLToArgv(const void *data) g_autofree char *archstr =3D NULL; virArch arch =3D VIR_ARCH_NONE; g_autoptr(virIdentity) sysident =3D virIdentityGetSystem(); + int rc; =20 memset(&monitor_chr, 0, sizeof(monitor_chr)); =20 if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0) goto cleanup; =20 + if (info->args.hostOS =3D=3D HOST_OS_MACOS) + driver.caps =3D macOSCaps; + else + driver.caps =3D linuxCaps; + if (info->arch !=3D VIR_ARCH_NONE && info->arch !=3D VIR_ARCH_X86_64) qemuTestSetHostArch(&driver, info->arch); =20 @@ -771,7 +779,11 @@ testCompareXMLToArgv(const void *data) goto cleanup; } =20 - if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) + if (info->args.hostOS =3D=3D HOST_OS_MACOS) + rc =3D qemuTestCapsCacheInsertMacOS(driver.qemuCapsCache, info->qe= muCaps); + else + rc =3D qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCap= s); + if (rc < 0) goto cleanup; =20 if (info->migrateFrom && @@ -934,6 +946,13 @@ mymain(void) if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; =20 + /* By default, the driver gets a virCaps instance that's suitable for + * tests that expect Linux as the host OS. We create another one for + * macOS and keep around pointers to both: this allows us to later + * pick the appropriate one for each test case */ + linuxCaps =3D driver.caps; + macOSCaps =3D testQemuCapsInitMacOS(); + driver.privileged =3D true; =20 VIR_FREE(driver.config->defaultTLSx509certdir); @@ -1074,6 +1093,10 @@ mymain(void) DO_TEST_FULL(name, "", \ ARG_GIC, gic, \ ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) +# define DO_TEST_MACOS(name, ...) \ + DO_TEST_FULL(name, "", \ + ARG_HOST_OS, HOST_OS_MACOS, \ + ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) =20 # define DO_TEST_FAILURE(name, ...) \ DO_TEST_FULL(name, "", \ diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index fb438269b9..ca351a339a 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -21,6 +21,8 @@ #define VIR_FROM_THIS VIR_FROM_NONE =20 static virQEMUDriver driver; +static virCaps *linuxCaps; +static virCaps *macOSCaps; =20 enum { WHEN_INACTIVE =3D 1, @@ -32,13 +34,24 @@ enum { static int testXML2XMLCommon(const struct testQemuInfo *info) { + int rc; + if (testQemuInfoInitArgs((struct testQemuInfo *) info) < 0) return -1; =20 + if (info->args.hostOS =3D=3D HOST_OS_MACOS) + driver.caps =3D macOSCaps; + else + driver.caps =3D linuxCaps; + if (!(info->flags & FLAG_REAL_CAPS)) virQEMUCapsInitQMPBasicArch(info->qemuCaps); =20 - if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) + if (info->args.hostOS =3D=3D HOST_OS_MACOS) + rc =3D qemuTestCapsCacheInsertMacOS(driver.qemuCapsCache, info->qe= muCaps); + else + rc =3D qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCap= s); + if (rc < 0) return -1; =20 return 0; @@ -143,6 +156,13 @@ mymain(void) if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; =20 + /* By default, the driver gets a virCaps instance that's suitable for + * tests that expect Linux as the host OS. We create another one for + * macOS and keep around pointers to both: this allows us to later + * pick the appropriate one for each test case */ + linuxCaps =3D driver.caps; + macOSCaps =3D testQemuCapsInitMacOS(); + cfg =3D virQEMUDriverGetConfig(&driver); driver.privileged =3D true; =20 @@ -206,6 +226,11 @@ mymain(void) #define DO_TEST_NOCAPS(name) \ DO_TEST_FULL(name, "", WHEN_BOTH, ARG_END) =20 +#define DO_TEST_MACOS(name, ...) \ + DO_TEST_FULL(name, "", WHEN_BOTH, \ + ARG_HOST_OS, HOST_OS_MACOS, \ + ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST, ARG_END) + /* Unset or set all envvars here that are copied in qemudBuildCommandL= ine * using ADD_ENV_COPY, otherwise these tests may fail due to unexpected * values for these envvars */ diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index e48e449f02..a77d1e6fe6 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -870,6 +870,10 @@ testQemuInfoSetArgs(struct testQemuInfo *info, info->args.capsver =3D va_arg(argptr, char *); break; =20 + case ARG_HOST_OS: + info->args.hostOS =3D va_arg(argptr, int); + break; + case ARG_END: default: info->args.invalidarg =3D true; diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index a9202d2ae6..51139e6a97 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -47,6 +47,7 @@ typedef enum { ARG_PARSEFLAGS, ARG_CAPS_ARCH, ARG_CAPS_VER, + ARG_HOST_OS, ARG_END, } testQemuInfoArgName; =20 @@ -72,6 +73,7 @@ struct testQemuArgs { char *capsver; char *capsarch; int gic; + testQemuHostOS hostOS; bool invalidarg; }; =20 --=20 2.34.1 From nobody Sun Apr 28 20:44:41 2024 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=1642416983; cv=none; d=zohomail.com; s=zohoarc; b=WSycYBPq6rzT4oCDc0dBSW2qnEYm3d3sVtY47CanBC1df8GnBYcTfXLBjYh28ZPc8VB7N+vHfk8Y2UBJRPNKjmVk0O6qaRH0t7JcT1GO5AQfX1aiw/iVpi09fnaB/tL/9KLNIFe8s4YNXPA4+++BRprx6QEaPu5WEucL9uRpfcY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642416983; 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=hEZhA2mzaDBtCUqfXHEDHRfEacBtEzTwbkOltV9oGRw=; b=iZuRZB0QCw2IjPj9hMWMHOy4yCtqsrAQht10iW0QN2QoLSv3H73pa3LDMEVa4HxNUPXm41yPmiXMbcLJBX9iD0Gewr+l29Om1LG2rESBf4wRUP+q93bQlHQzDWdwlJDnaRT/ehq+5Ps9VJ3XHT4HXgGOYT3S7zDQpeorflGj5oo= 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 1642416983520425.4307156588909; Mon, 17 Jan 2022 02:56:23 -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-671-mCei1wKLOxaXb4akvvHGhQ-1; Mon, 17 Jan 2022 05:56:20 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1DE5E1966329; Mon, 17 Jan 2022 10:56:16 +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 F36D97CAD2; Mon, 17 Jan 2022 10:56:15 +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 BDDA84A708; Mon, 17 Jan 2022 10:56:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HArQOI009152 for ; Mon, 17 Jan 2022 05:53:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 20E1E1059A79; Mon, 17 Jan 2022 10:53:26 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.194.229]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 21D951059596; Mon, 17 Jan 2022 10:53:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642416982; 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=hEZhA2mzaDBtCUqfXHEDHRfEacBtEzTwbkOltV9oGRw=; b=IvVx4EO9IvhR70fu54PktSo0TuCaJUI0Qcior/Vq7ahRoDup4XHrome4beyaltaDCy/Jj4 wXns7bhhUdjIZE+DE5VeYL48I7zR41GgPf3llCSyKCK3PZat/qelel1QkNSHO7BMEzHVk3 TUTniWpmnxDJjGLW0q5E517pfNM3/Go= X-MC-Unique: mCei1wKLOxaXb4akvvHGhQ-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 15/20] tests: Add HVF test cases Date: Mon, 17 Jan 2022 11:52:55 +0100 Message-Id: <20220117105300.15759-16-abologna@redhat.com> In-Reply-To: <20220117105300.15759-1-abologna@redhat.com> References: <20220117105300.15759-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.12 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: 1642416985144100001 Content-Type: text/plain; charset="utf-8" We need to use a hardcoded list of capabilities because we don't yet have proper replies files obtained from QEMU running on actual macOS machines. Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Reviewed-by: Daniel P. Berrang=C3=A9 Tested-by: Christophe Fergeau --- .../hvf-aarch64-virt-headless.args | 48 +++++++++ .../hvf-aarch64-virt-headless.xml | 45 +++++++++ .../hvf-x86_64-q35-headless.args | 47 +++++++++ .../hvf-x86_64-q35-headless.x86_64-latest.err | 1 + .../hvf-x86_64-q35-headless.xml | 44 +++++++++ tests/qemuxml2argvtest.c | 18 ++++ .../hvf-aarch64-virt-headless.xml | 94 ++++++++++++++++++ .../hvf-x86_64-q35-headless.xml | 97 +++++++++++++++++++ tests/qemuxml2xmltest.c | 16 +++ 9 files changed, 410 insertions(+) create mode 100644 tests/qemuxml2argvdata/hvf-aarch64-virt-headless.args create mode 100644 tests/qemuxml2argvdata/hvf-aarch64-virt-headless.xml create mode 100644 tests/qemuxml2argvdata/hvf-x86_64-q35-headless.args create mode 100644 tests/qemuxml2argvdata/hvf-x86_64-q35-headless.x86_64-l= atest.err create mode 100644 tests/qemuxml2argvdata/hvf-x86_64-q35-headless.xml create mode 100644 tests/qemuxml2xmloutdata/hvf-aarch64-virt-headless.xml create mode 100644 tests/qemuxml2xmloutdata/hvf-x86_64-q35-headless.xml diff --git a/tests/qemuxml2argvdata/hvf-aarch64-virt-headless.args b/tests/= qemuxml2argvdata/hvf-aarch64-virt-headless.args new file mode 100644 index 0000000000..0f1eed66c2 --- /dev/null +++ b/tests/qemuxml2argvdata/hvf-aarch64-virt-headless.args @@ -0,0 +1,48 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-test/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-test/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-test/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-aarch64 \ +-name guest=3Dtest,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,file=3D/tmp/lib/domain--1-test= /master-key.aes \ +-machine virt,usb=3Doff,dump-guest-core=3Doff,gic-version=3D2 \ +-accel hvf \ +-drive file=3D/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.raw,if=3Dpfla= sh,format=3Draw,unit=3D0,readonly=3Don \ +-drive file=3D/var/lib/libvirt/qemu/nvram/test_VARS.fd,if=3Dpflash,format= =3Draw,unit=3D1 \ +-m 4096 \ +-realtime mlock=3Doff \ +-smp 2,sockets=3D2,cores=3D1,threads=3D1 \ +-uuid 1b826c23-8767-47ad-a6b5-c83a88277f71 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-test/monitor.so= ck,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc,driftfix=3Dslew \ +-no-shutdown \ +-boot strict=3Don \ +-device pcie-root-port,port=3D8,chassis=3D1,id=3Dpci.1,bus=3Dpcie.0,multif= unction=3Don,addr=3D0x1 \ +-device pcie-root-port,port=3D9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr= =3D0x1.0x1 \ +-device pcie-root-port,port=3D10,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr= =3D0x1.0x2 \ +-device pcie-root-port,port=3D11,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr= =3D0x1.0x3 \ +-device pcie-root-port,port=3D12,chassis=3D5,id=3Dpci.5,bus=3Dpcie.0,addr= =3D0x1.0x4 \ +-device pcie-root-port,port=3D13,chassis=3D6,id=3Dpci.6,bus=3Dpcie.0,addr= =3D0x1.0x5 \ +-device virtio-serial-pci,id=3Dvirtio-serial0,bus=3Dpci.2,addr=3D0x0 \ +-drive file=3D/var/lib/libvirt/images/test.qcow2,format=3Dqcow2,if=3Dnone,= id=3Ddrive-virtio-disk0 \ +-device virtio-blk-pci,bus=3Dpci.3,addr=3D0x0,drive=3Ddrive-virtio-disk0,i= d=3Dvirtio-disk0,bootindex=3D1 \ +-netdev user,id=3Dhostnet0 \ +-device virtio-net-pci,netdev=3Dhostnet0,id=3Dnet0,mac=3D52:54:00:9a:e6:c6= ,bus=3Dpci.1,addr=3D0x0 \ +-chardev pty,id=3Dcharserial0 \ +-serial chardev:charserial0 \ +-chardev socket,id=3Dcharchannel0,path=3D/tmp/channel/domain--1-test/org.q= emu.guest_agent.0,server=3Don,wait=3Doff \ +-device virtserialport,bus=3Dvirtio-serial0.0,nr=3D1,chardev=3Dcharchannel= 0,id=3Dchannel0,name=3Dorg.qemu.guest_agent.0 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.4,addr=3D0x0 \ +-object rng-random,id=3Dobjrng0,filename=3D/dev/urandom \ +-device virtio-rng-pci,rng=3Dobjrng0,id=3Drng0,bus=3Dpci.5,addr=3D0x0 \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/hvf-aarch64-virt-headless.xml b/tests/q= emuxml2argvdata/hvf-aarch64-virt-headless.xml new file mode 100644 index 0000000000..ef13820e17 --- /dev/null +++ b/tests/qemuxml2argvdata/hvf-aarch64-virt-headless.xml @@ -0,0 +1,45 @@ + + test + 1b826c23-8767-47ad-a6b5-c83a88277f71 + 4194304 + 4194304 + 2 + + hvm + /usr/share/edk2/aarch64/QEMU_= EFI-silent-pflash.raw + /var/lib/libvirt/qemu/nvram/test_VARS.fd + + + + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-aarch64 + + + + + + + + + + + + + + + + + /dev/urandom + + + diff --git a/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.args b/tests/qe= muxml2argvdata/hvf-x86_64-q35-headless.args new file mode 100644 index 0000000000..3e6fd7104f --- /dev/null +++ b/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.args @@ -0,0 +1,47 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-test/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-test/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-test/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dtest,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,file=3D/tmp/lib/domain--1-test= /master-key.aes \ +-machine q35,usb=3Doff,dump-guest-core=3Doff \ +-accel hvf \ +-m 4096 \ +-realtime mlock=3Doff \ +-smp 2,sockets=3D2,cores=3D1,threads=3D1 \ +-uuid 1b826c23-8767-47ad-a6b5-c83a88277f71 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-test/monitor.so= ck,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc,driftfix=3Dslew \ +-no-hpet \ +-no-shutdown \ +-boot strict=3Don \ +-device pcie-root-port,port=3D8,chassis=3D1,id=3Dpci.1,bus=3Dpcie.0,multif= unction=3Don,addr=3D0x1 \ +-device pcie-root-port,port=3D9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr= =3D0x1.0x1 \ +-device pcie-root-port,port=3D10,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr= =3D0x1.0x2 \ +-device pcie-root-port,port=3D11,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr= =3D0x1.0x3 \ +-device pcie-root-port,port=3D12,chassis=3D5,id=3Dpci.5,bus=3Dpcie.0,addr= =3D0x1.0x4 \ +-device pcie-root-port,port=3D13,chassis=3D6,id=3Dpci.6,bus=3Dpcie.0,addr= =3D0x1.0x5 \ +-device virtio-serial-pci,id=3Dvirtio-serial0,bus=3Dpci.2,addr=3D0x0 \ +-drive file=3D/var/lib/libvirt/images/test.qcow2,format=3Dqcow2,if=3Dnone,= id=3Ddrive-virtio-disk0 \ +-device virtio-blk-pci,bus=3Dpci.3,addr=3D0x0,drive=3Ddrive-virtio-disk0,i= d=3Dvirtio-disk0,bootindex=3D1 \ +-netdev user,id=3Dhostnet0 \ +-device virtio-net-pci,netdev=3Dhostnet0,id=3Dnet0,mac=3D52:54:00:9a:e6:c6= ,bus=3Dpci.1,addr=3D0x0 \ +-chardev pty,id=3Dcharserial0 \ +-device isa-serial,chardev=3Dcharserial0,id=3Dserial0,index=3D0 \ +-chardev socket,id=3Dcharchannel0,path=3D/tmp/channel/domain--1-test/org.q= emu.guest_agent.0,server=3Don,wait=3Doff \ +-device virtserialport,bus=3Dvirtio-serial0.0,nr=3D1,chardev=3Dcharchannel= 0,id=3Dchannel0,name=3Dorg.qemu.guest_agent.0 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.4,addr=3D0x0 \ +-object rng-random,id=3Dobjrng0,filename=3D/dev/urandom \ +-device virtio-rng-pci,rng=3Dobjrng0,id=3Drng0,bus=3Dpci.5,addr=3D0x0 \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.x86_64-latest.e= rr b/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.x86_64-latest.err new file mode 100644 index 0000000000..374992ce71 --- /dev/null +++ b/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.x86_64-latest.err @@ -0,0 +1 @@ +unsupported configuration: Emulator '/usr/bin/qemu-system-x86_64' does not= support virt type 'hvf' diff --git a/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.xml b/tests/qem= uxml2argvdata/hvf-x86_64-q35-headless.xml new file mode 100644 index 0000000000..cad560e9ca --- /dev/null +++ b/tests/qemuxml2argvdata/hvf-x86_64-q35-headless.xml @@ -0,0 +1,44 @@ + + test + 1b826c23-8767-47ad-a6b5-c83a88277f71 + 4194304 + 4194304 + 2 + + hvm + + + + + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-x86_64 + + + + + + + + + + + + + + + + + /dev/urandom + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b10850dcce..2724ef806b 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3509,6 +3509,24 @@ mymain(void) =20 DO_TEST_CAPS_LATEST("devices-acpi-index"); =20 + DO_TEST_MACOS("hvf-x86_64-q35-headless", + QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, + QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, + QEMU_CAPS_DEVICE_VIRTIO_NET, + QEMU_CAPS_DEVICE_ISA_SERIAL, + QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + DO_TEST_MACOS("hvf-aarch64-virt-headless", + QEMU_CAPS_OBJECT_GPEX, + QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, + QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, + QEMU_CAPS_DEVICE_VIRTIO_NET, + QEMU_CAPS_DEVICE_PL011, + QEMU_CAPS_DEVICE_VIRTIO_RNG, + QEMU_CAPS_OBJECT_RNG_RANDOM); + /* HVF guests should not work on Linux with KVM */ + DO_TEST_CAPS_LATEST_PARSE_ERROR("hvf-x86_64-q35-headless"); + if (getenv("LIBVIRT_SKIP_CLEANUP") =3D=3D NULL) virFileDeleteTree(fakerootdir); =20 diff --git a/tests/qemuxml2xmloutdata/hvf-aarch64-virt-headless.xml b/tests= /qemuxml2xmloutdata/hvf-aarch64-virt-headless.xml new file mode 100644 index 0000000000..b5193a02b4 --- /dev/null +++ b/tests/qemuxml2xmloutdata/hvf-aarch64-virt-headless.xml @@ -0,0 +1,94 @@ + + test + 1b826c23-8767-47ad-a6b5-c83a88277f71 + 4194304 + 4194304 + 2 + + hvm + /usr/share/edk2/aarch64/QEMU_= EFI-silent-pflash.raw + /var/lib/libvirt/qemu/nvram/test_VARS.fd + + + + + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-aarch64 + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + +
+ +