From nobody Sat Feb 7 07:30:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1592317811; cv=none; d=zohomail.com; s=zohoarc; b=g8wFCdaVMr2zhVb5pPdVEZbQN1+HHPjmql2MMG+bpx8OWmU8OgdEEkhp9xsFW53F663tEcmRC9Ah3xUvYeJaLI4IA1nfzCpTpR0nnZGIzMtvhmhwkYaxSaDSuWsbrBTCHAFTVDeeOGetvxzRGIViFtc8Pix1NKV/gyRNaRhCN3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592317811; 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=ii+olbe2Uy4miVLjoo4ZwYcv5CUj4ARLvGz4FjcW1is=; b=SBfgaKqmsjR+LuxmJ5PzxVeQm6lxwpo13yoahZ572gNcUAWB6oW0nLu+mpVISQ6zLLVC8o69VuQtpeABak62hNdXtYc5DQR1q+hl3gW1CUWoc9CYCCYH/cR5651e4SyhqgoYsUEK3/oMgZg/nJ/neBnzmhJ98l1vj0DZzn4vWn0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1592317811383576.6184229767024; Tue, 16 Jun 2020 07:30:11 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-491--P8900ISNRCy1ePFg2TxUQ-1; Tue, 16 Jun 2020 10:28:27 -0400 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 610898B62F0; Tue, 16 Jun 2020 14:28:20 +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 40B2A707C6; Tue, 16 Jun 2020 14:28:20 +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 09E73180599D; Tue, 16 Jun 2020 14:28:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05GES5Fc020346 for ; Tue, 16 Jun 2020 10:28:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id A355178F0F; Tue, 16 Jun 2020 14:28:05 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-33.phx2.redhat.com [10.3.113.33]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58AB37890A; Tue, 16 Jun 2020 14:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592317809; 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=ii+olbe2Uy4miVLjoo4ZwYcv5CUj4ARLvGz4FjcW1is=; b=Ky6JjJveEGvgMmNVEw9UCO+r+gHNr4jCSnyh/3FGt467poc8PMx+sosp0QesyGmlReLcy2 RgcCYcF3PLo/kp9V/1vdt8369hIy19VP7fnW+y1g1VHHQLB/zaNXTW5CnjJIvFLnpDm6DY PNfBuMsF2VdooLoEZcDeD/amK9q6R9o= X-MC-Unique: -P8900ISNRCy1ePFg2TxUQ-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v3 05/11] nodedev: store mdev UUID in mdev caps Date: Tue, 16 Jun 2020 09:27:53 -0500 Message-Id: <20200616142759.4625-6-jjongsma@redhat.com> In-Reply-To: <20200616142759.4625-1-jjongsma@redhat.com> References: <20200616142759.4625-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, eskultet@redhat.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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In order to allow libvirt to create and start new mediated devices, we need to be able to verify that the device has been started. In order to do this, we'll need to save the UUID of newly-discovered devices within the virNodeDevCapMdev structure. This allows us to search the device list by UUID and verify whether the expected device has been started. Signed-off-by: Jonathon Jongsma Reviewed-by: Erik Skultety --- src/conf/node_device_conf.c | 1 + src/conf/node_device_conf.h | 1 + src/node_device/node_device_udev.c | 5 ++--- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index b1dfe81653..06e5924bef 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -2214,6 +2214,7 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) break; case VIR_NODE_DEV_CAP_MDEV: VIR_FREE(data->mdev.type); + VIR_FREE(data->mdev.uuid); for (i =3D 0; i < data->mdev.nattributes; i++) virMediatedDeviceAttrFree(data->mdev.attributes[i]); VIR_FREE(data->mdev.attributes); diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index e3e1e788d4..9b8c7aadea 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -141,6 +141,7 @@ typedef virNodeDevCapMdev *virNodeDevCapMdevPtr; struct _virNodeDevCapMdev { char *type; unsigned int iommuGroupNumber; + char *uuid; virMediatedDeviceAttrPtr *attributes; size_t nattributes; }; diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 386f23ef3a..bdf0b03add 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1013,7 +1013,6 @@ udevProcessMediatedDevice(struct udev_device *dev, virNodeDeviceDefPtr def) { int ret =3D -1; - const char *uuidstr =3D NULL; int iommugrp =3D -1; char *linkpath =3D NULL; char *canonicalpath =3D NULL; @@ -1041,8 +1040,8 @@ udevProcessMediatedDevice(struct udev_device *dev, =20 data->type =3D g_path_get_basename(canonicalpath); =20 - uuidstr =3D udev_device_get_sysname(dev); - if ((iommugrp =3D virMediatedDeviceGetIOMMUGroupNum(uuidstr)) < 0) + data->uuid =3D g_strdup(udev_device_get_sysname(dev)); + if ((iommugrp =3D virMediatedDeviceGetIOMMUGroupNum(data->uuid)) < 0) goto cleanup; =20 if (udevGenerateDeviceName(dev, def, NULL) !=3D 0) --=20 2.21.3