From nobody Sun Feb 8 17:48:18 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linux.intel.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1702914342610790.5189280178608; Mon, 18 Dec 2023 07:45:42 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7F37C1BDC; Mon, 18 Dec 2023 10:45:41 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 300901BCD; Mon, 18 Dec 2023 10:37:26 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id C378C1B9A; Mon, 18 Dec 2023 10:36:56 -0500 (EST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id D3CEC1A3F for ; Mon, 18 Dec 2023 10:36:31 -0500 (EST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Dec 2023 07:35:30 -0800 Received: from vivk-mobl.amr.corp.intel.com ([10.215.113.98]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Dec 2023 07:35:28 -0800 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-IronPort-AV: E=McAfee;i="6600,9927,10928"; a="2614132" X-IronPort-AV: E=Sophos;i="6.04,286,1695711600"; d="scan'208";a="2614132" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10928"; a="899009126" X-IronPort-AV: E=Sophos;i="6.04,286,1695711600"; d="scan'208";a="899009126" From: Vivek Kashyap To: devel@lists.libvirt.org, ciara.loftus@intel.com Subject: [vf-token 5/8] qemu: Introduce validation for vf-token Date: Mon, 18 Dec 2023 21:05:06 +0530 Message-Id: <20231218153509.1285-6-vivek.kashyap@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231218153509.1285-1-vivek.kashyap@linux.intel.com> References: <20231218153509.1285-1-vivek.kashyap@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: SLNQBLIJY6LZ7RI6PKTL3MXIMOL5GKO4 X-Message-ID-Hash: SLNQBLIJY6LZ7RI6PKTL3MXIMOL5GKO4 X-MailFrom: vivek.kashyap@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1702914344406100001 Introduce a validation function for vf-token support in qemu and generate vf-token device attribute in qemu command line Signed-off-by: Vivek Kashyap --- src/qemu/qemu_command.c | 8 ++++++++ src/qemu/qemu_validate.c | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 54fb8220e8..0e81a3ed73 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4706,6 +4706,7 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def, virDomainNetTeamingInfo *teaming; g_autofree char *host =3D virPCIDeviceAddressAsString(&pcisrc->addr); const char *failover_pair_id =3D NULL; + g_autofree char *token =3D NULL; =20 /* caller has to assign proper passthrough backend type */ switch (pcisrc->backend) { @@ -4732,9 +4733,16 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def, teaming->persistent) failover_pair_id =3D teaming->persistent; =20 + if ((dev->info->pciAddrExtFlags & VIR_PCI_ADDRESS_EXTENSION_VFTOKEN) && + pcisrc->addr.token.isSet) { + token =3D g_new0(char, VIR_UUID_STRING_BUFLEN); + virUUIDFormat(pcisrc->addr.token.uuid, token); + } + if (virJSONValueObjectAdd(&props, "s:driver", "vfio-pci", "s:host", host, + "S:vf-token", token, "s:id", dev->info->alias, "p:bootindex", dev->info->effectiveBootIndex, "S:failover_pair_id", failover_pair_id, diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index e475ad035e..13114ca3d1 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1364,6 +1364,24 @@ qemuValidateDomainDeviceDefZPCIAddress(virDomainDevi= ceInfo *info, } =20 =20 +static int +qemuValidateDomainDeviceDefVFTokenId(virDomainDeviceInfo *info, + virQEMUCaps *qemuCaps) +{ + virPCIDeviceToken *vftoken =3D &info->addr.pci.token; + + if (virPCIVFIOTokenIDIsPresent(vftoken) && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VFIO_VFTOKEN)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", + _("This QEMU binary doesn't support vf token ids")); + return -1; + } + + return 0; +} + + static int qemuValidateDomainDeviceDefAddressDrive(virDomainDeviceInfo *info, const virDomainDef *def, @@ -1483,6 +1501,8 @@ qemuValidateDomainDeviceDefAddress(const virDomainDev= iceDef *dev, case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI: if (qemuValidateDomainDeviceDefZPCIAddress(info, qemuCaps) < 0) return -1; + if (qemuValidateDomainDeviceDefVFTokenId(info, qemuCaps) < 0) + return -1; break; =20 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE: --=20 2.33.8 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org