From nobody Thu May 2 20:58:26 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=1642787724; cv=none; d=zohomail.com; s=zohoarc; b=Nubp4btR/k5wd7QE2/M+8cX2zZ0DJYyOUPpEKvLvTASFKmQARjCCO35+Yl8vqjdZ2tKRWGEx8lC0xWlq/x3CIFjgbWMuPz+/VdUiSLKEhH9wodE+JJ0wF4YxGJM7eJM89VB/SEMnH9+tqSB9TVrgIvP8Y4rlvlEJY5+YS738GDU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642787724; 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=EVRk72UAJwUV5Ex7K/2AdD/xOxbKKBeYAhhpfCt9znI=; b=VS2gVxafMaStzWOj3IMs6ErBNfT4YVwwXV7hbdKbAB25DZkDHxN7sLSMQx4zbHwLX9v2tBrM2tVzeKD/nJVcywt8jPIIWGbFrk34pAftqov57dP7CdyWwKNR8eFiClufCcA5RY67gLQmbsRIDkHRNp5HYV4C946g2YkljDRR//M= 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 1642787724680847.0092880034451; Fri, 21 Jan 2022 09:55:24 -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-590-By6sTTHxPgK01OGoPqO_pA-1; Fri, 21 Jan 2022 12:55:20 -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 22091100C66A; Fri, 21 Jan 2022 17:55:14 +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 D7E851017E27; Fri, 21 Jan 2022 17:55:13 +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 803A94BB7C; Fri, 21 Jan 2022 17:55:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LHt8dS005537 for ; Fri, 21 Jan 2022 12:55:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 14F3F84D25; Fri, 21 Jan 2022 17:55:08 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4571F84D19; Fri, 21 Jan 2022 17:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642787723; 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=EVRk72UAJwUV5Ex7K/2AdD/xOxbKKBeYAhhpfCt9znI=; b=fMNv4Mg7kpXJN9bsEd0VtE88zhP1iwpgu9NXlZmvPaGBLujdU9P+SGblhzfS3jrZ6yG3le kJiJsKo91I8me6UCqTsROdB6l/d1tjBOkq5wd9HVP0kzD1hG2njQkwZ4pGEgjJHFUaKZJp EGcXZ5xa46DZTgDvvLlnvLXFn8OyV5k= X-MC-Unique: By6sTTHxPgK01OGoPqO_pA-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v7 01/18] qemu: Only probe KVM on Linux Date: Fri, 21 Jan 2022 18:54:41 +0100 Message-Id: <20220121175458.162675-2-abologna@redhat.com> In-Reply-To: <20220121175458.162675-1-abologna@redhat.com> References: <20220121175458.162675-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 1642787725020100003 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 Tested-by: Christophe Fergeau Reviewed-by: Ani Sinha Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 336f0bab2e..82cf6bbfd8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -9239,6 +9239,12 @@ qemuProcessQMPInit(qemuProcessQMP *proc) } =20 =20 +#if defined(__linux__) +# define hwaccel "kvm:tcg" +#else +# define hwaccel "tcg" +#endif + static int qemuProcessQMPLaunch(qemuProcessQMP *proc) { @@ -9249,7 +9255,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 Thu May 2 20:58:26 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=1642787789; cv=none; d=zohomail.com; s=zohoarc; b=EY9PwFTB/Zsxf7ah7Nq0vURvWBeR/zjLUc/6ZvGGGYqgeZ5zWyv23ZifEJ6cjwVTagmM8yPq7KY4KFXS2e9IRkdrTKnQRlEKjxBjN/nfQcIRtCUdXqnmOKEnL1tqlTNcjUGG29agzctASM0EgMxm4/ofwpGA52QJ097LFyBx38A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642787789; 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=0WkhysaDfyya+a4UbMBjsitT+gizQYlZdDVBqIP0x4U=; b=W1zZTWXqTHc5ob04HZv91YvNQd1SYZ3efDdfpOFumQeJ3Gm8lSuT90pLAHglAO0auKy1VP/A0p3WxJymbs67FoagSGwtpuxzCIGQmuxfRjj9TWe410svWgj3RiNJLADnrW+2AkxrjB9f5VlQTJGWbX7ux+wt2/vzoeK93sg6l+c= 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 1642787789720215.11208160474973; Fri, 21 Jan 2022 09:56:29 -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-561-IfJFYXlnPfqP_MZUMtHizQ-1; Fri, 21 Jan 2022 12:56:27 -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 345B146863; Fri, 21 Jan 2022 17:56:22 +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 158F184D31; Fri, 21 Jan 2022 17:56:22 +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 DBA994A711; Fri, 21 Jan 2022 17:56:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LHt9nr005548 for ; Fri, 21 Jan 2022 12:55:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 42F7884D19; Fri, 21 Jan 2022 17:55:09 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7430284D29; Fri, 21 Jan 2022 17:55:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642787788; 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=0WkhysaDfyya+a4UbMBjsitT+gizQYlZdDVBqIP0x4U=; b=gYHcKUVO1sTVIq9nHFluHKshZ3efJzVbGrnw1FMN+TD30mi2+jTNzXSLH+txI06a1Io/sS DeXF8NOPtHAkf0nVaD6LISoPKwhayiGuTN2gk5tjR43Xdv0uD98GRqJAnQIUlWehLWHBRJ goTCQfE0GZh4JQnjMFS8czHcuMWeHIE= X-MC-Unique: IfJFYXlnPfqP_MZUMtHizQ-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v7 02/18] qemu: Add KVM CPUs into cache only if KVM is present Date: Fri, 21 Jan 2022 18:54:42 +0100 Message-Id: <20220121175458.162675-3-abologna@redhat.com> In-Reply-To: <20220121175458.162675-1-abologna@redhat.com> References: <20220121175458.162675-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 1642787791687100001 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 Tested-by: Christophe Fergeau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 461a818776..40c68e200f 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4411,8 +4411,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) @@ -4421,7 +4424,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) @@ -4654,7 +4658,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++) { @@ -5508,7 +5513,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 Thu May 2 20:58:26 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=1642787735; cv=none; d=zohomail.com; s=zohoarc; b=Pg4xCrkMxx1Fk+6/phJmBalGHOVHHXFVpKLA/1oy8Rhors9nJ2+Xzn/5+6a2lxn9UpZdxSdVCRAfhmotCEPBcfAwS3rHPkALar5e0fZ5omF0yQAz2b39EAytHGW0sLhjGk8goYsoeHajv8FzxrP6GMlAUf8q1DGQdsznFyT4+JY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642787735; 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=NP9lXCsVsmUxrPn0dM+5eiThEMhz9pE0Tf5X5KBeUds=; b=H9HaYERxEshfXjix8qQm20wj47rUF8kaxXa7zTb0NM3ZkgY6NtiaYKW8Ax6x8pH3QqaMaIiyXPi1uaFjKecUE28b5k466fJzda6tgyPX4A8Rwhtcymdl8W1NpIUZIERKH/oQaFQ1BXe5u18bzeE0vSFUTb4ARxvM3Me8H/UPIgk= 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 1642787735556964.4734979833881; Fri, 21 Jan 2022 09:55:35 -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-336-ObmmCZhXPB68mXbN5yfXcQ-1; Fri, 21 Jan 2022 12:55:32 -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 91EC946862; Fri, 21 Jan 2022 17:55:27 +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 7237210A48D1; Fri, 21 Jan 2022 17:55:27 +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 0ED971809CBA; Fri, 21 Jan 2022 17:55:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LHtF4C005565 for ; Fri, 21 Jan 2022 12:55:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id B577484D25; Fri, 21 Jan 2022 17:55:15 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E61BC84D19; Fri, 21 Jan 2022 17:55:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642787734; 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=NP9lXCsVsmUxrPn0dM+5eiThEMhz9pE0Tf5X5KBeUds=; b=Z8euNajY6kf7NJoAz6hxnARaflwJ0+GV1FsmupUjUCXo/gWQDEJMbYVZFZbqb+XPcMOSOS hs1bfodIpEllrVR7l9uCrsM1g+jr/FvOmFvygcYJQI3bUf3S0omDFJTD/tCJK4H9sP1nBq OtzXNgEd34fYXtWLWivsI3E0i3Yvfqw= X-MC-Unique: ObmmCZhXPB68mXbN5yfXcQ-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v7 03/18] conf: Add hvf domain type Date: Fri, 21 Jan 2022 18:54:43 +0100 Message-Id: <20220121175458.162675-4-abologna@redhat.com> In-Reply-To: <20220121175458.162675-1-abologna@redhat.com> References: <20220121175458.162675-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 1642787736827100001 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 Tested-by: Christophe Fergeau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 acd9020830..477e775229 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 b39136119f..f5b15cff33 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 3e63d2513b..7770badf5b 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 662d15e28e..ecc28f15b2 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7215,6 +7215,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 Thu May 2 20:58:26 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=1642787795; cv=none; d=zohomail.com; s=zohoarc; b=UFoSktt+9zen5yCih//cMExkA5kZQFjPxi8yE/W2uIP6HtzHyyXh492M6GlzV4pi1jiTOkIorWdZXg45ausYNiN6rxvUemcizAvuTt5F9xrhr7XEzZnbhZdlyd+kLPsEEjeCQgTGtEbfoETTqXkLDeWwrFp9Wkw2UflfSBd9Jew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642787795; 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=1izP4CcJw0kxUjweZDwHMLLBJ1CREzBUuFemETk32Fs=; b=cZTwxfaZNTi91FquyCBmpVodve5WboxVT9WRNqnhtLO3xHGC5RLAomlQwPzKhS2iB4btXA0WwGxZKahSp9Jw2ioI8SI5+12ISuahJO8H2BUnCw7G8+6zfjQv4+HJDjaqKx4eBE9OGOxZtg352cDS1IQltqBwLqLd0jBiFXQSMw8= 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 1642787795033617.4755324827195; Fri, 21 Jan 2022 09:56:35 -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-55-E8RCdyuePsC8Mm_7yWgs_A-1; Fri, 21 Jan 2022 12:56:30 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 57B9B46864; Fri, 21 Jan 2022 17:56: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 0AB7034941; Fri, 21 Jan 2022 17:56:25 +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 CFBBD4A715; Fri, 21 Jan 2022 17:56:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LHtGBO005573 for ; Fri, 21 Jan 2022 12:55:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id E656284D25; Fri, 21 Jan 2022 17:55:16 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 213A884D19; Fri, 21 Jan 2022 17:55:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642787794; 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=1izP4CcJw0kxUjweZDwHMLLBJ1CREzBUuFemETk32Fs=; b=EAj+lHsDxITvvlNWKVfkFMD1VrVH319X9W0vKPdCZWDrZRwHtur6w/L31oVxALnbrHLQeH MsWMr+dnk7BPlSRojCu+N7O8d7r5q4NAaj7nKAgQroqSFwuGMZLxu100sQ10k+Mjgff4Hw Fvyy191XZiUk5kq4PLGiQrGDjceZRX8= X-MC-Unique: E8RCdyuePsC8Mm_7yWgs_A-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v7 04/18] qemu: Define hvf capability Date: Fri, 21 Jan 2022 18:54:44 +0100 Message-Id: <20220121175458.162675-5-abologna@redhat.com> In-Reply-To: <20220121175458.162675-1-abologna@redhat.com> References: <20220121175458.162675-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.23 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: 1642787796922100001 From: Roman Bolshakov Signed-off-by: Roman Bolshakov Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Tested-by: Christophe Fergeau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 40c68e200f..994dc3dad2 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 7d42e3a714..c6fb87a73a 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 Thu May 2 20:58:26 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=1642787798; cv=none; d=zohomail.com; s=zohoarc; b=SjWc3/w8e/Vtlb522FmusboElXzUb8C8g0tswT7SHiYE00uIBfeegGv2rYOzmiFFZX2wvJNJ5I/46wfexHi2YQyCotlY7EMO3VnIm21u0UJOg4KmEa4rWU//Atm/K5Upy/QzDyzpcCzaUXE9wj96fdD5djxAqcKSiyexz/lha90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642787798; 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=n5Pzdyu4ozj5DlrxkhV3/LrQE1zN+IlWdFuaeSxBL8Q=; b=fjdAR7rGgag076qIPXyqop0GGzQ1mrzEugxM6L1Ml9DgknIpFCb0RXMYl0sKPTHT0pXQ9et8C0DGG2qXJEvLdYVUfJB7o9PAYSQaw08sYDWW/HuI2cse0uTpymmumm/eSmdE79RWB5euHnr+OjdiaZi6xK3scGgCxU1JCkA6f5Y= 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 1642787798957740.413016527225; Fri, 21 Jan 2022 09:56:38 -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-283-a3-38VkmPaOEwc3HarZJQg-1; Fri, 21 Jan 2022 12:56:33 -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 3CF918144E6; Fri, 21 Jan 2022 17:56:28 +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 1CD2177C96; Fri, 21 Jan 2022 17:56:28 +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 E22A71806D2F; Fri, 21 Jan 2022 17:56:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LHtIoc005584 for ; Fri, 21 Jan 2022 12:55:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2271384D25; Fri, 21 Jan 2022 17:55:18 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51E1984D19; Fri, 21 Jan 2022 17:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642787798; 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=n5Pzdyu4ozj5DlrxkhV3/LrQE1zN+IlWdFuaeSxBL8Q=; b=bMrBsax4aCUu8Tr4+NX28FQPzKbtMyBO2SQ+Frs71eROL9Wwq/0Wr2TjtylbDi8jk46+pA xK+IB/qbftmwy4nvLJ0k1rwaw+t5ZGSzxA7CapsRGnl1etlXST6ebh+ScwhFFyH/DXi/Pq gKWD+ruIk88ejwvJ6vGD+Og51GrL93M= X-MC-Unique: a3-38VkmPaOEwc3HarZJQg-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v7 05/18] qemu: Query hvf capability on macOS Date: Fri, 21 Jan 2022 18:54:45 +0100 Message-Id: <20220121175458.162675-6-abologna@redhat.com> In-Reply-To: <20220121175458.162675-1-abologna@redhat.com> References: <20220121175458.162675-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 1642787799941100001 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 Tested-by: Christophe Fergeau Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_capabilities.c | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 994dc3dad2..d01be3e892 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 @@ -3192,6 +3196,42 @@ virQEMUCapsProbeQMPKVMState(virQEMUCaps *qemuCaps, return 0; } =20 +#ifdef __APPLE__ +static int +virQEMUCapsProbeHVF(virQEMUCaps *qemuCaps) +{ + int hv_support =3D 0; + size_t len =3D sizeof(hv_support); + virArch hostArch =3D virArchFromHost(); + + /* 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) + return 0; + + if (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; @@ -5333,6 +5373,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 Thu May 2 20:58:26 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=1642787801; cv=none; d=zohomail.com; s=zohoarc; b=h6It3sOIsVsyEi34nRTMZAr9OC3M8M2bcnkoMisJCBSirGxQllZXsL6kNSbFwEhOky9wcsu7PNmLe/2wwFL9dphDOHVo6XPIjQU3nVUF7in1hhWYG6oXYy/f/T/pS8cQBPI5TLfwJ5nAIeYPIpI27WvvilN5zpJZsELufn9olIk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642787801; 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=SPoweZmBgs1JjR1MT6tnqufChk08v0ZaqAI+/fwfLb8=; b=UxG8CS1VdZps3fdkQKFq1xTS8UDyT7w1K/3uaVldSTvwseGHchIdT7epCprBT8Ctp3719U9b3/6o/uAwjCVFoDEpWUkSwC2VYi7LnSDFK9dUs725DirG/KXctuiYuz2EyR1ok3ojwbUvaGkaO6BeALG0kfC0VK6vs3AAeNezMmA= 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 1642787801399530.7033498212992; Fri, 21 Jan 2022 09:56:41 -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-135-qUhnv95oPKCho8_g7iI2NQ-1; Fri, 21 Jan 2022 12:56:38 -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 287288144E1; Fri, 21 Jan 2022 17:56:31 +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 0771084D2C; Fri, 21 Jan 2022 17:56:31 +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 CC384180474A; Fri, 21 Jan 2022 17:56:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LHtJ23005594 for ; Fri, 21 Jan 2022 12:55:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5452584D19; Fri, 21 Jan 2022 17:55:19 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 82C3B84D27; Fri, 21 Jan 2022 17:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642787800; 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=SPoweZmBgs1JjR1MT6tnqufChk08v0ZaqAI+/fwfLb8=; b=XNmhV/0Mtv5S0kFhHpbwjzF9qohabEn2Mt0w50sNbY2ozJjgQBSSU77QoJdMblgBsjTjd6 EtKheKsQw3a6E9AZV6HQMY0KTNO6Bitq4xbSe5bw74iuqTVOQ7dCtUqyvj7fua3i0nqLoa Wcirhkg90aHfW8/1rRuC8SnlAfqnIYc= X-MC-Unique: qUhnv95oPKCho8_g7iI2NQ-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v7 06/18] qemu: Expose hvf domain type if hvf is supported Date: Fri, 21 Jan 2022 18:54:46 +0100 Message-Id: <20220121175458.162675-7-abologna@redhat.com> In-Reply-To: <20220121175458.162675-1-abologna@redhat.com> References: <20220121175458.162675-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 1642787802158100005 From: Roman Bolshakov Signed-off-by: Roman Bolshakov Signed-off-by: Andrea Bolognani Tested-by: Brad Laue Tested-by: Christophe Fergeau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 d01be3e892..dac9fa11fc 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 Thu May 2 20:58:26 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=1642787739; cv=none; d=zohomail.com; s=zohoarc; b=QeeLkty1qJZPbuoGCQlyOHYc1ob4S9F46oCSWDLvhVrsIiMpJw04IumZhO9XwWTDWotVpqMbWC72rr0jregUlV7GDO7VdpgxdxgIG29mKh/V8bXqhgqCcnLeYZKj98YvVtVEt0TvOtEeZtQT8mbIDMzh8eRy6PlT+KrATfWtNOY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642787739; 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=TOOxztr1nuL/mXKwBDPZIHvKqCE3Ha8/3on3XC1fpqc=; b=mTbrgRvHou8E9xbLa6t//TCE4tr/KQtzpY7JYmi2XZnz/h8iZGtStHtFwPLzi2ar65G/LgHGuMOUDwZ/oq5B6HK6o8jVl1M1ZH01XAkZetP8YN1j5m+RRVtRlfjzTVinFofleOqrdHya+7NnKOveZjxue8CQu1Z6cv7EByiyciE= 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 1642787739718631.6386453957953; Fri, 21 Jan 2022 09:55:39 -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-672-JzSBJh-sNDWleZmjD4FOPA-1; Fri, 21 Jan 2022 12:55:35 -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 42B8F8144E6; Fri, 21 Jan 2022 17:55:30 +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 25D0277CB2; Fri, 21 Jan 2022 17:55:30 +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 E63DE1802E34; Fri, 21 Jan 2022 17:55:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LHtL71005605 for ; Fri, 21 Jan 2022 12:55:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6F78E84D25; Fri, 21 Jan 2022 17:55:21 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9FF2384D2B; Fri, 21 Jan 2022 17:55:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642787738; 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=TOOxztr1nuL/mXKwBDPZIHvKqCE3Ha8/3on3XC1fpqc=; b=VcO+JTxAcjCbBdOCHd6cKY9HfIlO99GMyt+Px13QJLVfnNn7dTXAzAipcCNWZoTCybu33h HTkmasFsGN4rtkL4mGdyBi/zX2ErZ9jMK9P4NxeXq0FOv9uqJdlIhjmdkQLNHPAAXb2tLL 2N8yOQapb27R/65v/DTcA5e1RPTdB0U= X-MC-Unique: JzSBJh-sNDWleZmjD4FOPA-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v7 07/18] qemu: Introduce virQEMUCapsAccelStr Date: Fri, 21 Jan 2022 18:54:47 +0100 Message-Id: <20220121175458.162675-8-abologna@redhat.com> In-Reply-To: <20220121175458.162675-1-abologna@redhat.com> References: <20220121175458.162675-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642787741268100002 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 Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 dac9fa11fc..f27d2fd241 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -839,6 +839,16 @@ virQEMUCapsFindTarget(virArch hostarch, } =20 =20 +static const char * +virQEMUCapsAccelStr(virDomainVirtType type) +{ + if (type =3D=3D VIR_DOMAIN_VIRT_KVM) + return "kvm"; + + return "tcg"; +} + + static virQEMUCapsAccel * virQEMUCapsGetAccel(virQEMUCaps *qemuCaps, virDomainVirtType type) @@ -4067,7 +4077,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; @@ -4620,7 +4630,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 Thu May 2 20:58:26 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=1642787739; cv=none; d=zohomail.com; s=zohoarc; b=VMhSC/M4EzZOh0fzXk2CBJrLlxupWCaoLbx5JQpmPnCiZNZXVcVHsOGfNji/w4h2uu837fX2rZpU7I82MuOfJAAJ5fSpIbbdWEgw/3yQWlh2n83Zmp6FiZBYqEJgmhkDteOK3OPfU0BxfvpFAe2HB069hgQifklgF+YX2+0n4so= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642787739; 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=5QpJqHGzF1CbJWcY1G+K/QzflspIR3j36jzFFpNhY2s=; b=VIF+4cSJsNbeM9ScZbuC72KiCeymtuKJz8jRb/aDfdF6ES0K0t9waTfEKfH0WoHaxx3B36Nle1DJt4l+9/bvtwspqqrPSGY42PaYwFFVIBiL/AI/uF7AqqkZ+iD47G+6gpfkIMzY4CLvOKuh1skSKdPJRU/F8mtrL5gi/ONEVjc= 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 1642787739550154.7765087711947; Fri, 21 Jan 2022 09:55:39 -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-670-4KQvfij3Mde_fIvRZ-GD7A-1; Fri, 21 Jan 2022 12:55:34 -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 0BA27100C665; Fri, 21 Jan 2022 17:55:30 +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 DD58E66E1B; Fri, 21 Jan 2022 17:55:29 +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 9BC964A7CA; Fri, 21 Jan 2022 17:55:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LHtMTr005616 for ; Fri, 21 Jan 2022 12:55:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9F87084D2A; Fri, 21 Jan 2022 17:55:22 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CEB8B84D29; Fri, 21 Jan 2022 17:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642787738; 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=5QpJqHGzF1CbJWcY1G+K/QzflspIR3j36jzFFpNhY2s=; b=CbliQGUir5ZuNviQmtn85J0w3uMC98wPk71tcLPxt38WWen4IYVfb3iiumbNqla+Y0xBWr UQvLP+eIkh5wGEIFgiwwjLTrii+XOYhUJNMOxhlEMy8w58Ko8HcYhlG4F3uVA+MfBc7WA6 iI5mZUuqCvmnuFAGUrjIfl16nAl9lEk= X-MC-Unique: 4KQvfij3Mde_fIvRZ-GD7A-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v7 08/18] qemu: Introduce virQEMUCapsTypeIsAccelerated Date: Fri, 21 Jan 2022 18:54:48 +0100 Message-Id: <20220121175458.162675-9-abologna@redhat.com> In-Reply-To: <20220121175458.162675-1-abologna@redhat.com> References: <20220121175458.162675-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 1642787741232100001 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 Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 f27d2fd241..61b674b89f 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -839,6 +839,13 @@ virQEMUCapsFindTarget(virArch hostarch, } =20 =20 +static bool +virQEMUCapsTypeIsAccelerated(virDomainVirtType type) +{ + return type !=3D VIR_DOMAIN_VIRT_QEMU; +} + + static const char * virQEMUCapsAccelStr(virDomainVirtType type) { @@ -2339,7 +2346,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: @@ -3001,7 +3008,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; @@ -3721,7 +3728,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; @@ -5846,10 +5853,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 Thu May 2 20:58:26 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=1642787830; cv=none; d=zohomail.com; s=zohoarc; b=T8VrNLF9gmxo5mHrVDyVDcgt3hGObeFw3/EAfILRPr8LZ00ixPIxLIuPlkOkDplRhhdrx/n1hmuIrgGmqlkj59Ski+lfNNiH7t/A4RKMMaOdXJeIRaQieZCXghahkR0CAVLivCDEy+iNbDKXlaj6zt+os611IuOwo9sUAPiU3FI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642787830; 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=3n/9SnYSV8RX/mcX29S34JgO4ExvcT0h4wQCxhWqRdI=; b=HhVBtEod4d+zrejfD6wgn1Lrlf75kIjIrWrCD/D+7jJyOSz2klh9yPQdSpwYJYrZRUZMgOECp2sqtT8vbkwPxEoraNjLwegrpyevt4V8kepucnkOAUtmVjTGN5Z5mawzR+LdSveOuukD4sjGG4U7VTKJR6vRGEzv3QgWufNP6so= 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 1642787830451306.9323448057444; Fri, 21 Jan 2022 09:57:10 -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-423-P6ScKGvmOlWYACsJyq9MlQ-1; Fri, 21 Jan 2022 12:56:39 -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 8BEA6100C66F; Fri, 21 Jan 2022 17:56:33 +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 6AFEF7ED83; Fri, 21 Jan 2022 17:56:33 +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 3A6AE4A717; Fri, 21 Jan 2022 17:56:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LHtRVm005633 for ; Fri, 21 Jan 2022 12:55:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3ED2E84D29; Fri, 21 Jan 2022 17:55:27 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6F49084D2D; Fri, 21 Jan 2022 17:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642787829; 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=3n/9SnYSV8RX/mcX29S34JgO4ExvcT0h4wQCxhWqRdI=; b=H+jDuq08SxaN4UkBHxQypLzkmYcUBva/elYMIGoQ/FGPqElOh96oNcArW1eaw3dM7Ck0GY 5Yl13F3HWO2SrSkMzQ+fRXHn/vo7wUl1apa0VPNBvRr0Un8h82ltnoUzJQv15aNelns5kE hL9xGCHUiGNxVJe9bsIaAqI6U3sNxgU= X-MC-Unique: P6ScKGvmOlWYACsJyq9MlQ-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v7 09/18] qemu: Introduce virQEMUCapsHaveAccel Date: Fri, 21 Jan 2022 18:54:49 +0100 Message-Id: <20220121175458.162675-10-abologna@redhat.com> In-Reply-To: <20220121175458.162675-1-abologna@redhat.com> References: <20220121175458.162675-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642787831022100001 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 Tested-by: Christophe Fergeau Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_capabilities.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 61b674b89f..bb5744cd6b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -846,6 +846,13 @@ virQEMUCapsTypeIsAccelerated(virDomainVirtType type) } =20 =20 +static bool +virQEMUCapsHaveAccel(virQEMUCaps *qemuCaps) +{ + return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM); +} + + static const char * virQEMUCapsAccelStr(virDomainVirtType type) { @@ -5019,7 +5026,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')", @@ -5053,7 +5060,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 " @@ -5518,7 +5527,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; @@ -5582,13 +5591,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 Thu May 2 20:58:26 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=1642787807; cv=none; d=zohomail.com; s=zohoarc; b=W/P6VcfTO+P5liWYCroUFvHIBtFLZJ5MfI826M7WvScFLcFIV01ihdMOGDiU7JP6EnPJa4anDgK0nXDO44iG9gtv58s4+HP/wHIsxnGOyUTB8RbptvtPGLPpZzn1i4fxMfaM2fLBwvyd8XMXAqwDWvO6sNE+w7pa09GKbRfEWyI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642787807; 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=3PuaXzt3VMiZ9oLt0xXXNt5GQJU4oS9+eZrKQZOw++Q=; b=fjH5GPg7QVVUUbBlrE7G/VTGlStUw5VtcLQrcvH+Dvk339LPfzVtE2vlp465JRlbj7L16dx4JzClX8hR20FNDw124jNw6gBD4A/nGJnKUg5OBNd9bao5k9or8JJ8W1UiaGcuZXGBah/c7K5DDwqOQORZx1RYxcZor+tOO610cG8= 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 1642787807839202.30049429170788; Fri, 21 Jan 2022 09:56: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-306-u8M6FcGqOE21Pe2at837lA-1; Fri, 21 Jan 2022 12:56:43 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C10EC83DE79; Fri, 21 Jan 2022 17:56:36 +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 2C16666E1F; Fri, 21 Jan 2022 17:56:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E5D3118033AE; Fri, 21 Jan 2022 17:56:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LHtSOo005641 for ; Fri, 21 Jan 2022 12:55:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6EEF584D30; Fri, 21 Jan 2022 17:55:28 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9E52A84D2F; Fri, 21 Jan 2022 17:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642787806; 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=3PuaXzt3VMiZ9oLt0xXXNt5GQJU4oS9+eZrKQZOw++Q=; b=XIxZncc7Qyc4f5tkWYiQSPYKYOlKW2YsiM/xuLJQM2xZy4nOLGg5mpyh/NBbcKN9p9UDH7 JVFwQBjSFE8FSelNjTkedVmwJqBfeznZHJsT4DKdeDGEG2Ygy94bdpMdYFACDds92cr0hk 5T2fGoBVwgXn7MoQGzGWrDLVP1Px3N4= X-MC-Unique: u8M6FcGqOE21Pe2at837lA-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v7 10/18] qemu: Correct CPU capabilities probing for hvf Date: Fri, 21 Jan 2022 18:54:50 +0100 Message-Id: <20220121175458.162675-11-abologna@redhat.com> In-Reply-To: <20220121175458.162675-1-abologna@redhat.com> References: <20220121175458.162675-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642787809236100001 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 Tested-by: Christophe Fergeau Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_capabilities.c | 34 ++++++++++++++++++++++++++++++++-- src/qemu/qemu_process.c | 2 ++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index bb5744cd6b..dae9d1163d 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 @@ -849,7 +850,8 @@ virQEMUCapsTypeIsAccelerated(virDomainVirtType type) static bool virQEMUCapsHaveAccel(virQEMUCaps *qemuCaps) { - return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM); + return virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_HVF); } =20 =20 @@ -858,6 +860,8 @@ virQEMUCapsAccelStr(virDomainVirtType type) { if (type =3D=3D VIR_DOMAIN_VIRT_KVM) return "kvm"; + else if (type =3D=3D VIR_DOMAIN_VIRT_HVF) + return "hvf"; =20 return "tcg"; } @@ -869,6 +873,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 +1005,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 @@ -2013,6 +2021,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 @@ -2066,6 +2075,7 @@ void virQEMUCapsDispose(void *obj) virSEVCapabilitiesFree(qemuCaps->sevCapabilities); =20 virQEMUCapsAccelClear(&qemuCaps->kvm); + virQEMUCapsAccelClear(&qemuCaps->hvf); virQEMUCapsAccelClear(&qemuCaps->tcg); } =20 @@ -2317,6 +2327,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; @@ -2794,7 +2808,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 @@ -4484,6 +4500,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 @@ -4495,6 +4515,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) @@ -4729,6 +4751,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++) { @@ -5351,6 +5375,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 @@ -5589,6 +5616,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)) { @@ -6583,5 +6612,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 82cf6bbfd8..b8c70da566 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -9241,6 +9241,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 Thu May 2 20:58:26 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=1642787808; cv=none; d=zohomail.com; s=zohoarc; b=CPDcOwjkh5WV0LEoUVW46Is7+J+jfoirzTSB99SQi7FRgH13KHwZKApUgzU9EP8SGaEuJdo2+/xH5QtnVn+yzzEsrTJFOpdx8Q6pf+z4n8yrN8SuVseAecIOoSlcqvcr/f/Vvcne3YNiBRfu+EEHC9nSfE+YvgLv/ijfHmoR754= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642787808; 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=OPHZ/6BCiBXUYVwULnxLyRJr4NWrTv+lC/h2iscHZYo=; b=Z/bvm9j6vRkkldIVqtLaOdzrpwBJtVoePsNSMf20Zj0pXg3ryjHf360FSQ7TzxB8fWH1S1zmEC2UkjvU0wLWDYy0gF1i1CoYlGSh4jgrC08jHJjBxiKHFr7ISxkB//+K82OKoiIyVRoyTnCUQbw/fDVim8o1P8A37sgMUNWnBog= 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 1642787808172761.1023301049934; Fri, 21 Jan 2022 09:56:48 -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-252-HbLaq5PjOHOMRivBeHPDKQ-1; Fri, 21 Jan 2022 12:56:45 -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 586C684BA4E; Fri, 21 Jan 2022 17:56:40 +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 367877DE2E; Fri, 21 Jan 2022 17:56: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 034101802FEB; Fri, 21 Jan 2022 17:56:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LHtTC5005660 for ; Fri, 21 Jan 2022 12:55:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9E3AC84D25; Fri, 21 Jan 2022 17:55:29 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CEB5084D32; Fri, 21 Jan 2022 17:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642787807; 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=OPHZ/6BCiBXUYVwULnxLyRJr4NWrTv+lC/h2iscHZYo=; b=hT67uT1oxjbTc1c/+e7rBDYsOBVie+pYXYBuP9C0Hh50Vk7131i7YoHFJdj2FheoMfmxiB sfCD+CvjhonSEJORR82Mr3G+zBB31wnbTBetImXRZaf48AKN3iisT3SBsA2s4x0yUVqD8o nWR8m1Cw9pPcjLjJ07bhWpmNNXcfh0U= X-MC-Unique: HbLaq5PjOHOMRivBeHPDKQ-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v7 11/18] tests: Introduce testQemuHostOS Date: Fri, 21 Jan 2022 18:54:51 +0100 Message-Id: <20220121175458.162675-12-abologna@redhat.com> In-Reply-To: <20220121175458.162675-1-abologna@redhat.com> References: <20220121175458.162675-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: r.bolshakov@yadro.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642787809313100003 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 Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 Thu May 2 20:58:26 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=1642787765; cv=none; d=zohomail.com; s=zohoarc; b=kzSQeobSbri4qLIZbuEY6WPJZG0RTC7BJ7bIKiGKwGW1/sv0AC5XGok8kFMscJY1UPIIKHtD6Zasq/n+KvRkvao4aMX0+YCHoGiYmC5NTgazhPX24vtzMeHPBy5S6hitUt8+nl5ksOLBCFtDOepoHuiZmcPW3Y4YQwB5FJ9h+KM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642787765; 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=ETbn6pmACIUy6lPYwGZr+y2d9cDLyhwpYjA9TxNhGHg=; b=G7AznC0mklMjrcIs9UEeuC3G7Lhve+Mqfi98F93PHsf34lUsf7mpJt96TQyJhya99ZwZbc7tf7Yqui60E72mM9Bt6jtUoQ6ZizhJLTxT1X7HffhjfoCzFhNDlO0v0KmkxEn8Xqsq2yDECTC9IZxcf4PFYRiGhSFNoURlXXQJUY0= 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 1642787765837621.4076029284729; Fri, 21 Jan 2022 09:56:05 -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-615-6WqZ0Mf5N1aUZdps53urqA-1; Fri, 21 Jan 2022 12:55:40 -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 C00101091DA7; Fri, 21 Jan 2022 17:55:34 +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 9F18977C96; Fri, 21 Jan 2022 17:55:34 +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 6DBF64A7CD; Fri, 21 Jan 2022 17:55:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LHtUXl005673 for ; Fri, 21 Jan 2022 12:55:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id CD7DC84D26; Fri, 21 Jan 2022 17:55:30 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 09C2184D25; Fri, 21 Jan 2022 17:55:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642787764; 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=ETbn6pmACIUy6lPYwGZr+y2d9cDLyhwpYjA9TxNhGHg=; b=YazF3cZzZZ0uaaS6yzDhq/fYpWOpAvIc1yticy4kvr82WPjW4+1jEAGu9sJvR0f1oxSER/ QgYGKxNJOwYWjjhd8qzOn1x7qwZZBiM55P6N0mgeYlqZ1H/m16rN4wMNz+mIcsfztxD5fr uejHny9VTOVuQ994PXJKJgC5TEsmagQ= X-MC-Unique: 6WqZ0Mf5N1aUZdps53urqA-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v7 12/18] tests: Add macOS support to testutilsqemu Date: Fri, 21 Jan 2022 18:54:52 +0100 Message-Id: <20220121175458.162675-13-abologna@redhat.com> In-Reply-To: <20220121175458.162675-1-abologna@redhat.com> References: <20220121175458.162675-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 1642787766731100001 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 Tested-by: Christophe Fergeau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 Thu May 2 20:58:26 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=1642787747; cv=none; d=zohomail.com; s=zohoarc; b=keHVELcXjLMEhyEsmo3gUIKyhHjlH4oweo7v14TYdbZQKJMwlHPEaKIEKbaxPIn/CPIYm7u6qwr3BCmHf0b+eaSv9Eg+ofLDPtp6c/VcLDqzaaGg0X8uPnKln5rFuutMEv9PGmAlmvyooKqZS/KNJfeioXWPJVcwnh/ycV0XyBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642787747; 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=LtEHnnGS8Po8EMkdadExMMAUtChi6rz9zhaM1B/YAHc=; b=LMvczMd7SdseCO2D+Vc0zsAiY+sqvKTRXocbivpiqUk4QcZPe5K+9eRzXHPKKEPVh0cpr8d8/L3jzUcief3pWnBkIfDVipeRV9DrcNrAMZssV/8YzF4R7jxLan1rrrdT9E6D/es5J9cSB8EqMtLPzSMUdIVnBNBwb+ue2ltpaXk= 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 1642787747555713.5848822837313; Fri, 21 Jan 2022 09:55: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-60-EPcOGnM-Nm6_W8HPR95amw-1; Fri, 21 Jan 2022 12:55: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 D023681C9BE; Fri, 21 Jan 2022 17:55:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A669F10A48D2; Fri, 21 Jan 2022 17:55:37 +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 730691806D1C; Fri, 21 Jan 2022 17:55:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LHtWIS005687 for ; Fri, 21 Jan 2022 12:55:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 07C5384D26; Fri, 21 Jan 2022 17:55:32 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3926684D25; Fri, 21 Jan 2022 17:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642787746; 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=LtEHnnGS8Po8EMkdadExMMAUtChi6rz9zhaM1B/YAHc=; b=aflHqQkkmRy9ZFnxq/n7/OOi234A3WeCg/lDiMZedmA3APtQFuhy6qUEhxtceEWq+Ta3I6 9tUPY3e47TyVVTzbYl26UUFadLI3kcWM/IDf8R6Fv0/FyQPcZzn6zIwncv5/CgutEP9Nzx cyTNAb0MAWixEQkmZ2SkPKiloxkhvZU= X-MC-Unique: EPcOGnM-Nm6_W8HPR95amw-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v7 13/18] tests: Add macOS support to qemuxml2*test Date: Fri, 21 Jan 2022 18:54:53 +0100 Message-Id: <20220121175458.162675-14-abologna@redhat.com> In-Reply-To: <20220121175458.162675-1-abologna@redhat.com> References: <20220121175458.162675-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 1642787748696100003 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 Tested-by: Christophe Fergeau Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 9d2de2a569..69bcdd0120 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 ce1cac31c8..e3f3e481af 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 Thu May 2 20:58:26 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=1642787811; cv=none; d=zohomail.com; s=zohoarc; b=N3+n0Z/KgWXb8UzSrlxNU0OCo3OC8MU7RGRHzlE3z7AwjtSVUxdsPN/uBfiByDgOtIEg1P92lAFR9qGHrfRiL1B8J/RlgH5G5IWLmifltVbprLsBA1r6YkFDfamIBEsfAy7Q8Bh72Zi4XT5SVKdb5aRDqIbBwpTIdAVuLAH+CxM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642787811; 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=MTyZtECMeKeWV+qjspB2sxxirSlDWvJsE222L/EU3+Q=; b=CVFBuVM6FVOPAsOaLfb5yWiGTfKA2pn2TfK5If+qw0pvPolecQzzNvFurDXlGDvm2ts30MSAJfQVnUkBlNQ9GsVJfy3EcTkVHw3tklRDhidn7F87ZK/nSb9vbi63/2KNhXh7l7dMJXR26iBbskoDLq6LojKeHfZKKzkIbxYlbSA= 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 1642787811794262.90121685240035; Fri, 21 Jan 2022 09:56:51 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-557-E6XhOJiCO2iLngKml3QGMA-1; Fri, 21 Jan 2022 12:56:49 -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 049CA1018729; Fri, 21 Jan 2022 17:56:43 +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 B08DD7A4AB; Fri, 21 Jan 2022 17:56: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 7CAC21800654; Fri, 21 Jan 2022 17:56:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20LHtXYl005704 for ; Fri, 21 Jan 2022 12:55:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 69E8884D26; Fri, 21 Jan 2022 17:55:33 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A84984D25; Fri, 21 Jan 2022 17:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642787810; 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=MTyZtECMeKeWV+qjspB2sxxirSlDWvJsE222L/EU3+Q=; b=AQqZ9b4trCAKprsj4NL/uu6G85GcZ23cgy8RtmhCf9doaJmhpYX7lFfur1KCq7PhjS1pd8 9SuKFhDc6hP5gMIJbH4Wa8WKFvgNgilNT8qxDrFFDPN6eAzHTv8TzJbnrpaP8GVA3G0gPC RChufGvo0yQGlERbvB/jV7QMj1PDgQo= X-MC-Unique: E6XhOJiCO2iLngKml3QGMA-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v7 14/18] tests: Add HVF test cases Date: Fri, 21 Jan 2022 18:54:54 +0100 Message-Id: <20220121175458.162675-15-abologna@redhat.com> In-Reply-To: <20220121175458.162675-1-abologna@redhat.com> References: <20220121175458.162675-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 1642787813838100001 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 Tested-by: Christophe Fergeau Reviewed-by: Daniel P. Berrang=C3=A9 --- .../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 69bcdd0120..3054ae92e9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3501,6 +3501,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 + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + +
+ +