From nobody Sat Feb 7 13:41:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682332921; cv=none; d=zohomail.com; s=zohoarc; b=PgXMhW+h/XFr7x3s1O6cNzKExL4uwe9xzegQ1iny8NJxsFCNDv5aezQ6EHE88oMAzIzG1RuleBOMAuQplu/gAjH1mANJkO7OHRld2KeTM/Dyo5v1jPbDsSJJmcQS9vbPNOrBOeCKKlAWLEHV77GzvOADgAx8+7nCVhLK5GGrCws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682332921; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2MbA2uXp+ZFRmMd034AmDrthuFbCgnzCE4YKkisNWlo=; b=QhcQAXIowk/emuHe7NuGmaVd7990Vv2lvuNCpdCm7DNtjS+HJJQS+ISHZMCB0CpKyReWKoKhmEghUuUkA8G4xulykitmHIS0zBFC4ry0mzY8Wuja9ceNfzoITXzeTU6ReaVGZHkaYqwEEfgfUGoLqc+LhwmC0UhkXVPNKoNswts= 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 1682332921531934.8555744536752; Mon, 24 Apr 2023 03:42:01 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-456-_M0wttTqM36MaD2ae9V67g-1; Mon, 24 Apr 2023 06:41:56 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22D3E10146E2; Mon, 24 Apr 2023 10:41:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1BF540C201F; Mon, 24 Apr 2023 10:41:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7D1EA194658D; Mon, 24 Apr 2023 10:41:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7D4651946A4A for ; Mon, 24 Apr 2023 10:41:50 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6317D1121319; Mon, 24 Apr 2023 10:41:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A9AC1121318 for ; Mon, 24 Apr 2023 10:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682332920; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2MbA2uXp+ZFRmMd034AmDrthuFbCgnzCE4YKkisNWlo=; b=DgcqSzEtsAUr8/FQg/pgwtxG/GURKcoLanQ0OvH8NL69vFRfvIUNLx6Pepeqrd2oYxWTrY 5169n6mv2jLptqVhufsWFWwCC0l0l/z91s2zi94uinKkyt3A6guslA27rnoEXIGkMXocy8 AlMTUlt01L/hcAmmoVkyl/rdDvOhPbc= X-MC-Unique: _M0wttTqM36MaD2ae9V67g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 1/9] qemuDomainAttachHostDevice: Prepare device early and for all types Date: Mon, 24 Apr 2023 12:41:40 +0200 Message-Id: <0836fac6c1062a07ec591113ae7749ea51e90afe.1682332714.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1682332923581100001 Content-Type: text/plain; charset="utf-8"; x-default="true" When attaching a hostdev of a SCSI subsys, qemuDomainPrepareHostdev() is called. This makes sense because the function prepares just SCSI hostdevs ignoring others. But this will soon change. Thefore, move the function call out of qemuDomainAttachHostSCSIDevice() and into qemuDomainAttachHostDevice(). Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/qemu/qemu_hotplug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 53a0874556..64c62ea114 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2485,9 +2485,6 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriver *driver, =20 qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1); =20 - if (qemuDomainPrepareHostdev(hostdev, priv) < 0) - goto cleanup; - if (qemuProcessPrepareHostHostdev(hostdev) < 0) goto cleanup; =20 @@ -2769,6 +2766,9 @@ qemuDomainAttachHostDevice(virQEMUDriver *driver, return -1; } =20 + if (qemuDomainPrepareHostdev(hostdev, vm->privateData) < 0) + return -1; + switch (hostdev->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: if (qemuDomainAttachHostPCIDevice(driver, vm, --=20 2.39.2 From nobody Sat Feb 7 13:41:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682332919; cv=none; d=zohomail.com; s=zohoarc; b=HUTUbXRdmb4FDPbH65YbFJ79z1pHcUFh6AC9e/veftc0M8CAUC9qX3cr6AY9YwvdnkL1VsTBdGIRDhvXca4yaeGgc+fBwEqQrQdJ5jLhCqbsNxhonIbOB2vqOAYou/UaTtdzsQyZr6K2PWp6XVUCR2H5vq4pEWbTl+/1Lt3LrUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682332919; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ANqd8xghQwEqrjN8opAXcRYDNZwqBuQN1NET+XDpbL0=; b=eof4qu4ZNzsoyTSSSjMGXgMMl4S7qrpu7z5g5Jib7S2gSFdiFnsFBb+ZWKQOnw73powiBcWEbGYcWB4ntPZtJxuPE627Kn5RBmBh4dTj+BeyYGWFWXTrGMMxGvTYmUTmLchCWISWdb2r9xHh0KYICajBpjsW4ymvGM9QVxpl26Q= 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 1682332919408954.0718540668123; Mon, 24 Apr 2023 03:41:59 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-318-rco9a7rGOFSVNygnBR4A0Q-1; Mon, 24 Apr 2023 06:41:55 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 232A1857FB4; Mon, 24 Apr 2023 10:41:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id DCB2414171BD; Mon, 24 Apr 2023 10:41:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B66691946595; Mon, 24 Apr 2023 10:41:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0A9A3194658D for ; Mon, 24 Apr 2023 10:41:51 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id F1FE41121319; Mon, 24 Apr 2023 10:41:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 996A41121318 for ; Mon, 24 Apr 2023 10:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682332918; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ANqd8xghQwEqrjN8opAXcRYDNZwqBuQN1NET+XDpbL0=; b=A2eg0m+WQdmb8/eW5ZXqqrDCEVVToHbP+P6R5s2DSUKHrno4a8n1KP0jXkN+5lJRYRW7uN dSOM6iVxbzjB+ETvgKCakIOtr+6bn6YqrLHEkUkAYkhoSIWWUVt2KN8kpz5Z/klgpFRRgm PS96XcWhVJXEMY44/I8S8rDszlwEI1E= X-MC-Unique: rco9a7rGOFSVNygnBR4A0Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 2/9] qemu_domain: Move internals of qemuDomainPrepareHostdev() into a separate function Date: Mon, 24 Apr 2023 12:41:41 +0200 Message-Id: <0d967b106562cf46fd8e8bf6cc8f5da10b0e49fa.1682332714.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1682332921375100001 Content-Type: text/plain; charset="utf-8"; x-default="true" So far, qemuDomainPrepareHostdev() is a NOP for anything but a SCSI hostdev. This will change soon. Therefore, move the SCSI hostdev preparation into a separate function (qemuDomainPrepareHostdevSCSI()) and make qemuDomainPrepareHostdev() call function corresponding to the hostdev type (or nothing if the type doesn't need any preparation). Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/qemu/qemu_domain.c | 110 ++++++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 45 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 41db98880c..f462476d2a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11239,55 +11239,75 @@ qemuDomainPrepareDiskSource(virDomainDiskDef *dis= k, } =20 =20 +static int +qemuDomainPrepareHostdevSCSI(virDomainHostdevDef *hostdev, + qemuDomainObjPrivate *priv) +{ + virDomainHostdevSubsysSCSI *scsisrc =3D &hostdev->source.subsys.u.scsi; + virStorageSource *src =3D NULL; + + switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: + virObjectUnref(scsisrc->u.host.src); + scsisrc->u.host.src =3D virStorageSourceNew(); + src =3D scsisrc->u.host.src; + + src->type =3D VIR_STORAGE_TYPE_BLOCK; + + break; + + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: + src =3D scsisrc->u.iscsi.src; + break; + + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST: + default: + virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsisrc-= >protocol); + return -1; + } + + if (src) { + const char *backendalias =3D hostdev->info->alias; + + src->readonly =3D hostdev->readonly; + src->id =3D qemuDomainStorageIDNew(priv); + src->nodestorage =3D g_strdup_printf("libvirt-%d-backend", src->id= ); + backendalias =3D src->nodestorage; + + if (src->auth) { + virSecretUsageType usageType =3D VIR_SECRET_USAGE_TYPE_ISCSI; + qemuDomainStorageSourcePrivate *srcPriv =3D qemuDomainStorageS= ourcePrivateFetch(src); + + if (!(srcPriv->secinfo =3D qemuDomainSecretInfoSetupFromSecret= (priv, + b= ackendalias, + N= ULL, 0, + u= sageType, + s= rc->auth->username, + &= src->auth->seclookupdef))) + return -1; + } + } + + return 0; +} + + int qemuDomainPrepareHostdev(virDomainHostdevDef *hostdev, qemuDomainObjPrivate *priv) { - if (virHostdevIsSCSIDevice(hostdev)) { - virDomainHostdevSubsysSCSI *scsisrc =3D &hostdev->source.subsys.u.= scsi; - virStorageSource *src =3D NULL; - - switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { - case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: - virObjectUnref(scsisrc->u.host.src); - scsisrc->u.host.src =3D virStorageSourceNew(); - src =3D scsisrc->u.host.src; - - src->type =3D VIR_STORAGE_TYPE_BLOCK; - - break; - - case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: - src =3D scsisrc->u.iscsi.src; - break; - - case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST: - default: - virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsi= src->protocol); - return -1; - } - - if (src) { - const char *backendalias =3D hostdev->info->alias; - - src->readonly =3D hostdev->readonly; - src->id =3D qemuDomainStorageIDNew(priv); - src->nodestorage =3D g_strdup_printf("libvirt-%d-backend", src= ->id); - backendalias =3D src->nodestorage; - - if (src->auth) { - virSecretUsageType usageType =3D VIR_SECRET_USAGE_TYPE_ISC= SI; - qemuDomainStorageSourcePrivate *srcPriv =3D qemuDomainStor= ageSourcePrivateFetch(src); - - if (!(srcPriv->secinfo =3D qemuDomainSecretInfoSetupFromSe= cret(priv, - = backendalias, - = NULL, 0, - = usageType, - = src->auth->username, - = &src->auth->seclookupdef))) - return -1; - } - } + if (hostdev->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) + return 0; + + switch ((virDomainHostdevSubsysType)hostdev->source.subsys.type) { + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: + return qemuDomainPrepareHostdevSCSI(hostdev, priv); + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: + break; } =20 return 0; --=20 2.39.2 From nobody Sat Feb 7 13:41:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682332924; cv=none; d=zohomail.com; s=zohoarc; b=Lmguoruee94Kj3nO5jtamkygKwZdVg2kY2cAlzPcVXHrfNxilYpBusj5Wtd2vttbCEvbiyEX6aVtUDBR5LJFZjc3c082HO6XLnIHxY7ufWH455a2v1Pm4NGgjrYAjmmohAEOD6RYRO6hQw7pJb0NjXj1AvJDMxjleASLHSjC6U0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682332924; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gYBT7FclCXEvLeADrtYelmlDE1eBJsv9dP1qR6Fr6Gg=; b=KdGAUE2NcN5zAFKzhLO7og61STe/20VKcz9kgMj6bEpg8440bK1bbj5cw8mf1cRGEGDX9fllVcdlh2ZG+SFhUd27OQAVHEfh6/jDN7glSRxz7n5ag+rLzbLuskQaRpApONaL6lasMYNU/zJ2I2RsQE8+M3qnV3dvbwiyQ5g6gvM= 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 16823329248220.07746583876155455; Mon, 24 Apr 2023 03:42:04 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-488-aqDfa7vDNHqwoUAmSKTCXA-1; Mon, 24 Apr 2023 06:42:01 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2AC6885A5B1; Mon, 24 Apr 2023 10:41:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 160472022ECA; Mon, 24 Apr 2023 10:41:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0A2AA1946589; Mon, 24 Apr 2023 10:41:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 997D91946A4D for ; Mon, 24 Apr 2023 10:41:51 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8CD6B112131B; Mon, 24 Apr 2023 10:41:51 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 347EC1121318 for ; Mon, 24 Apr 2023 10:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682332923; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gYBT7FclCXEvLeADrtYelmlDE1eBJsv9dP1qR6Fr6Gg=; b=TQcBYhW6Folel0xVNmk5ZxQgCwlCXv+jTgq1hKOEnQGaGrSX+JjNrsQ3BjX7QuevlpDXJT 2J+a67SggqQ0dJa/kqpGzdSdTzEuHupxyI8O5NXBZs+QCWdttroOG+FCIMiwzL+A3VROLj AvjVdpK4Q4tgCPVOIkPyT3gufAp21zA= X-MC-Unique: aqDfa7vDNHqwoUAmSKTCXA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 3/9] qemu: Move PCI backend setting into qemuDomainPrepareHostdev() Date: Mon, 24 Apr 2023 12:41:42 +0200 Message-Id: <0f3ca5a811c8794c78d760cd7e2301361062ca64.1682332714.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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: 1682332925488100004 Content-Type: text/plain; charset="utf-8"; x-default="true" virsh command domxml-to-native failed with below error but start command succeed for same domain xml. "internal error: invalid PCI passthrough type 'default'" If a PCI backend is not set in the XML, the supported one is then chosen in qemuHostdevPreparePCIDevicesCheckSupport(). But this function is not called anywhere from qemuConnectDomainXMLToNative(). But qemuDomainPrepareHostdev() is. And it is also called from domain startup/hotplug code. Therefore, move the backend setting to the common path and drop qemuHostdevPreparePCIDevicesCheckSupport(). Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/qemu/qemu_domain.c | 50 +++++++++++++++++++++++++++++++- src/qemu/qemu_hostdev.c | 64 ++--------------------------------------- src/qemu/qemu_hotplug.c | 2 +- 3 files changed, 53 insertions(+), 63 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f462476d2a..58cd3dd710 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11292,6 +11292,53 @@ qemuDomainPrepareHostdevSCSI(virDomainHostdevDef *= hostdev, } =20 =20 +static int +qemuDomainPrepareHostdevPCI(virDomainHostdevDef *hostdev, + virQEMUCaps *qemuCaps) +{ + bool supportsPassthroughVFIO =3D qemuHostdevHostSupportsPassthroughVFI= O(); + virDomainHostdevSubsysPCIBackendType *backend =3D &hostdev->source.sub= sys.u.pci.backend; + + /* assign defaults for hostdev passthrough */ + switch (*backend) { + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT: + if (supportsPassthroughVFIO) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) { + *backend =3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO; + } else { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("VFIO PCI device assignment is not suppor= ted by this version of QEMU")); + return -1; + } + } else { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("host doesn't support passthrough of host PCI= devices")); + return -1; + } + break; + + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO: + if (!supportsPassthroughVFIO) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("host doesn't support VFIO PCI passthrough")); + return false; + } + break; + + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("host doesn't support legacy PCI passthrough")); + return false; + + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN: + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST: + break; + } + + return true; +} + + int qemuDomainPrepareHostdev(virDomainHostdevDef *hostdev, qemuDomainObjPrivate *priv) @@ -11302,8 +11349,9 @@ qemuDomainPrepareHostdev(virDomainHostdevDef *hostd= ev, switch ((virDomainHostdevSubsysType)hostdev->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: return qemuDomainPrepareHostdevSCSI(hostdev, priv); - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: + return qemuDomainPrepareHostdevPCI(hostdev, priv->qemuCaps); + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 45cd1066f0..49347019ea 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -153,60 +153,6 @@ qemuHostdevHostSupportsPassthroughVFIO(void) } =20 =20 -static bool -qemuHostdevPreparePCIDevicesCheckSupport(virDomainHostdevDef **hostdevs, - size_t nhostdevs, - virQEMUCaps *qemuCaps) -{ - bool supportsPassthroughVFIO =3D qemuHostdevHostSupportsPassthroughVFI= O(); - size_t i; - - /* assign defaults for hostdev passthrough */ - for (i =3D 0; i < nhostdevs; i++) { - virDomainHostdevDef *hostdev =3D hostdevs[i]; - virDomainHostdevSubsysPCIBackendType *backend =3D &hostdev->source= .subsys.u.pci.backend; - - if (hostdev->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) - continue; - if (hostdev->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYP= E_PCI) - continue; - - switch (*backend) { - case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT: - if (supportsPassthroughVFIO && - virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) { - *backend =3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO; - } else { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("host doesn't support passthrough of " - "host PCI devices")); - return false; - } - - break; - - case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO: - if (!supportsPassthroughVFIO) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("host doesn't support VFIO PCI passthroug= h")); - return false; - } - break; - - case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("host doesn't support legacy PCI passthrough"= )); - return false; - - case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN: - case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST: - break; - } - } - - return true; -} - int qemuHostdevPrepareOneNVMeDisk(virQEMUDriver *driver, const char *name, @@ -235,15 +181,11 @@ qemuHostdevPreparePCIDevices(virQEMUDriver *driver, const unsigned char *uuid, virDomainHostdevDef **hostdevs, int nhostdevs, - virQEMUCaps *qemuCaps, + virQEMUCaps *qemuCaps G_GNUC_UNUSED, unsigned int flags) { - virHostdevManager *hostdev_mgr =3D driver->hostdevMgr; - - if (!qemuHostdevPreparePCIDevicesCheckSupport(hostdevs, nhostdevs, qem= uCaps)) - return -1; - - return virHostdevPreparePCIDevices(hostdev_mgr, QEMU_DRIVER_NAME, + return virHostdevPreparePCIDevices(driver->hostdevMgr, + QEMU_DRIVER_NAME, name, uuid, hostdevs, nhostdevs, flags); } diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 64c62ea114..fab8935346 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1478,7 +1478,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver, &hostdev, 1, priv->qemuCaps, flags) <= 0) return -1; =20 - /* this could have been changed by qemuHostdevPreparePCIDevices */ + /* this could have been changed by qemuDomainPrepareHostdevPCI() */ backend =3D hostdev->source.subsys.u.pci.backend; =20 switch (backend) { --=20 2.39.2 From nobody Sat Feb 7 13:41:50 2026 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=1682332986; cv=none; d=zohomail.com; s=zohoarc; b=C79G9C3/nznR5f5xWjh4vyt7FPxVL3T7pl6PodrlB/ZRaXimmMkxSfRVRM69Lo0SRVuHAVUNXxJBhV7jakyqcTZwB9wN30dW8brjFZSN4LyTfLkVKO8RkA3xsDKppT2D44YAueuAUDx2NHDKhYvJ556urSrJ6jcMeS7qc47jXnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682332986; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OX4dOuXt4+lQUOMabCq+kXdBAmtF61VDMUo08/l4MLc=; b=aiVbhyM3tqWqFQM9piARUUs8or3PnL34za4bdTKDAEkKN7u+w+vKHfJZQDHigbFnx20mqDxJ4XAR4+ljDlL7kYARnhWFZMaYYy5JnOnLRy+1BDhaqA+y2wXAvEMKRSbkhHADa+LkeiDGLTHXfFrHzWtJglQ3YVH+Cx9LsahWoNE= 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 1682332986006760.1684486610031; Mon, 24 Apr 2023 03:43:06 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-375-FlHoGlndMwaFjlhMbCnLDQ-1; Mon, 24 Apr 2023 06:41:56 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1F7F1185A794; Mon, 24 Apr 2023 10:41:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D53A2166B29; Mon, 24 Apr 2023 10:41:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EA75D194658D; Mon, 24 Apr 2023 10:41:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 331D01946594 for ; Mon, 24 Apr 2023 10:41:52 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 283D7112131E; Mon, 24 Apr 2023 10:41:52 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id C38121121319 for ; Mon, 24 Apr 2023 10:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682332985; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=OX4dOuXt4+lQUOMabCq+kXdBAmtF61VDMUo08/l4MLc=; b=aBi/dzO0jSaXxVtDVy+jhzRgpLbCHYaK8ZZRivFE+2UqESaercmq/wOtOnKdwMO+nHOZxD hTCkpcSMVLHSQYEY0h5RO+9mQY3MYwq3ZYb3tJVT3jhNZzqAlKzsKEz81BP1SYUNnJHDgz 1RQ/y3N/2tQiycYgGQJ0sngyWvkpkYU= X-MC-Unique: FlHoGlndMwaFjlhMbCnLDQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 4/9] qemuxml2argvtest: Drop needless PCI backend setting Date: Mon, 24 Apr 2023 12:41:43 +0200 Message-Id: <2f4d6717ee9a476a125138438b3ca241da55f958.1682332714.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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: 1682332987787100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The qemuxml2argvtest does a bit of 'fixups' to parsed virDomainDef just before generating the cmd line. For instance, it sets PCI backend for hostdevs (to VFIO). The reason for this is that we want to make the test host independent and thus letting the code chose backend at runtime might render different results on different machines. But this is not necessary, as virpcimock (that the test uses) already creates a fake, but stable environment (where /dev/vfio/vfio and IOMMU groups exist), thus qemuHostdevHostSupportsPassthroughVFIO() returns true, regardless of the actual host support. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- tests/qemuxml2argvtest.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 23e0c4054c..b65db3bbd9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -407,12 +407,6 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv, for (i =3D 0; i < vm->def->nhostdevs; i++) { virDomainHostdevDef *hostdev =3D vm->def->hostdevs[i]; =20 - if (hostdev->mode =3D=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && - hostdev->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_T= YPE_PCI && - hostdev->source.subsys.u.pci.backend =3D=3D VIR_DOMAIN_HOSTDEV= _PCI_BACKEND_DEFAULT) { - hostdev->source.subsys.u.pci.backend =3D VIR_DOMAIN_HOSTDEV_PC= I_BACKEND_VFIO; - } - if (virHostdevIsSCSIDevice(hostdev)) { virDomainHostdevSubsysSCSI *scsisrc =3D &hostdev->source.subsy= s.u.scsi; =20 --=20 2.39.2 From nobody Sat Feb 7 13:41:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682332926; cv=none; d=zohomail.com; s=zohoarc; b=QzqHIsc4L2YxF0nt0IhrZXYXflCPKDtvNyBvRqEZABAHXWLzMIt6rdaM7qnLxcjDJbpQa5YAngDiDr3OI8+XJ+O2+T1B0MpmIMY+stAu2TXJ1SZ568in8n5oYPq1mCRckuYo3UfSTV11K3rav6lAMtUQN49wqK77rTCt1H5t8iE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682332926; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HREV4OIoBoVBo6ci4OdLpR8oo7hoVO8AaOIkmhm64CE=; b=BkVwfoA8DhOCusvUpq7dKIQN0eNihywB6Wme4zIiiFDnloxtHhc0un7C8QGDVTZSfOcfThb2kA3bvJ417NcfC0knsjPNcu662nwfbi7+k1jgh3T9duYEO5xS8INPTIiQDNlS3/a1kb14sQd1k3KlkQhuw7LZ/9Xy1jfBA5mNMpo= 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 1682332926911205.2988574957477; Mon, 24 Apr 2023 03:42:06 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-P5Vb__NOPDKtfYAuWfkBRg-1; Mon, 24 Apr 2023 06:42:02 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C4F81185A79C; Mon, 24 Apr 2023 10:41:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2A972022ECD; Mon, 24 Apr 2023 10:41:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 62C1D19465A3; Mon, 24 Apr 2023 10:41:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D0C5F1946A4A for ; Mon, 24 Apr 2023 10:41:52 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B76501121318; Mon, 24 Apr 2023 10:41:52 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EEB11121319 for ; Mon, 24 Apr 2023 10:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682332925; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=HREV4OIoBoVBo6ci4OdLpR8oo7hoVO8AaOIkmhm64CE=; b=DUFwOe0RVhTaFIDT/6U3SwQevLfEX3nqNXCvcf65Za2oX0Y57nECmfaSQybehdOR284g7j i0h+2Gdz27zN+F3eAXF51krDpZEAgnq7v5WhwXM1D0gs3xMBAvlNcDiZkW+lzC+EGUAEKh BlpuGHAtG6rZvZt2xvjBICOOW0cBMWU= X-MC-Unique: P5Vb__NOPDKtfYAuWfkBRg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 5/9] qemu: Deny all but VFIO PCI backends in hostdev prepare phase Date: Mon, 24 Apr 2023 12:41:44 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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: 1682332927428100011 Content-Type: text/plain; charset="utf-8"; x-default="true" We used to support KVM and VFIO style of PCI assignment. The former was dropped in v5.7.0-rc1~103 and thus we only support VFIO. All other backends lead to an error (see qemuBuildPCIHostdevDevProps(), or qemuBuildPCIHostdevDevStr() as it used to be called in the era of aforementioned commit). Might as well report the error in prepare phase and save hassle of proceeding with device preparation (e.g. in case of hotplug overriding the device's driver, setting seclabels, etc.). Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/qemu/qemu_domain.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 58cd3dd710..72f36c807b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11326,12 +11326,11 @@ qemuDomainPrepareHostdevPCI(virDomainHostdevDef *= hostdev, break; =20 case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("host doesn't support legacy PCI passthrough")); - return false; - case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN: case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST: + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid PCI passthrough type '%1$s'"), + virDomainHostdevSubsysPCIBackendTypeToString(*backe= nd)); break; } =20 --=20 2.39.2 From nobody Sat Feb 7 13:41:50 2026 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=1682332924; cv=none; d=zohomail.com; s=zohoarc; b=C/pr90Mtj7vfMgrywsCjKJBeJElEjvjDH+7qpDRxZxTOtKQONkfXhuVf3bpEnbWwXzrl2X/grB0HnhdC/rBMNcTHjXqIiHP0mmfn09LKwqfLpbOA4evH10TaiJx1zf+36hTmTU+D+OCiL1Oczy7F5xhOOncfSOzQVdGPgH8IDmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682332924; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jJG54Qqm7K9Wb4PNH08mdFkwhA3Vbewjr/zEfHSW45Y=; b=VemZwL2GaA/6rIMEINchkFcs95nebHx94JP8efTzwJjdDllQAwmfSHzy430hbS95FQu5CYVGBHdbR9JaWLT3Xt3ZQw9jvaOWMpxFHJmWLMaH8maSXFlhvcaaP6FjaAlD67A6VczKGCIOYcJxCfzqCL3RmpPMWSu9stJK+qbD7PY= 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 1682332924308946.8062073198797; Mon, 24 Apr 2023 03:42:04 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-61-LqDScMRjPrerVARqbxBDYg-1; Mon, 24 Apr 2023 06:41:59 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8B23E858289; Mon, 24 Apr 2023 10:41:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 761EA2166B2C; Mon, 24 Apr 2023 10:41:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 40806194658D; Mon, 24 Apr 2023 10:41:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 710D71946589 for ; Mon, 24 Apr 2023 10:41:53 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 528D2112131B; Mon, 24 Apr 2023 10:41:53 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDC1A1121319 for ; Mon, 24 Apr 2023 10:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682332923; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jJG54Qqm7K9Wb4PNH08mdFkwhA3Vbewjr/zEfHSW45Y=; b=hwdjIH5nuwrKlqLHnJYlKcMEIpguEv3YOH0eZlvIZdiIX3abw4OXjOoEcZLDvYrj+K1uQR X69DJ/TNdHH2YNW8H4GCojUnJSdrDpajwhQgioCQKzjckCwfZ7kXmEYzwjiqNT7bFP8ii+ 0Ym9AhZgLfEkvwJvWRte/GBI1tFKsw4= X-MC-Unique: LqDScMRjPrerVARqbxBDYg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 6/9] qemu_hotplug: Drop PCI backend check in qemuDomainAttachHostPCIDevice() Date: Mon, 24 Apr 2023 12:41:45 +0200 Message-Id: <873e0fab88609575f068dd97bbda4f4a3aaa1211.1682332714.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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: 1682332925610100007 Content-Type: text/plain; charset="utf-8"; x-default="true" There is no way the qemuDomainAttachHostPCIDevice() function can be called over a hostdev with other PCI backend than VFIO. And even if it were, then the check is written so poorly that it lets some types through (e.g. KVM) only to let qemuBuildPCIHostdevDevProps() called afterwards fail properly. Drop this check and rely on qemuDomainPrepareHostdevPCI() (and worst case scenario even qemuBuildPCIHostdevDevProps()) to report the proper error. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/qemu/qemu_hotplug.c | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index fab8935346..566aa1f7df 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1466,7 +1466,6 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver, bool teardownlabel =3D false; bool teardowndevice =3D false; bool teardownmemlock =3D false; - int backend; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); unsigned int flags =3D 0; =20 @@ -1478,32 +1477,6 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver, &hostdev, 1, priv->qemuCaps, flags) <= 0) return -1; =20 - /* this could have been changed by qemuDomainPrepareHostdevPCI() */ - backend =3D hostdev->source.subsys.u.pci.backend; - - switch (backend) { - case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO: - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("VFIO PCI device assignment is not " - "supported by this version of qemu")); - goto error; - } - break; - - case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT: - case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM: - break; - - case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN: - case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("QEMU does not support device assignment mode '%1= $s'"), - virDomainHostdevSubsysPCIBackendTypeToString(backen= d)); - goto error; - break; - } - if (qemuDomainAdjustMaxMemLockHostdev(vm, hostdev) < 0) goto error; teardownmemlock =3D true; @@ -1517,8 +1490,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver, =20 if (qemuSecuritySetHostdevLabel(driver, vm, hostdev) < 0) goto error; - if (backend !=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) - teardownlabel =3D true; + teardownlabel =3D true; =20 qemuAssignDeviceHostdevAlias(vm->def, &info->alias, -1); =20 --=20 2.39.2 From nobody Sat Feb 7 13:41:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682332926; cv=none; d=zohomail.com; s=zohoarc; b=klu33x6Y7wywFz2VUm8slx2lGpUctisbDgPHuTLTbB1tnVjzhdcFjARsVcSTROet5sJ7yXvuhfKmbIwlvfOfvI2bFed/sSxmJRyy5wxTmFu2ezfLL8IWv8pC9PYkb0zfbYaVEZXnuuevYHo6ps1qnEaYP26NI1f385EcBzzFU8Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682332926; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZMfk5HGm28Ykg4rT/4kCbb6BeIPxaNwfDix6b604Qh8=; b=S58ydRQl5l2holL3LguVtrKKuu2JhYb/J/DW7VOWl+3o1UQANcVGmifhCSDDt5fvyLDThLfC2rcWCT7dsH97doWelrKVj1zfrO3YLcT0c/lvcPvVqpqRfGCB6Gnl7D25Xyj+fVGRDJ+ur8/53yUOqARSh88mXnRi6lVxjl5/7T4= 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 1682332926541854.5956891870534; Mon, 24 Apr 2023 03:42:06 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-622-stXZv3CDMYi6LyGcpOWh7w-1; Mon, 24 Apr 2023 06:42:01 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BDEF210146E6; Mon, 24 Apr 2023 10:41:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 949AD492B14; Mon, 24 Apr 2023 10:41:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A5B9B1946A74; Mon, 24 Apr 2023 10:41:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 07CCE19465A2 for ; Mon, 24 Apr 2023 10:41:54 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E11181121319; Mon, 24 Apr 2023 10:41:53 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88E141121318 for ; Mon, 24 Apr 2023 10:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682332925; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ZMfk5HGm28Ykg4rT/4kCbb6BeIPxaNwfDix6b604Qh8=; b=N9fjY8wTQK+6w7/N+hQsmeZebCLA01ZDn4jwc/Ede8ZuNDWDoo+xZ+CjpQtqVPz5BQ2LKq mwaQBG0L8oac9h5rUXa0ksVPRF+5FIrUI8w835gMm5CbCIM4YONpNFNOsddDS0lz1VUGAi t9ZaFr5UCAXufvI4xmNL42gjsgsIZvk= X-MC-Unique: stXZv3CDMYi6LyGcpOWh7w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 7/9] qemu: Move SCSI path generation into qemuDomainPrepareHostdev() Date: Mon, 24 Apr 2023 12:41:46 +0200 Message-Id: <96d71e8784f5e6db4e617e2e252a4822e2aeef26.1682332714.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: 1682332927452100012 Content-Type: text/plain; charset="utf-8"; x-default="true" When preparing a SCSI with passthrough of a host SCSI adapter (i.e. no protocol), a virStorageSource structure is initialized and stored inside virDomainHostdevDef. But the source structure is filled in many places, with almost the same code. Firstly, qemuProcessPrepareHostHostdev() and qemuConnectDomainXMLToNativePrepareHostHostdev() are the same. Secondly, qemuDomainPrepareHostdev() allocates the src structure, only to let qemuProcessPrepareHostHostdev() fill src->path later. Well, src->path can be filled at the same place where the src structure is allocated (qemuDomainPrepareHostdev()) which renders the other two functions needless. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/qemu/qemu_domain.c | 10 ++++++++++ src/qemu/qemu_driver.c | 32 +------------------------------- src/qemu/qemu_process.c | 32 +------------------------------- tests/qemuxml2argvmock.c | 10 ++++++++++ tests/qemuxml2argvtest.c | 22 ---------------------- 5 files changed, 22 insertions(+), 84 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 72f36c807b..c5520505bf 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11244,7 +11244,9 @@ qemuDomainPrepareHostdevSCSI(virDomainHostdevDef *h= ostdev, qemuDomainObjPrivate *priv) { virDomainHostdevSubsysSCSI *scsisrc =3D &hostdev->source.subsys.u.scsi; + virDomainHostdevSubsysSCSIHost *scsihostsrc =3D &scsisrc->u.host; virStorageSource *src =3D NULL; + g_autofree char *devstr =3D NULL; =20 switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: @@ -11252,7 +11254,15 @@ qemuDomainPrepareHostdevSCSI(virDomainHostdevDef *= hostdev, scsisrc->u.host.src =3D virStorageSourceNew(); src =3D scsisrc->u.host.src; =20 + if (!(devstr =3D virSCSIDeviceGetSgName(NULL, + scsihostsrc->adapter, + scsihostsrc->bus, + scsihostsrc->target, + scsihostsrc->unit))) + return -1; + src->type =3D VIR_STORAGE_TYPE_BLOCK; + src->path =3D g_strdup_printf("/dev/%s", devstr); =20 break; =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 523a83682c..d6f9d0796a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6166,38 +6166,8 @@ static char =20 =20 static int -qemuConnectDomainXMLToNativePrepareHostHostdev(virDomainHostdevDef *hostde= v) +qemuConnectDomainXMLToNativePrepareHostHostdev(virDomainHostdevDef *hostde= v G_GNUC_UNUSED) { - if (virHostdevIsSCSIDevice(hostdev)) { - virDomainHostdevSubsysSCSI *scsisrc =3D &hostdev->source.subsys.u.= scsi; - - switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { - case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: { - virDomainHostdevSubsysSCSIHost *scsihostsrc =3D &scsisrc->u.ho= st; - virStorageSource *src =3D scsisrc->u.host.src; - g_autofree char *devstr =3D NULL; - - if (!(devstr =3D virSCSIDeviceGetSgName(NULL, - scsihostsrc->adapter, - scsihostsrc->bus, - scsihostsrc->target, - scsihostsrc->unit))) - return -1; - - src->path =3D g_strdup_printf("/dev/%s", devstr); - break; - } - - case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: - break; - - case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST: - default: - virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsi= src->protocol); - return -1; - } - } - return 0; } =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 8baa882875..0bc19479d4 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6510,38 +6510,8 @@ qemuProcessPrepareDomainHostdevs(virDomainObj *vm, =20 =20 int -qemuProcessPrepareHostHostdev(virDomainHostdevDef *hostdev) +qemuProcessPrepareHostHostdev(virDomainHostdevDef *hostdev G_GNUC_UNUSED) { - if (virHostdevIsSCSIDevice(hostdev)) { - virDomainHostdevSubsysSCSI *scsisrc =3D &hostdev->source.subsys.u.= scsi; - - switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { - case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: { - virDomainHostdevSubsysSCSIHost *scsihostsrc =3D &scsisrc->u.ho= st; - virStorageSource *src =3D scsisrc->u.host.src; - g_autofree char *devstr =3D NULL; - - if (!(devstr =3D virSCSIDeviceGetSgName(NULL, - scsihostsrc->adapter, - scsihostsrc->bus, - scsihostsrc->target, - scsihostsrc->unit))) - return -1; - - src->path =3D g_strdup_printf("/dev/%s", devstr); - break; - } - - case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: - break; - - case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST: - default: - virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsi= src->protocol); - return -1; - } - } - return 0; } =20 diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c index f566ec539a..400dd5c020 100644 --- a/tests/qemuxml2argvmock.c +++ b/tests/qemuxml2argvmock.c @@ -82,6 +82,16 @@ virSCSIVHostOpenVhostSCSI(int *vhostfd) return 0; } =20 +char * +virSCSIDeviceGetSgName(const char *sysfs_prefix G_GNUC_UNUSED, + const char *adapter G_GNUC_UNUSED, + unsigned int bus G_GNUC_UNUSED, + unsigned int target G_GNUC_UNUSED, + unsigned long long unit G_GNUC_UNUSED) +{ + return g_strdup_printf("sg0"); +} + int virNetDevTapCreate(char **ifname, const char *tunpath G_GNUC_UNUSED, diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b65db3bbd9..dad9758be4 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -404,28 +404,6 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv, disk->src->hostcdrom =3D true; } =20 - for (i =3D 0; i < vm->def->nhostdevs; i++) { - virDomainHostdevDef *hostdev =3D vm->def->hostdevs[i]; - - if (virHostdevIsSCSIDevice(hostdev)) { - virDomainHostdevSubsysSCSI *scsisrc =3D &hostdev->source.subsy= s.u.scsi; - - switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { - case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: - scsisrc->u.host.src->path =3D g_strdup("/dev/sg0"); - break; - - case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: - break; - - case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST: - default: - virReportEnumRangeError(virDomainHostdevSCSIProtocolType, = scsisrc->protocol); - return NULL; - } - } - } - if (vm->def->vsock) { virDomainVsockDef *vsock =3D vm->def->vsock; qemuDomainVsockPrivate *vsockPriv =3D --=20 2.39.2 From nobody Sat Feb 7 13:41:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682332926; cv=none; d=zohomail.com; s=zohoarc; b=f08/vf9nIS4nHfmMZpwxAAuLYRIjrHYTQomlcB3myxbzq9ZtZTfh9vtFT3tjYQ6wBur1/KgMk8lNQlklTY1aMc7JB4eoJ03zGMe0lR8JvRR1HVPbDIiNbZFFBOUX2UfeL4dkZZMzPjNJt2wWr2wOpuwC5PqD+ChniBmrRK5H544= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682332926; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KcI58NDBEtUuOf8PVZn0oGXesjytYrTkTa6WHaEcmS4=; b=anr0gRM0/UPtlsvFVDGy80B7zj0ugruz79GrbdXVESno4UTp0yHQozkauHc4VMXjSlRrBetCpQvUPrHDHexnmNye/94jLPVniVO7UDCSkHJgMPqe3dv9ECvbjkQSeTfNTawuNDimuLO2jdIQjS/EN0to5Eq8rQAH8/OWlRZCPF8= 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 1682332926301810.8524725219421; Mon, 24 Apr 2023 03:42:06 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-534-x_ajbJrxOKyV89LxNMQjXw-1; Mon, 24 Apr 2023 06:42:01 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 680CA87A9E3; Mon, 24 Apr 2023 10:41:55 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 515194E3C5; Mon, 24 Apr 2023 10:41:55 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2941D19465A3; Mon, 24 Apr 2023 10:41:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8B77B1946588 for ; Mon, 24 Apr 2023 10:41:54 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7CB2F1121319; Mon, 24 Apr 2023 10:41:54 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23E8D1121318 for ; Mon, 24 Apr 2023 10:41:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682332925; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=KcI58NDBEtUuOf8PVZn0oGXesjytYrTkTa6WHaEcmS4=; b=Pn/R0e7N6sy2MaI/BGED17F4blQuH/2xBWRmqt7IqIeSMfeRFLhJMFSS659xsvQQ/+7Odb b0/Ut9n3QjfsbdVQy70Z3J1UM7Xv1b0kApE7M2TerwAaqXlFd2mXFBd/rlT9fsdp+WHk2D Ri3WjW4haqzVHHFtJ4q7L+A2lVyaimU= X-MC-Unique: x_ajbJrxOKyV89LxNMQjXw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 8/9] qemu: Remove empty functions Date: Mon, 24 Apr 2023 12:41:47 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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: 1682332927355100009 Content-Type: text/plain; charset="utf-8"; x-default="true" After previous cleanup, there are some functions that do nothing: qemuConnectDomainXMLToNativePrepareHostHostdev() qemuConnectDomainXMLToNativePrepareHost() qemuProcessPrepareHostHostdev() qemuProcessPrepareHostHostdevs() Remove them. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/qemu/qemu_driver.c | 26 -------------------------- src/qemu/qemu_hotplug.c | 3 --- src/qemu/qemu_process.c | 27 --------------------------- src/qemu/qemu_process.h | 3 --- 4 files changed, 59 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d6f9d0796a..fdd5fb0826 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6165,29 +6165,6 @@ static char } =20 =20 -static int -qemuConnectDomainXMLToNativePrepareHostHostdev(virDomainHostdevDef *hostde= v G_GNUC_UNUSED) -{ - return 0; -} - - -static int -qemuConnectDomainXMLToNativePrepareHost(virDomainObj *vm) -{ - size_t i; - - for (i =3D 0; i < vm->def->nhostdevs; i++) { - virDomainHostdevDef *hostdev =3D vm->def->hostdevs[i]; - - if (qemuConnectDomainXMLToNativePrepareHostHostdev(hostdev) < 0) - return -1; - } - - return 0; -} - - static char *qemuConnectDomainXMLToNative(virConnectPtr conn, const char *format, const char *xmlData, @@ -6244,9 +6221,6 @@ static char *qemuConnectDomainXMLToNative(virConnectP= tr conn, VIR_QEMU_PROCESS_START_COLD) < = 0) return NULL; =20 - if (qemuConnectDomainXMLToNativePrepareHost(vm) < 0) - return NULL; - if (!(cmd =3D qemuProcessCreatePretendCmdBuild(vm, NULL))) return NULL; =20 diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 566aa1f7df..bf9d16e82b 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2457,9 +2457,6 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriver *driver, =20 qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1); =20 - if (qemuProcessPrepareHostHostdev(hostdev) < 0) - goto cleanup; - if (!(data =3D qemuBuildHostdevSCSIAttachPrepare(hostdev, &backendalia= s, priv->qemuCaps))) goto cleanup; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 0bc19479d4..75a1d88cd7 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6509,29 +6509,6 @@ qemuProcessPrepareDomainHostdevs(virDomainObj *vm, } =20 =20 -int -qemuProcessPrepareHostHostdev(virDomainHostdevDef *hostdev G_GNUC_UNUSED) -{ - return 0; -} - - -static int -qemuProcessPrepareHostHostdevs(virDomainObj *vm) -{ - size_t i; - - for (i =3D 0; i < vm->def->nhostdevs; i++) { - virDomainHostdevDef *hostdev =3D vm->def->hostdevs[i]; - - if (qemuProcessPrepareHostHostdev(hostdev) < 0) - return -1; - } - - return 0; -} - - /** * qemuProcessRebootAllowed: * @def: domain definition @@ -7233,10 +7210,6 @@ qemuProcessPrepareHost(virQEMUDriver *driver, if (qemuProcessPrepareHostStorage(driver, vm, flags) < 0) return -1; =20 - VIR_DEBUG("Preparing hostdevs (host-side)"); - if (qemuProcessPrepareHostHostdevs(vm) < 0) - return -1; - VIR_DEBUG("Preparing external devices"); if (qemuExtDevicesPrepareHost(driver, vm) < 0) return -1; diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index b171f0464c..5d1b24a038 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -111,9 +111,6 @@ int qemuProcessPrepareDomain(virQEMUDriver *driver, =20 int qemuProcessOpenVhostVsock(virDomainVsockDef *vsock); =20 -int qemuProcessPrepareHostHostdev(virDomainHostdevDef *hostdev); - - int qemuProcessPrepareHostBackendChardevHotplug(virDomainObj *vm, virDomainDeviceDef *dev) G_NO_INLINE; --=20 2.39.2 From nobody Sat Feb 7 13:41:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682332934; cv=none; d=zohomail.com; s=zohoarc; b=VJ4O79R5fgEnIlXf7vwaSTQJe5YRV3p4QBAucHzMAXWtNFt8kQ6/fCpvNYjVa9hMc4Gl7NgPPPYSDj3D7iqyFEpUNUcG2fhLBJbbyROPsHtUr27RycoMfRdwUPEf82KhLaTuOewg9SWC998TgOoVrZvYMkhPzmwEOufI1q8BizM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682332934; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vi9OmbPvLZRWlOibnodRgxv94w3riimZo5EHYCnfyCM=; b=WGeHmJXMz/Yl5PG2Z496DDE0JRIB/N46CoGygJ0QWnSX79YSTPzBFLjUxEYz6Jf/dYZh0xNWn6AwZQk08RHmJSynLevzg3xjHpjnIv0YHteu4xhBFJ4R9fVFjmSBSLFKHCIpeS/bLUxNMzyMsa9Uj4wxwXVfGr5g1QIqT7aRt6M= 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 1682332934022256.2879337622154; Mon, 24 Apr 2023 03:42:14 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-592-lZSj7w0gPZeRnhFWm37quA-1; Mon, 24 Apr 2023 06:42:03 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 320AC83FC85; Mon, 24 Apr 2023 10:41:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F8752166B2B; Mon, 24 Apr 2023 10:41:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7CB221946A6C; Mon, 24 Apr 2023 10:41:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3175D1946A46 for ; Mon, 24 Apr 2023 10:41:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 16C411121319; Mon, 24 Apr 2023 10:41:55 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2B741121318 for ; Mon, 24 Apr 2023 10:41:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682332933; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=vi9OmbPvLZRWlOibnodRgxv94w3riimZo5EHYCnfyCM=; b=e2bAldLbfQhaLTqoUf25SSi5JFlX4ZERljHsZHtDMNxBqpz9vgiMGcFOfxtYDKhRzXDkwg cKipSRuXu6C+NzmcNOkmiOqyihLz7Kjc+Y7+mG8/pIVqTOikELN5kJlBamAI29IbFtMQgk HxHFZAGOb1b2yerNXU/5z/OF9OWlLK0= X-MC-Unique: lZSj7w0gPZeRnhFWm37quA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 9/9] qemu: Stop virQEMUCaps propagation into qemuHostdevPreparePCIDevices() Date: Mon, 24 Apr 2023 12:41:48 +0200 Message-Id: <5c04f3e02396d93413f540b158417ac751612d54.1682332714.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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: 1682332935405100001 Content-Type: text/plain; charset="utf-8"; x-default="true" After previous cleanups, qemuHostdevPreparePCIDevices() no longer needs virQEMUCaps. Drop its passing from callers. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/qemu/qemu_hostdev.c | 5 +---- src/qemu/qemu_hostdev.h | 2 -- src/qemu/qemu_hotplug.c | 4 ++-- src/qemu/qemu_process.c | 3 +-- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 49347019ea..f329442f8c 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -181,7 +181,6 @@ qemuHostdevPreparePCIDevices(virQEMUDriver *driver, const unsigned char *uuid, virDomainHostdevDef **hostdevs, int nhostdevs, - virQEMUCaps *qemuCaps G_GNUC_UNUSED, unsigned int flags) { return virHostdevPreparePCIDevices(driver->hostdevMgr, @@ -261,7 +260,6 @@ qemuHostdevPrepareMediatedDevices(virQEMUDriver *driver, int qemuHostdevPrepareDomainDevices(virQEMUDriver *driver, virDomainDef *def, - virQEMUCaps *qemuCaps, unsigned int flags) { if (!def->nhostdevs && !def->ndisks) @@ -271,8 +269,7 @@ qemuHostdevPrepareDomainDevices(virQEMUDriver *driver, return -1; =20 if (qemuHostdevPreparePCIDevices(driver, def->name, def->uuid, - def->hostdevs, def->nhostdevs, - qemuCaps, flags) < 0) + def->hostdevs, def->nhostdevs, flags)= < 0) return -1; =20 if (qemuHostdevPrepareUSBDevices(driver, def->name, diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h index 2d484db878..3e9adc57a9 100644 --- a/src/qemu/qemu_hostdev.h +++ b/src/qemu/qemu_hostdev.h @@ -52,7 +52,6 @@ int qemuHostdevPreparePCIDevices(virQEMUDriver *driver, const unsigned char *uuid, virDomainHostdevDef **hostdevs, int nhostdevs, - virQEMUCaps *qemuCaps, unsigned int flags); int qemuHostdevPrepareUSBDevices(virQEMUDriver *driver, const char *name, @@ -73,7 +72,6 @@ int qemuHostdevPrepareMediatedDevices(virQEMUDriver *driv= er, int nhostdevs); int qemuHostdevPrepareDomainDevices(virQEMUDriver *driver, virDomainDef *def, - virQEMUCaps *qemuCaps, unsigned int flags); =20 void qemuHostdevReAttachOneNVMeDisk(virQEMUDriver *driver, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index bf9d16e82b..b8b0a107aa 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1473,8 +1473,8 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver, =20 if (!cfg->relaxedACS) flags |=3D VIR_HOSTDEV_STRICT_ACS_CHECK; - if (qemuHostdevPreparePCIDevices(driver, vm->def->name, vm->def->uuid, - &hostdev, 1, priv->qemuCaps, flags) <= 0) + if (qemuHostdevPreparePCIDevices(driver, vm->def->name, + vm->def->uuid, &hostdev, 1, flags) < = 0) return -1; =20 if (qemuDomainAdjustMaxMemLockHostdev(vm, hostdev) < 0) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 75a1d88cd7..8d7fd28e37 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7164,8 +7164,7 @@ qemuProcessPrepareHost(virQEMUDriver *driver, hostdev_flags |=3D VIR_HOSTDEV_STRICT_ACS_CHECK; if (flags & VIR_QEMU_PROCESS_START_NEW) hostdev_flags |=3D VIR_HOSTDEV_COLD_BOOT; - if (qemuHostdevPrepareDomainDevices(driver, vm->def, priv->qemuCaps, - hostdev_flags) < 0) + if (qemuHostdevPrepareDomainDevices(driver, vm->def, hostdev_flags) < = 0) return -1; =20 VIR_DEBUG("Preparing chr device backends"); --=20 2.39.2