@@ -15,7 +15,15 @@ struct udmabuf_create {
};
struct udmabuf_create_item {
- __u32 memfd;
+ union {
+ struct {
+ __u32 memfd;
+ };
+ struct {
+ __u16 devid;
+ __u16 bar;
+ };
+ };
__u32 __pad;
__u64 offset;
__u64 size;
@@ -29,5 +37,6 @@ struct udmabuf_create_list {
#define UDMABUF_CREATE _IOW('u', 0x42, struct udmabuf_create)
#define UDMABUF_CREATE_LIST _IOW('u', 0x43, struct udmabuf_create_list)
+#define UDMABUF_CREATE_LIST_FOR_PCIDEV _IOW('u', 0x44, struct udmabuf_create_list)
#endif /* _UAPI_LINUX_UDMABUF_H */
This new ioctl can be used by a VMM such as Qemu or other userspace applications to create a dmabuf from a PCI device's memory regions. The PCI device's id that the userspace app is required to provide needs to be encoded in the format specified by the following macro (defined in include/linux/pci.h): define PCI_DEVID(bus, devfn) ((((u16)(bus)) << 8) | (devfn)) where devfn is defined (in include/uapi/linux/pci.h) as define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) In addition to the devid, the userspace needs to include the offsets and sizes and also the bar number as part of this request. Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com> --- include/uapi/linux/udmabuf.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)