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: kernel test robot via dri-devel X-Patchwork-Id: 10816715 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36B7D17D5 for ; Sat, 16 Feb 2019 20:16:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25DA02AB7E for ; Sat, 16 Feb 2019 20:16:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A3572AE96; Sat, 16 Feb 2019 20:16:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B10302AB7E for ; Sat, 16 Feb 2019 20:16:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 06B896EC13; Sat, 16 Feb 2019 20:12:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 832C76E100 for ; Fri, 15 Feb 2019 20:24:20 +0000 (UTC) Received: by mail-pf1-x442.google.com with SMTP id c123so5361584pfb.0 for ; Fri, 15 Feb 2019 12:24:20 -0800 (PST) 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=NMQk9sT/bCuno2///V4kRwO8WGN6+72UK01x7Lumwo1dsaPr5w5zAjc21n+pCIyG06 J1hIDOMl0FJS9WF03gL/9sYZh2OPT3KcJe2VWdB3VYj0jCgmtTB/SuolK1kh36tvyX// GRY1+Tv9xWuYW9evlC5KUUGcmgtxe0Nv+33dB4YiNLF7DE2RLpjQ3c9EZL+zjPTnAj0M PV5mfuHWmcR/H/UkkZBEutKwZB1IGKjy9HvdOnGCRYsNuS16ZML5k0i0E7Y6xmxXbESG 4ComkKKEZztKoaYZ3XHBrcUG9gAjauUq7QscpdNojSAlJqAh9Taqah/orb//fWyfRxDI vt5g== X-Gm-Message-State: AHQUAuZwWohUv8++/nCWH0RA4mQIvd6TYQPB0qoeph74AKHvYW4RJXXu G5lc84/5cw7T7HJB6y/wWyWjWw== 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) 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) To: Laura Abbott 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> X-Mailman-Original-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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: John Stultz via dri-devel From: kernel test robot via dri-devel Reply-To: John Stultz Cc: Alistair Strachan , Liam Mark , "Andrew F . Davis" , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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 */