All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Stultz via dri-devel <dri-devel@lists.freedesktop.org>
To: Laura Abbott <labbott@redhat.com>
Cc: Alistair Strachan <astrachan@google.com>,
	Liam Mark <lmark@codeaurora.org>, "Andrew F . Davis" <afd@ti.com>,
	dri-devel@lists.freedesktop.org
Subject: [EARLY RFC][PATCH 3/4] ion: Add HEAP_INFO ioctl to be able to fetch heap type
Date: Fri, 15 Feb 2019 12:24:11 -0800	[thread overview]
Message-ID: <1550262252-15558-4-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1550262252-15558-1-git-send-email-john.stultz@linaro.org>

The per-device heaps don't support HEAP_QUERY ioctl, since
the name is provided in the devnode path and the heapid isn't
useful with the new interface (one uses the fd of heapdevice).

But, one missing bit of functionality is a way to find the
heap type. So provide a HEAP_INFO ioctl which exposes the
heap type out so there is the potential for some sort of
dynamic heap matching/discovery.

Most likely this IOCTL will be useful when extended to allow
some sort of opaque constraint bitfield to be shared so userland
can match heaps with devices in a fully dynamic way.

Cc: Laura Abbott <labbott@redhat.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Liam Mark <lmark@codeaurora.org>
Cc: Brian Starkey <Brian.Starkey@arm.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Alistair Strachan <astrachan@google.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 drivers/staging/android/ion/ion-ioctl.c | 12 ++++++++++++
 drivers/staging/android/uapi/ion.h      | 22 ++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c
index ea8d263..6db5969 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -14,6 +14,7 @@ union ion_ioctl_arg {
 	struct ion_allocation_data allocation;
 	struct ion_heap_allocation_data heap_allocation;
 	struct ion_heap_query query;
+	struct ion_heap_info heap_info;
 	u32 version;
 };
 
@@ -149,6 +150,17 @@ long ion_heap_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 		break;
 	}
+	case ION_IOC_HEAP_INFO:
+	{
+		struct miscdevice *miscdev = filp->private_data;
+		struct ion_heap *heap;
+
+		heap = container_of(miscdev, struct ion_heap, heap_dev);
+
+		data.heap_info.type = heap->type;
+
+		break;
+	}
 	case ION_IOC_VERSION:
 		data.version = ION_VERSION;
 		break;
diff --git a/drivers/staging/android/uapi/ion.h b/drivers/staging/android/uapi/ion.h
index 20db09f..1b3ca1e 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -111,6 +111,19 @@ struct ion_heap_data {
 };
 
 /**
+ * struct ion_heap_info - Info about the heap
+ *
+ */
+struct ion_heap_info {
+	__u32 type;
+	__u32 reserved0;
+	__u32 reserved1;
+	__u32 reserved2;
+	__u32 reserved3;
+	__u32 reserved4;
+};
+
+/**
  * struct ion_heap_query - collection of data about all heaps
  * @cnt - total number of heaps to be copied
  * @heaps - buffer to copy heap data
@@ -159,4 +172,13 @@ struct ion_heap_query {
 #define ION_IOC_HEAP_ALLOC	_IOWR(ION_IOC_MAGIC, 10, \
 				      struct ion_heap_allocation_data)
 
+/**
+ * DOC: ION_IOC_HEAP_INFO - allocate memory from heap
+ *
+ * Takes an ion_heap_query structure and populates information about
+ * available Ion heaps.
+ */
+#define ION_IOC_HEAP_INFO	_IOWR(ION_IOC_MAGIC, 11, \
+				      struct ion_heap_allocation_data)
+
 #endif /* _UAPI_LINUX_ION_H */
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-02-15 20:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15 20:24 [EARLY RFC][PATCH 0/4] ION per heap devices John Stultz via dri-devel
2019-02-15 20:24 ` [EARLY RFC][PATCH 1/4] ion: Add ION_VERSION ioctl John Stultz via dri-devel
2019-02-19 20:46   ` Laura Abbott
2019-02-19 21:29     ` John Stultz
2019-02-15 20:24 ` [EARLY RFC][PATCH 2/4] ion: Initial hack to create per heap devices John Stultz via dri-devel
2019-02-19 21:17   ` Laura Abbott
2019-02-19 21:36     ` John Stultz
2019-02-15 20:24 ` John Stultz via dri-devel [this message]
2019-02-19 21:13   ` [EARLY RFC][PATCH 3/4] ion: Add HEAP_INFO ioctl to be able to fetch heap type Laura Abbott
2019-02-19 21:39     ` Andrew F. Davis
2019-02-19 21:46       ` Laura Abbott
2019-02-19 21:50         ` John Stultz
2019-02-19 21:47     ` John Stultz
2019-02-20 15:07       ` Brian Starkey
2019-02-20 17:29         ` John Stultz
2019-02-15 20:24 ` [EARLY RFC][PATCH 4/4] ion: Make "legacy" /dev/ion support optional John Stultz via dri-devel
2019-02-18 11:51 ` [EARLY RFC][PATCH 0/4] ION per heap devices Brian Starkey
2019-02-19 17:21   ` John Stultz
2019-02-19 20:51     ` Laura Abbott
2019-02-19 21:25 ` Laura Abbott
2019-02-19 21:30   ` Andrew F. Davis
2019-02-19 21:54     ` Laura Abbott
2019-02-19 21:55   ` John Stultz

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=1550262252-15558-4-git-send-email-john.stultz@linaro.org \
    --to=dri-devel@lists.freedesktop.org \
    --cc=afd@ti.com \
    --cc=astrachan@google.com \
    --cc=john.stultz@linaro.org \
    --cc=labbott@redhat.com \
    --cc=lmark@codeaurora.org \
    /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.