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

From: Matt Evans

Date: Wed Jun 03 2026 - 10:32:47 EST


Hi Alex,

On 02/06/2026 20:14, Alex Williamson wrote:

On Tue, 2 Jun 2026 17:50:04 +0100
Matt Evans <mattev@xxxxxxxx> wrote:
On 29/05/2026 00:14, Alex Williamson wrote:
On Wed, 27 May 2026 03:23:12 -0700
Matt Evans <mattev@xxxxxxxx> wrote:
+ uint32_t old_attr = priv->memattr;
+
+ if (flags & VFIO_DEVICE_FEATURE_SET) {
+ switch(db_attr.memattr) {
+ case VFIO_DEVICE_FEATURE_DMA_BUF_MEMATTR_NC:
+ case VFIO_DEVICE_FEATURE_DMA_BUF_MEMATTR_WC:
+ priv->memattr = db_attr.memattr;
+ break;
+
+ default:
+ ret = -ENOTSUPP;

-EINVAL

I'd like to push back on this one; ENOTSUPP distinguishes trying to use
a wild attribute value from all manner of other screwups such as
trying to GET (with it no longer supported), passing an fd that isn't a
DMABUF, etc.

I'm not wed to the value ENOTSUPP, just something distinctive versus the
other errors userspace might see, and that value seems appropriate.

It needs to be a uAPI errno though, aiui ENOTSUPP is an internal NFS
errno. How about EOPNOTSUPP? Thanks,

Ew, right! TIL, and it's caught by checkpatch too (which I fastidiously run but still missed this somehow...) :( "ENOTSUPP is not a standard error code and should be avoided in new patches. EOPNOTSUPP should be used instead."

Fixed.

Thanks,


Matt