From: Vivek Kasireddy <vivek.kasireddy@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [RFC 6/7] udmabuf/uapi: Add new ioctl to create a dmabuf from PCI bar regions
Date: Thu, 28 Mar 2024 01:32:59 -0700 [thread overview]
Message-ID: <20240328083615.2662516-7-vivek.kasireddy@intel.com> (raw)
In-Reply-To: <20240328083615.2662516-1-vivek.kasireddy@intel.com>
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(-)
diff --git a/include/uapi/linux/udmabuf.h b/include/uapi/linux/udmabuf.h
index 46b6532ed855..16fe41fdc4b9 100644
--- a/include/uapi/linux/udmabuf.h
+++ b/include/uapi/linux/udmabuf.h
@@ -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 */
--
2.43.0
next prev parent reply other threads:[~2024-03-28 9:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-28 8:32 [RFC 0/7] drm/virtio: Import scanout buffers from other devices Vivek Kasireddy
2024-03-28 8:32 ` [RFC 1/7] drm/virtio: Implement VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING cmd Vivek Kasireddy
2024-03-28 8:32 ` [RFC 2/7] drm/virtio: Add a helper to map and note the dma addrs and lengths Vivek Kasireddy
2024-03-28 8:32 ` [RFC 3/7] drm/virtio: Add helpers to initialize and free the imported object Vivek Kasireddy
2024-03-28 8:32 ` [RFC 4/7] drm/virtio: Import prime buffers from other devices as guest blobs Vivek Kasireddy
2024-05-22 7:28 ` Daniel Vetter
2024-03-28 8:32 ` [RFC 5/7] drm/virtio: Ensure that bo's backing store is valid while updating plane Vivek Kasireddy
2024-04-26 6:06 ` Weifeng Liu
2024-03-28 8:32 ` Vivek Kasireddy [this message]
2024-03-28 8:33 ` [RFC 7/7] udmabuf: Implement UDMABUF_CREATE_LIST_FOR_PCIDEV ioctl Vivek Kasireddy
2024-05-23 21:33 ` [RFC 0/7] drm/virtio: Import scanout buffers from other devices Gurchetan Singh
2024-05-24 6:56 ` Kasireddy, Vivek
2024-05-24 18:33 ` Kasireddy, Vivek
2024-05-30 1:49 ` Gurchetan Singh
2024-05-30 7:21 ` Kasireddy, Vivek
2024-06-15 0:19 ` Gurchetan Singh
2024-06-18 7:49 ` Kasireddy, Vivek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240328083615.2662516-7-vivek.kasireddy@intel.com \
--to=vivek.kasireddy@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kraxel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.