From patchwork Fri Feb 15 20:24:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 158548 Delivered-To: patches@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1112811jaa; Fri, 15 Feb 2019 12:24:20 -0800 (PST) X-Received: by 2002:a63:cc41:: with SMTP id q1mr7115144pgi.323.1550262260429; Fri, 15 Feb 2019 12:24:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550262260; cv=none; d=google.com; s=arc-20160816; b=TM8vbj9cFZ0cdguj/QWr6m3wF9GzykmadlnZd2SOrbIRMsgjDS4pIu5e3oTesywn3h YGvdnJI7Kjsp0b3zG8n4ztFgik85jn9S/vFfypscPEC9BMSyBPmlpXJK4N6pvpMS6iiO RHe8ADIMOqyRYYsyZrIxavoDByYWe2hv9UUZpXwJLjrYuoAesIrtg+qA/Sl3NTz6yrMO ExrbreB86jTveBbXnnpP+YyDsUOWaNsk6MwuZ/hRfLMnSORDPfkWAE6ZwdTfqC8huMl3 /rueN2j7xwI6sSooq93lU5qjCfc5zA7n3JpyrNqBJFb6qe/IfOLaytFdJG87devB/F3o FtLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=N5a5nZaqsWgGJm38LQouQeiDJ/DSJD63RRCa/mm8Ip8=; b=Hx0gcFEb8E8M4ng7H9zS1xHfklSrLH83lSRM+BVa1ef/avnAEflH7U4jLA4hm3Q4pU 7XaAqg8BR6g5Ru1fh+zhHMo4pnyeVmDqRxGosmIfgJamUyL2K94felkR4aZkhVPLI8sC Khqrfjvv80WqAg37+PqbZvDR/HlWfP8KBubifDuFt6sIkID6U8rT5DnBEyzYXm28GyN+ 8vBJFN+00Q0Hycv+QzasVbFpWhd6cQE8sUrWExpQWavlVfNkG2IpKnRCTO/ATE0MdCy/ IA1uZfKE11SUU18wE1BKGlvP5Wsg//fznFen///BJ80LjBthVq0vb0MMoU5NsAdnNk4y iW7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gJHuN1JA; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 75sor10061837pgc.15.2019.02.15.12.24.20 for (Google Transport Security); Fri, 15 Feb 2019 12:24:20 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gJHuN1JA; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=N5a5nZaqsWgGJm38LQouQeiDJ/DSJD63RRCa/mm8Ip8=; b=gJHuN1JAxX5Ndch8U8vilfFEsjOsgsaFC9e50UdCpiVQLghsvvCjSOAsGtswpmYmu8 wTp6SX9RYSi9J31vk9xpgTI53od4d7g9ZOkuT5busILitYOCzbpkJ2pxeuVBa+u+cNoO YOiGjdmscJZHWdQOq8amMwmqVdZp3J5f28pGZz+VTWE2J7y6lOZiky74CiJUR2VI8khP 4ZJoQhU7llk/48ubblCLJc7ETr1ju1BqXB/ZnQ6yjNRNXUCRTz6kXncT0Fq+kT54wcfe lwWKHBVWIXLa0z8kHtIQYrWBiQtAuulgyg+vqKrgiDq65NS0GLTHNZZVLKfWL5qbCDhk Xx1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=N5a5nZaqsWgGJm38LQouQeiDJ/DSJD63RRCa/mm8Ip8=; b=DnZLQrJ2dVRKvQNPAoD/lKqSy+5/hmyJO5M+wLy4JMSZbpXu1Vx1/knv2OJxId5DaL W6hEfKxzL1wOHdvjr1mYLrXzBfuLLxEO9kkI7OK7mD6fVvG3nbo0fN+kKgvMNSWNr+iJ y6zEmCih65LvdvfqsrROL6GXIn22MwOuEJu7ywxSgqus1VavLgCUOT9LMg54fiNsLk2m QuJsa+EzNVzPavSdp6u3KZf24jmEzbiH2i5xFbwZTVLtFr2aH/gXRfl/pUIGZ0ZliCSd kVfFrhJizcDKmJrFsCmNCdrWOaUcTSqNR8cmi5YP1xfrvpmVUfWI9A3mwI1plawSJrT8 CuBw== X-Gm-Message-State: AHQUAuZTDZ2BW7f3C7pt4IglBRZ9Jm+KtQEsrOcyW9OxAok3hw9e4Td+ zy/Oj5DpgJS6OofglV05sv8HHFrK X-Google-Smtp-Source: AHgI3Ia7PhtR7y3HyFo2loPhbkSaACN1YSiofUkgC390u4/IQkYp9FkDp9/lY5bLbZtNYx9uZNni3g== X-Received: by 2002:a63:1e17:: with SMTP id e23mr6984808pge.130.1550262260015; Fri, 15 Feb 2019 12:24:20 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id l2sm7593340pgn.52.2019.02.15.12.24.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Feb 2019 12:24:19 -0800 (PST) From: John Stultz To: Laura Abbott Cc: John Stultz , Sumit Semwal , Liam Mark , Brian Starkey , "Andrew F . Davis" , Alistair Strachan , 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 Message-Id: <1550262252-15558-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550262252-15558-1-git-send-email-john.stultz@linaro.org> References: <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 Cc: Sumit Semwal Cc: Liam Mark Cc: Brian Starkey Cc: Andrew F. Davis Cc: Alistair Strachan Cc: dri-devel@lists.freedesktop.org Signed-off-by: John Stultz --- drivers/staging/android/ion/ion-ioctl.c | 12 ++++++++++++ drivers/staging/android/uapi/ion.h | 22 ++++++++++++++++++++++ 2 files changed, 34 insertions(+) -- 2.7.4 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 */