From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 53F6539CCE5 for ; Thu, 30 Jul 2026 23:43:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785455001; cv=none; b=nlaTJI4ctPuc5/yqu0TvDbXN71ErG2id2fj8JqLuiM0VbhKr5PNfB1KZfriShtywsmNY9so5DKHPGEvv7IQz1fHUmJjUICn5QKvYaAHLsOCLQmdUd3QZPT4kSlrGaaroeOnF73JjrH7Dewg9YourOzPoQMulyChFB2BkeNHvRes= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785455001; 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=ou2RPhYuvGCHVnD7KuwofeR5Ug1+dLkhz2lfwHXOrhoEGG/6UamLpNB1nWLYNF7/pErWQVqp17CWJpiQ0MgvYtiyrVgCBz5DRtlsF4LQTbontTR3CiLmwn9kwFIhi9pSp7EE4ixfRaJw8q9lJK6rsq/xDE3NVlM3UugHGZ5NYqw= 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.181 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-f181.google.com with SMTP id d9443c01a7336-2ccdf36f63dso58645ad.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=cpsKSWwLUFG5MZSapxyS+D7tny5IJM9Cut/oL1SkLRoE3uLwNx0MVlu6UCJ7tZC3vy XYa2f/c01TOK4VzfDB0s4VtCNZClDFH3vVzfS4fN8rIJE7SkIhkvtAwnRPzR1B+dLHfv gwOwRRY7MGLb1vAsnRmpHd+uCpk2C69RgfmvyMySTTo9v6aOFWc2Ael13R5kHTc/2F/D eSrpKajYYQdVhAbD7FRwwhn6qszVZUyvVXYPtqDk5YXxvBOLOOBMcahecv+ZHAvhawa7 FLrw7BDHTIZx1xRF5CqX1tsJmBOSptTBj9q3569DBHtPvTai7XnNBSNOwcQyLYjghnly o2Eg== X-Forwarded-Encrypted: i=1; AHgh+Rp0xoDZaljLnDr/6A15PRR3MNqcs42aITC/cxGqecnNALZgsNx0WQUPwBfTN7Vzde5wXfe8AvhLYInVqg==@vger.kernel.org X-Gm-Message-State: AOJu0YxTrdpzGAMoBwYVtsv59Z0RsUSZPSm9r2qZcMOnPFGH1lfnJRg2 rA0jIeqsn9Vu6ywtD4wPM1CYK3btwrLt71eTON4UKK+EknnADQ3EWDO95eWm4CZGrQ== X-Gm-Gg: AR+sD12iEZNptsmimdOkCDfoMQBoTfyLSv2rg99SKWcdrat5JnRxz7epoE1fHgu7L11 rSTah/shZQVwkoHQH3pEbZBtBf0qSfQW12Ag+WcHLPv3ArF9q4vDILNe/gD7NjoP3Oxz6hLcDc7 j1IZvCHAOxhNsrL+YWHFKqCTMqmTuIZwlme1LDsFReSJ3jo/ji8n1sPkODxiB94HR4L3j+kskDL wDwrYAsd9pCyi9CV/g2DODs1F4dju0x4dFfNdvLI66qYnCWYRVvoHkKTI7zkWiLLoN+I5irCi+b mCKBROAv7LgSbqKODZfDbgRg6pUbQqQfg8hTnCXPslgC6RifiMaDGIEAJIX3Ee4ZtdJTjclCdWc So9K/e4ocBNIOsZABN0n5+mIV2ajzvP8T7RLOqfqXzWYmQqXJLtTsunVeHXmdTCJjcjwMzjZtaH bo0DdBHe01OV1tygajLppLr/SDpVGjNiiEZU4ux+609opb6rrFV2TnMT5mXCF3ovke154MMQY9+ UDcE+3l0+lsEMxqZLgcFbc= 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-media@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