From nobody Sun Feb 8 12:43:24 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=1629196924; cv=none; d=zohomail.com; s=zohoarc; b=BhxKHlAwXVCP88qhqx7FWvVPDoKiqCxoY7AbCau6rc7tO+KuuABRF4Emzps7/L+9/CiJWgX24ewLjGpiKNStQRc7fiymAWiPXHZXxcsJWkWDGY4QQrFsKRYXi+uOxAiuQ4pmvBeW9QhCRd02wbF5KO0ZfmKAWeajg4Fq5cb5E8E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629196924; 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=R3bOpSmRrL9A9RVCVsN/HKRlDkSmRpYvP//5NwyoAPc=; b=S1qwvHe/NDUnDjz5sYcy0F5ftaXwJ3b7s9TyBn9o0X8yCPBpTDLvYFLfq8wqQf2FtrRxvDklreNAEljMO/FRm1+BDNkUs1scODg9nQYNWiPyqFO94teItiPW0Wc3QTeuIez5xH6EdgLcgdS2xqSFIf/Q2rfMZjgxB+DvHmFh8Lk= 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 162919692482855.63221422983031; Tue, 17 Aug 2021 03:42:04 -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-296-vyTULNfINZmEdhVdk5ZGVQ-1; Tue, 17 Aug 2021 06:42:01 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1A17F1853032; Tue, 17 Aug 2021 10:41:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E85501017CE7; Tue, 17 Aug 2021 10:41:55 +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 B669C4A706; Tue, 17 Aug 2021 10:41:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17HAcKjC002802 for ; Tue, 17 Aug 2021 06:38:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 83B0D18032; Tue, 17 Aug 2021 10:38:20 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02C7F5C1D5 for ; Tue, 17 Aug 2021 10:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629196922; 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=R3bOpSmRrL9A9RVCVsN/HKRlDkSmRpYvP//5NwyoAPc=; b=AfZIcC+4hJXxcxWGPAqgPb3G7BGGCCaJTX6xs1Wg/HpQLYA1qeue+++qpHXBk+QL3sOR7F smwdnh6256VKR7NWZVOlbb/KbrqifEd2HBWmeteUD8SIXn9pf51xuFALkhp6BaT/rb3vsu x1lYaHsA9U/sanAhWC3KABN0wrp06ng= X-MC-Unique: vyTULNfINZmEdhVdk5ZGVQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH v4 5/5] qemu: implement support for Fibre Channel VMID Date: Tue, 17 Aug 2021 12:38:10 +0200 Message-Id: <15d35704cbc40e81dd42956a27fbff2334fad6fc.1629196554.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1629196926302100001 Content-Type: text/plain; charset="utf-8" Based on kernel commit messages the interface is /sys/class/fc/fc_udev_device/appid_store where we need to write the following string "$INODE:$APPID". $INODE is the VM root cgroup inode in hexadecimal and $APPID is user provided string that will be attached to each FC frame for the VM within the cgroup identified by inode and has limit 128 bytes. Signed-off-by: Pavel Hrdina Reviewed-by: Martin Kletzander --- src/qemu/qemu_cgroup.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index f2d99abcfa..2269a8655f 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -904,6 +904,33 @@ qemuSetupCpuCgroup(virDomainObj *vm) } =20 =20 +static int +qemuSetupCgroupAppid(virDomainObj *vm) +{ + qemuDomainObjPrivate *priv =3D vm->privateData; + int inode =3D virCgroupGetInode(priv->cgroup); + const char *path =3D "/sys/class/fc/fc_udev_device/appid_store"; + g_autofree char *appid =3D NULL; + virDomainResourceDef *resource =3D vm->def->resource; + + if (!resource || !resource->appid) + return 0; + + if (inode < 0) + return -1; + + appid =3D g_strdup_printf("%X:%s", inode, resource->appid); + + if (virFileWriteStr(path, appid, 0) < 0) { + virReportSystemError(errno, + _("Unable to write '%s' to '%s'"), appid, pat= h); + return -1; + } + + return 0; +} + + static int qemuInitCgroup(virDomainObj *vm, size_t nnicindexes, @@ -1096,6 +1123,9 @@ qemuSetupCgroup(virDomainObj *vm, if (qemuSetupCpusetCgroup(vm) < 0) return -1; =20 + if (qemuSetupCgroupAppid(vm) < 0) + return -1; + return 0; } =20 --=20 2.31.1