linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Dave Airlie <airlied@gmail.com>, Alexandre Bailon <abailon@baylibre.com>
Cc: Dave Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Rob Herring <robh+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	ohad@wizery.com, bjorn.andersson@linaro.org,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" 
	<devicetree@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	"moderated list:ARM/Mediatek SoC support" 
	<linux-mediatek@lists.infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-remoteproc@vger.kernel.org,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	"moderated list:DMA BUFFER SHARING FRAMEWORK" 
	<linaro-mm-sig@lists.linaro.org>,
	khilman@baylibre.com, gpain@baylibre.com
Subject: Re: [RFC PATCH 2/4] DRM: Add support of AI Processor Unit (APU)
Date: Thu, 23 Sep 2021 08:17:33 +0200	[thread overview]
Message-ID: <ffc29919-809f-05c3-6079-62f1e6453f24@amd.com> (raw)
In-Reply-To: <CAPM=9tzOADabEgEP1L+yNO4gj2JhNuVDL-Bhpbsz4=UX5feLcg@mail.gmail.com>

Am 23.09.21 um 02:58 schrieb Dave Airlie:
> On Sat, 18 Sept 2021 at 07:57, Alexandre Bailon <abailon@baylibre.com> wrote:
>> Some Mediatek SoC provides hardware accelerator for AI / ML.
>> This driver provides the infrastructure to manage memory
>> shared between host CPU and the accelerator, and to submit
>> jobs to the accelerator.
>> The APU itself is managed by remoteproc so this drivers
>> relies on remoteproc to found the APU and get some important data
>> from it. But, the driver is quite generic and it should possible
>> to manage accelerator using another ways.
>> This driver doesn't manage itself the data transmitions.
>> It must be registered by another driver implementing the transmitions.
>>
>> Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
>> [SNIP]

>> Please refer to
>> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kernel.org%2Fdoc%2FDocumentation%2Fioctl%2Fbotching-up-ioctls.rst&amp;data=04%7C01%7Cchristian.koenig%40amd.com%7C53a0ef2630404ddc4d9408d97e2d409c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637679555123878415%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=6oVXAAOjQX%2FnDzJxZIAALqjDourHdrdGF6QVQKR58KI%3D&amp;reserved=0
>>
>> here and below in many places.
>>
>> There's a lot of missing padding/alignment here.

There is also the pahole utility which show you nicely where you need 
padding for your IOCTL structures.

For example "pahole drivers/gpu/drm/amd/amdgpu/amdgpu.ko -C 
drm_amdgpu_gem_va" gives you:

struct drm_amdgpu_gem_va {
     __u32                      handle;               /*     0     4 */
     __u32                      _pad;                 /*     4     4 */
     __u32                      operation;            /*     8     4 */
     __u32                      flags;                /*    12     4 */
     __u64                      va_address;           /*    16     8 */
     __u64                      offset_in_bo;         /*    24     8 */
     __u64                      map_size;             /*    32     8 */

     /* size: 40, cachelines: 1, members: 7 */
     /* last cacheline: 40 bytes */
};

And as you can see we have added the _pad field to our IOCTL parameter 
structure to properly align the 64bit members.

Regards,
Christian.

>>
>> I'm trying to find the time to review this stack in full, any writeups
>> on how this is used from userspace would be useful (not just the code
>> repo, but some sort of how do I get at it) it reads as kinda generic
>> (calling it apu), but then has some specifics around device binding.
>>
>> Dave.


  reply	other threads:[~2021-09-23  6:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17 12:59 [RFC PATCH 0/4] Add a DRM driver to support AI Processing Unit (APU) Alexandre Bailon
2021-09-17 12:59 ` [RFC PATCH 1/4] dt-bindings: Add bidings for mtk,apu-drm Alexandre Bailon
2021-09-17 19:48   ` Rob Herring
2021-09-20 20:55   ` Rob Herring
2021-09-17 12:59 ` [RFC PATCH 2/4] DRM: Add support of AI Processor Unit (APU) Alexandre Bailon
2021-09-23  0:58   ` Dave Airlie
2021-09-23  6:17     ` Christian König [this message]
2021-09-17 12:59 ` [RFC PATCH 3/4] rpmsg: " Alexandre Bailon
2021-09-23  3:31   ` Bjorn Andersson
2021-09-17 12:59 ` [RFC PATCH 4/4] ARM64: mt8183-pumpkin: Add the APU DRM device Alexandre Bailon

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=ffc29919-809f-05c3-6079-62f1e6453f24@amd.com \
    --to=christian.koenig@amd.com \
    --cc=abailon@baylibre.com \
    --cc=airlied@gmail.com \
    --cc=airlied@linux.ie \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gpain@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mripard@kernel.org \
    --cc=ohad@wizery.com \
    --cc=robh+dt@kernel.org \
    --cc=sumit.semwal@linaro.org \
    --cc=tzimmermann@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).