From nobody Sun Feb 8 18:39:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A3B71E22E9; Wed, 21 Jan 2026 15:45:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769010312; cv=none; b=eV1poGmf/ZPCMUSi5USchb9vxZKd4LOx23VeDOfuxezN9y7LhMfKTEqsV7o+lPSvFbSfoIyX/KBLV6WDAyWSXMmcYzrnQTReRESRmWw77+iY7LwRGudFeuFX2vzr4IIqSRoGOkFfD70JbCjvDta5BNns2X8QK2OMX49MBVxzvGs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769010312; c=relaxed/simple; bh=EeKQ6zSaJnyAFeB3cJ8aa28FFQoX0zryimYfy1amUHs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=UVrLKb1m8hn1Sz1vgMFYny/Xos1gQ78h+nBKc+4kgZqYuAVm6Rt/1lVOyEXYRFPVLwP3+RjtHYxTbiZgPKn7togmcLjidtDvu8shtbgZYDFTrhF+1Qt0FBnqvFtOlLDBFVZq5A/9UTYWd3GKdWgZip3kXgfc1j0QNCCCIrLLubE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=joNgUbiQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="joNgUbiQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BAF9C4CEF1; Wed, 21 Jan 2026 15:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769010311; bh=EeKQ6zSaJnyAFeB3cJ8aa28FFQoX0zryimYfy1amUHs=; h=From:To:Cc:Subject:Date:From; b=joNgUbiQAV60eXiV/8c0Y2pPkAjsqXvOFw6DVKQxizK6etRiX/nrCZqNmrHnLmd5I Zdj6wfABA3m5KV7vLkMTTjv12OUkhhxZRUub33/Brz/K8QFlhERqIjKFsRdqSJWdJR 10jdm+UkdCJ2q2CCxfVvvuY+YbWOR2VKIPJFgaHD21qzTXGFfbuP6dvNNpzAi0DiW7 /lpMmp8pQ3JUoFLdO4dYbXjdyHayar7GnBx9ZbQYJdkhyVByvyecSAVxbacvaZFPyt 2TaTzbpAii2JDCqIzPmb+Ybr6UmRn+mTRjRiJyrDoZtloe+nwH8juLAcatyj+gFLyE qnyDVOpuutVIQ== From: Leon Romanovsky To: Alex Williamson , Ankit Agrawal , Jason Gunthorpe , Kevin Tian , Vivek Kasireddy Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH vfio-rc] vfio: Prevent from pinned DMABUF importers to attach to VFIO DMABUF Date: Wed, 21 Jan 2026 17:45:02 +0200 Message-ID: <20260121-vfio-add-pin-v1-1-4e04916b17f1@nvidia.com> X-Mailer: git-send-email 2.52.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Change-ID: 20260121-vfio-add-pin-2229148da56e X-Mailer: b4 0.15-dev-47773 Content-Transfer-Encoding: quoted-printable From: Leon Romanovsky Some pinned importers, such as non-ODP RDMA ones, cannot invalidate their mappings and therefore must be prevented from attaching to this exporter. Fixes: 5d74781ebc86 ("vfio/pci: Add dma-buf export support for MMIO regions= ") Signed-off-by: Leon Romanovsky Reviewed-by: Jason Gunthorpe Reviewed-by: Pranjal Shrivastava --- This is an outcome of this discussion about revoke functionality. https://lore.kernel.org/all/20260121134712.GZ961572@ziepe.ca Thanks --- drivers/vfio/pci/vfio_pci_dmabuf.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/vfio/pci/vfio_pci_dmabuf.c b/drivers/vfio/pci/vfio_pci= _dmabuf.c index d4d0f7d08c53..4be4a85005cb 100644 --- a/drivers/vfio/pci/vfio_pci_dmabuf.c +++ b/drivers/vfio/pci/vfio_pci_dmabuf.c @@ -20,6 +20,16 @@ struct vfio_pci_dma_buf { u8 revoked : 1; }; =20 +static int vfio_pci_dma_buf_pin(struct dma_buf_attachment *attachment) +{ + return -EOPNOTSUPP; +} + +static void vfio_pci_dma_buf_unpin(struct dma_buf_attachment *attachment) +{ + /* Do nothing */ +} + static int vfio_pci_dma_buf_attach(struct dma_buf *dmabuf, struct dma_buf_attachment *attachment) { @@ -76,6 +86,8 @@ static void vfio_pci_dma_buf_release(struct dma_buf *dmab= uf) } =20 static const struct dma_buf_ops vfio_pci_dmabuf_ops =3D { + .pin =3D vfio_pci_dma_buf_pin, + .unpin =3D vfio_pci_dma_buf_unpin, .attach =3D vfio_pci_dma_buf_attach, .map_dma_buf =3D vfio_pci_dma_buf_map, .unmap_dma_buf =3D vfio_pci_dma_buf_unmap, --- base-commit: acf44a2361b8d6356b71a970ab016065b5123b0e change-id: 20260121-vfio-add-pin-2229148da56e Best regards, -- =20 Leon Romanovsky