From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF184C433F5 for ; Tue, 26 Apr 2022 12:25:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 262D310F106; Tue, 26 Apr 2022 12:25:00 +0000 (UTC) Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by gabe.freedesktop.org (Postfix) with ESMTPS id 87B8E10F101 for ; Tue, 26 Apr 2022 12:24:58 +0000 (UTC) Date: Tue, 26 Apr 2022 20:24:04 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1650975895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8ihWfybmQBLwWs2JDnc+H/HKvcZbSpd7+Ep5O3IrtFw=; b=RxPE+S/KZdvXUPCvXIpza6SglxVNoMOI1kqQVJy2QL5+sq14mkJDaDXHCg/nbpzOaVBdPo cdLL7xkr5NfPMQor8TaWV2iOB6XUiyoU2pPVh4qcxYVHHhhyP/Urq0MTP8JFi2VCXp7AFp yyhYC5ykSb/j7hdEe6UsQcwRNo+WeYg= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Cai Huoqing To: Arnd Bergmann Subject: Re: [Linaro-mm-sig] Re: [PATCH v2 4/4] drm/nvdla/uapi: Add UAPI of NVDLA driver Message-ID: <20220426122404.GA6788@chq-T47> References: <20220426060808.78225-1-cai.huoqing@linux.dev> <20220426060808.78225-5-cai.huoqing@linux.dev> <618a4f53-0998-1e6b-e32b-8bf2d3057cec@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Linux Kernel Mailing List , Sumit Semwal , linaro-mm-sig@lists.linaro.org, dri-devel , Thomas Zimmermann , Christian =?utf-8?B?S8O2bmln?= , Linux Media Mailing List Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 26 4月 22 12:50:50, Arnd Bergmann wrote: > On Tue, Apr 26, 2022 at 8:31 AM Christian König > wrote: > > Am 26.04.22 um 08:08 schrieb Cai Huoqing: > > > The NVIDIA Deep Learning Accelerator (NVDLA) is an open source IP > > > which is integrated into NVIDIA Jetson AGX Xavier, > > > so add UAPI of this driver. > > > > > > Signed-off-by: Cai Huoqing > > I saw the reply but no the original mail, so I'll comment here Hi, thanks for your reply The patches here: https://lore.kernel.org/lkml/20220426060808.78225-3-cai.huoqing@linux.dev/ > > > > + > > > +#if !defined(__KERNEL__) > > > +#define __user > > > +#endif > > This is done in the 'make headers_install' step, no need to define it > separately. > > > > +#define NVDLA_NO_TIMEOUT (0xffffffff) > > > + __u32 timeout; > > > > What format does that timeout value have? > > > > In general it is best practice to have absolute 64bit nanosecond > > timeouts (to be used with ktime inside the kernel) so that restarting > > interrupted IOCTLs works smooth. > > When using absolute values, one also needs to decide whether this should be > realtime, monotonic or boottime and document the decision. > > > > > + * struct nvdla_submit_args structure for task submit > > > + * > > > + * @tasks pointer to array of struct nvdla_ioctl_submit_task > > > + * @num_tasks number of entries in tasks > > > + * @flags flags for task submit, no flags defined yet > > > + * @version version of task structure > > > + * > > > + */ > > > +struct nvdla_submit_args { > > > + __u64 tasks; > > > + __u16 num_tasks; > > > +#define NVDLA_MAX_TASKS_PER_SUBMIT 24 > > > +#define NVDLA_SUBMIT_FLAGS_ATOMIC (1 << 0) > > > > Well that "no flags defined yet" from the comment above is probably > > outdated :) > > > > + __u16 flags; > > > + __u32 version; > > > +}; > > Versioned interfaces are usually a bad idea. If you introduce an ioctl command, > it should generally keep working. If you ever need to change the interface, just > use a new command number for the new version. > > > > +/** > > > + * struct nvdla_gem_create_args for allocating DMA buffer through GEM > > > + * > > > + * @handle handle updated by kernel after allocation > > > + * @flags implementation specific flags > > > + * @size size of buffer to allocate > > > + */ > > > +struct nvdla_gem_create_args { > > > + __u32 handle; > > > + __u32 flags; > > > + __u64 size; > > > +}; > > > + > > > +/** > > > + * struct nvdla_gem_map_offset_args for mapping DMA buffer > > > + * > > > + * @handle handle of the buffer > > > + * @reserved reserved for padding > > > + * @offset offset updated by kernel after mapping > > > + */ > > > +struct nvdla_gem_map_offset_args { > > > + __u32 handle; > > > + __u32 reserved; > > > + __u64 offset; > > > +}; > > > + > > > +#define DRM_NVDLA_SUBMIT 0x00 > > > +#define DRM_NVDLA_GEM_CREATE 0x01 > > > +#define DRM_NVDLA_GEM_MMAP 0x02 > > Is this an actual mmap() call, or something that needs to be done before the > mmap()? Is the 'handle' a file descriptor or some internal number? It's an gem object mmap which calls drm_gem_dumb_map_offset() inside and the handle is gem object handle. Thanks, Cai > > Arnd