Re: [PATCH 9/9] vfio/pci: Add mmap() attributes to DMABUF feature

Jason Gunthorpe
2026-04-24T18:32:02Z

On Thu, Apr 16, 2026 at 06:17:52AM -0700, Matt Evans wrote:
> A new field is reserved in vfio_device_feature_dma_buf.flags to
> request CPU-facing memory type attributes for mmap()s of the buffer.
> Add a flag VFIO_DEVICE_FEATURE_DMA_BUF_ATTR_WC, which results in WC
> PTEs for the DMABUF's BAR region.
>
> Signed-off-by: Matt Evans <mattev@meta.com>
> ---
> drivers/vfio/pci/vfio_pci_dmabuf.c | 15 +++++++++++++--
> drivers/vfio/pci/vfio_pci_priv.h | 1 +
> include/uapi/linux/vfio.h | 12 +++++++++---
> 3 files changed, 23 insertions(+), 5 deletions(-)

Nice and simple

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

> @@ -1549,8 +1551,12 @@ struct vfio_region_dma_range {
> struct vfio_device_feature_dma_buf {
> __u32 region_index;
> __u32 open_flags;
> - __u32 flags;
> - __u32 nr_ranges;
> + __u32 flags;
> + /* Flags sub-field reserved for attribute enum */
> +#define VFIO_DEVICE_FEATURE_DMA_BUF_ATTR_MASK (0xfU << 28)
> +#define VFIO_DEVICE_FEATURE_DMA_BUF_ATTR_UC (0 << 28)
> +#define VFIO_DEVICE_FEATURE_DMA_BUF_ATTR_WC (1 << 28)
> + __u32 nr_ranges;

Though why did the diff format like this, is there some whitespace
changes? All this did is insert defines it didn't change the members

Jason