From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50DF13988E2 for ; Thu, 30 Jul 2026 23:43:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785455002; cv=none; b=h3+OrGuZKVY1ObRYcAxIeOfeoWqtDzC2G6BXuQsXTh21OivkkW8CN5H/ZuDacl4umJSHY0HuzHI+2Y+yGxVCItNEbRPJ6pplExSHs1if7qIKCBiTUd24RGL9kcfgmj70qRcCXNc5gNplgnI9VjG8BH78ZarWpHGmAfYE2Zus//Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785455002; c=relaxed/simple; bh=EtBv4ug8/GzoJNUW3Lwe7MHv5uNlqeWbx0nW+DTkR4Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aVOqNdCRj2o6UishmsaDqfWcwwaCGQA1IsdIIyYQLT0mIsXQieSZ6ShKru8exK2IBPW4H0Gme+DBydbvBI/TFTb6tvGk4zHwqtA+5DjSBrAPs2vDUxOyeHTK4RilAkl95RW1F8/hOqLMqzB/FHNo6L5Y75bIrj40JnLGOijs9RQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ZY0MoCp/; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZY0MoCp/" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2ccdf36f63dso58615ad.0 for ; Thu, 30 Jul 2026 16:43:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785455000; x=1786059800; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=45rkLKaqdLBM9DjpkbwhGyUvtKXILeitur9eOChkeqI=; b=ZY0MoCp/FbUwTdDgLNAVNIQ7MpDiDYZ5lMco63yU8nI5ewRwmx8xChNr3jzpTgiTnk 0Vhd7UCPVhyyw0cglLA7VHJm9QVI/ZytPf2oVUzW8KZ6AdL9WmRSlTuCUSC2aPghPB+g 9Zwg1oUv9zALj6KaH3/8WR5sjw5LYCpuS3i60Fl7t8DA9SGjSPBy7hiyq8rE2QC1dJEi drcG9rI1tctp1SHY63CTJhTZGRd23UtxnnP9XIV51aLpXFEHWsyUH7QUJLsNduvSSxfl jdqrQQnfuRsKHt8qUZvwsV8D/DtrJiUfItHM4HjVUb+CbLB8z5txXYk+kvOBauoa7tFp +oXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785455000; x=1786059800; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=45rkLKaqdLBM9DjpkbwhGyUvtKXILeitur9eOChkeqI=; b=OL+MAmrh4Mi2BPdct4oN90EumNMYc4bi+8B2fs7BDpEEbgpKl0g73NgbgxYug6VmQ7 xEqW5btXifkuqAwAZ7T2tHojlJu6rOoK9Ro2Hk4LnzMaxdpBg3ijPZ1ySc96fBgTW7Wi m7KF0mYJp4Edz6u+9glYfomXdiIRkjXMLgHw0waaQxbHxHO4h/Lo1HQ3yXep5PAk+HjF P/CaG1rEQ2YWrL8ieLAnid0cF76Ofw+ilV3dw4m2QJewkYKT0kaiVbQZ0h6yNqDCMy5p h/CRHeXeFbLDtdO5uC6VRvNwhoIFF50cEB6A134n0OBu0UUXGmTx/GuAB5Ottk39sVqV k90A== X-Forwarded-Encrypted: i=1; AHgh+Rrl232TB8EaD2gCybhyLC/KbItf/Eralk7PMsdhWdgYfVlPHQQPb87J3DFZJea4WHkKGJVwcB0GWxC+3w4=@vger.kernel.org X-Gm-Message-State: AOJu0YyBeP9pJKSOvjYowbDuvLzLp5a4jbbqBS0av5Dt/A8AZLklXUDu QVPAhHODlAfI50sv0oIlYUDOSzXP/yxkpebhv3OxaUXIxUIco17R0DAzPL8iHmMOFQ== X-Gm-Gg: AR+sD12Vt79vUYHibdT/3JCOEmVuyqBkhURaZhbt4jtZZx/eGCg5Q7oWoSdu7QoycQ0 LKYuzrB8Jy5M/wHqZaS7wp9kfzKJvCU+Siy/legLrcYzQw0f21qUo34uGMRowZAluWZ0jiLZkQI +FNy6UgjsSYyHFIG/PSGKB6QETExsAQHVgK9SV3s0kwt4R6TqU9Z/vg5FZaj0rG+oFa+84pywrY 3V8kmYfA0yfW+9AzP0QLbB0R65OIDrHjH3iPKT/Lk9cTAyV6xoX9VoZxjbigpfbr7XF3YQZoNmY VrSVd+p7kGlzu3UNcYtoWFcKYGb4k15Y94mp85HazwHT1ExI2cjWoG+G8ck9gRVVrL/UinCKhu2 NaqStBuJXTR9VpSPUvRyU5mBaQU5/FuGxdkA5eYzW+YXPwb+wy1pbgchey/8b3wAI9twSnUxBSE UE8wifXuXk3kx/n5JAhjWwkON5XEYy7G1vp/JbUKYAfWBOi+0dOMuxmeeRStIMG8RpPuQ8V5sDQ TKUFW1WL3Sk6FK3GgPoLOU= X-Received: by 2002:a17:902:f647:b0:2c7:b1e7:501e with SMTP id d9443c01a7336-2d043d582c9mr2482505ad.3.1785454999087; Thu, 30 Jul 2026 16:43:19 -0700 (PDT) Received: from google.com (21.168.124.34.bc.googleusercontent.com. [34.124.168.21]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13e7271f010sm29587416c88.9.2026.07.30.16.43.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jul 2026 16:43:18 -0700 (PDT) Date: Thu, 30 Jul 2026 23:43:10 +0000 From: Pranjal Shrivastava To: Matt Evans Cc: Alex Williamson , Leon Romanovsky , Jason Gunthorpe , Alex Mastro , Christian =?iso-8859-1?Q?K=F6nig?= , Bjorn Helgaas , Logan Gunthorpe , Kevin Tian , Longfang Liu , Mahmoud Adam , David Matlack , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Sumit Semwal , Ankit Agrawal , Alistair Popple , Vivek Kasireddy , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, kvm@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH v5 9/9] vfio/pci: Permanently revoke a DMABUF on request Message-ID: References: <20260715174737.15287-1-matt@ozlabs.org> <20260715174737.15287-10-matt@ozlabs.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <20260715174737.15287-10-matt@ozlabs.org> On Wed, Jul 15, 2026 at 06:47:32PM +0100, Matt Evans wrote: > Expand the VFIO DMABUF revocation state to three states: > Not revoked, temporarily revoked, and permanently revoked. > > The first two are for existing transient revocation, e.g. across a > function reset, and the DMABUF is put into the last in response to a > new VFIO feature VFIO_DEVICE_FEATURE_DMA_BUF_REVOKE. > > VFIO_DEVICE_FEATURE_DMA_BUF_REVOKE passes a DMABUF by fd and requests > that the DMABUF is permanently revoked. On success, it's guaranteed > that the buffer can never be imported/attached/mmap()ed in future, > that dynamic imports have been cleanly detached, and that all mappings > have been made inaccessible/PTEs zapped. > > This is useful for lifecycle management, to reclaim VFIO PCI BAR > ranges previously delegated to a subordinate client process: by > revoking, the driver process can ensure that the loaned resources are > made inaccessible when the client is deemed "done". The original > DMABUF is defunct, and BAR resources can then be safely re-exported > for use by new clients. > > Refactor the revocation code out of vfio_pci_dma_buf_move() to a > function common to move and the new feature request path. Note: this > now only calls dma_buf_invalidate_mappings()/dma_resv_wait_timeout() > on the revoke path, whereas vfio_pci_dma_buf_move() originally called > them for both revoke and (unnecessarily) un-revoke. > > Signed-off-by: Matt Evans > --- Reviewed-by: Pranjal Shrivastava Thanks, Praan