Introduce a per-attribute UVERBS_ATTR_UMEM model so each uverbs command's umem set is explicit in its UAPI definition. Add driver-facing wrapper helpers that pin a umem on demand from an attribute or a VA addr; the driver owns the returned umem and releases it from its destroy/error paths.
Showing the changes to include/uapi (1 of 5 files). Show all
Unified · Split
| @@ -273,4 +273,31 @@ struct ib_uverbs_gid_entry { · 272 unmodified lines | |||
| 273 | __u32 netdev_ifindex; /* It is 0 if there is no netdev associated with it */ | 273 | __u32 netdev_ifindex; /* It is 0 if there is no netdev associated with it */ |
| 274 | }; | 274 | }; |
| 275 | 275 | ||
| 276 | enum ib_uverbs_buffer_type { | ||
| 277 | IB_UVERBS_BUFFER_TYPE_DMABUF, | ||
| 278 | IB_UVERBS_BUFFER_TYPE_VA, | ||
| 279 | }; | ||
| 280 | |||
| 281 | /* | ||
| 282 | * Describes a single buffer backed by dma-buf or user virtual address. | ||
| 283 | * Used as the payload of a per-attribute UVERBS_ATTR_UMEM-typed attribute. | ||
| 284 | * | ||
| 285 | * @type: buffer type from enum ib_uverbs_buffer_type | ||
| 286 | * @fd: dma-buf file descriptor (valid for IB_UVERBS_BUFFER_TYPE_DMABUF) | ||
| 287 | * @flags: required flags; the kernel rejects the call with -EINVAL if any | ||
| 288 | * bit is not understood. No bits are defined yet. | ||
| 289 | * @optional_flags: advisory flags; bits the kernel does not understand are | ||
| 290 | * silently ignored. No bits are defined yet. | ||
| 291 | * @addr: offset within dma-buf, or user virtual address for VA | ||
| 292 | * @length: buffer length in bytes | ||
| 293 | */ | ||
| 294 | struct ib_uverbs_buffer_desc { | ||
| 295 | __u32 type; | ||
| 296 | __s32 fd; | ||
| 297 | __u32 flags; | ||
| 298 | __u32 optional_flags; | ||
| 299 | __aligned_u64 addr; | ||
| 300 | __aligned_u64 length; | ||
| 301 | }; | ||
| 302 | |||
| 276 | #endif | 303 | #endif |