From nobody Tue Feb 10 12:14:31 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=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1681366244; cv=none; d=zohomail.com; s=zohoarc; b=e5ky7zeK1flW9lX71XWInzht/ymxrcFuraKm+YBUKXRdlzD9kqZkg/53/nJO8ic8a7qU1Pd7ZX5djp4ouOfRqzKCiaOql2c0JGlKN8gfeAcri9FkCUQhi3OMpQh9AxOVkBd9HKiPJSOPZPiXBwrg4XQzH4JFepXQlDjViqGFf8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1681366244; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Dl/caIcHVQZeDc/v5l4ByrFNyAI04I+nzmZ84u1kSWs=; b=aEUpxxt1r/RkMnfgnzgEZjX+jV/cDRnrMrnOdtFDwJhNmPa2taG1se6Ns0LP4qE61wNGAkyL5EEl4qYL+aDA/8ElLi6wEKPmiAFpIQsBynYBJNpxyye8wEhOSHzS+05hbhBP7VX/jiYtenZmVyUjDQsrsJwHVb2hYC2bUs8R04I= 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=fail 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 168136624406320.148724277814722; Wed, 12 Apr 2023 23:10:44 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-194-Vkt-k4scMaWYUbOqWSUq7w-1; Thu, 13 Apr 2023 02:10:35 -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 D24A93847083; Thu, 13 Apr 2023 06:10:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB7512166B29; Thu, 13 Apr 2023 06:10:30 +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 A881F19465A2; Thu, 13 Apr 2023 06:10:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B79551946597 for ; Thu, 13 Apr 2023 06:10:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 12E1D141511D; Thu, 13 Apr 2023 06:10:28 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0B26F1415117 for ; Thu, 13 Apr 2023 06:10:28 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E42C61C041B8 for ; Thu, 13 Apr 2023 06:10:27 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-48-kvow1_I3MyikV4Wy_3vyFw-1; Thu, 13 Apr 2023 02:10:25 -0400 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 23:09:21 -0700 Received: from duan-server-s2600bt.bj.intel.com ([10.240.192.143]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 23:09:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681366242; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Dl/caIcHVQZeDc/v5l4ByrFNyAI04I+nzmZ84u1kSWs=; b=FzIo1h2sC206u0VwtcUg0wBD4fbJ5Bga9bKxjbs+Hc9cb4hdUXDrlgL4+2kP7wTV3tDkuX Yl7OOB2gLO75+poB19pV62zj+SYkAA6dameGK1Gm7iJRjdIJV55G7aMBDouzYKZotwt0Ui Ej/VixO5AbHpdRpDSdVMzZkBdcLGVGo= X-MC-Unique: Vkt-k4scMaWYUbOqWSUq7w-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: kvow1_I3MyikV4Wy_3vyFw-1 X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="328211061" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="328211061" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="753853471" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="753853471" From: Zhenzhong Duan To: libvir-list@redhat.com Subject: [PATCH] qemu: Fix domxml-to-native command failure Date: Thu, 13 Apr 2023 14:07:32 +0800 Message-Id: <20230413060732.2310576-1-zhenzhong.duan@intel.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: intel.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1681366245017100001 Content-Type: text/plain; charset="utf-8"; x-default="true" virsh command domxml-to-native failed with below error but start command suceed for same domain xml. "internal error: invalid PCI passthrough type 'default'" If host pci device's driver attribute isn't defined in domain xml, qemu driver will choose a proper value based on host environment before starting qemu process. But this is missed in domxml-to-native command, add the same logic so domxml-to-native could pass. Signed-off-by: Zhenzhong Duan --- src/qemu/qemu_domain.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 63b13b6875c9..517c90f93f0a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11274,6 +11274,17 @@ qemuDomainPrepareHostdev(virDomainHostdevDef *host= dev, } } } + if (hostdev->mode =3D=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && + hostdev->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_= PCI) { + bool supportsPassthroughVFIO =3D qemuHostdevHostSupportsPassthroug= hVFIO(); + virDomainHostdevSubsysPCIBackendType *backend =3D &hostdev->source= .subsys.u.pci.backend; + + if (*backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT && + supportsPassthroughVFIO && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) { + *backend =3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO; + } + } =20 return 0; } --=20 2.25.1