Skip to content

Commit 089722e

Browse files
Li ZheAlex Williamson
authored andcommitted
vfio/type1: introduce a new member has_rsvd for struct vfio_dma
Introduce a new member has_rsvd for struct vfio_dma. This member is used to indicate whether there are any reserved or invalid pfns in the region represented by this vfio_dma. If it is true, it indicates that there is at least one pfn in this region that is either reserved or invalid. Signed-off-by: Li Zhe <lizhe.67@bytedance.com> Reviewed-by: David Hildenbrand <david@redhat.com> Link: https://lore.kernel.org/r/20250814064714.56485-5-lizhe.67@bytedance.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent d108720 commit 089722e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/vfio/vfio_iommu_type1.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ struct vfio_dma {
9393
bool iommu_mapped;
9494
bool lock_cap; /* capable(CAP_IPC_LOCK) */
9595
bool vaddr_invalid;
96+
bool has_rsvd; /* has 1 or more rsvd pfns */
9697
struct task_struct *task;
9798
struct rb_root pfn_list; /* Ex-user pinned pfn list */
9899
unsigned long *bitmap;
@@ -782,6 +783,7 @@ static long vfio_pin_pages_remote(struct vfio_dma *dma, unsigned long vaddr,
782783
}
783784

784785
out:
786+
dma->has_rsvd |= rsvd;
785787
ret = vfio_lock_acct(dma, lock_acct, false);
786788

787789
unpin_out:

0 commit comments

Comments
 (0)