Re: [PATCH v3 07/16] accel/thames: Add IOCTLs for BO creation and mapping
From: Tomeu Vizoso
Date: Sun Nov 29 2026 - 05:03:14 EST
On Mon, Oct 26, 2026 at 11:07 AM Christian König
<christian.koenig@xxxxxxx> wrote:
>
> On 10/23/26 08:39, Tomeu Vizoso wrote:
> > Creation returns a handle and maps nothing. The client maps a buffer
> > with DRM_IOCTL_THAMES_BO_BIND at a DSP address of its choice, as a
> > Vulkan driver would; the kernel enters the mapping in the page table
> > of every core, because we cannot know upfront which core will run a
> > given job.
> >
> > We use the SHMEM helpers for non-contiguous memory. Contiguous memory
> > comes from the driver's own allocator, which aligns a buffer of 2 MiB or
> > more to 2 MiB so it can be mapped as blocks; only the GEM DMA object
> > and its mmap and vmap helpers are used for it.
>
> How exactly do you do that? IIRC the SHMEM helpers can only do 2MiB allocations on a best effort basis.
Only contiguous memory was aligned in v3, and that doesn't use the
SHMEM helpers. But I have remeasured the performance impact of
alignment and have decided that any gains are not worth it, so I
dropped the custom allocator and I'm using the GEM DMA helpers in the
soon to be posted v4.
> In other words you don't get a guarantee that this always works and when memory is fragmented the 4k fallback must work as well.
Yep, thanks, now that I have dropped the 2MiB alignment and am using
the helpers, we allocate contiguous memory if at all available and
error out if we run out of it.
Regards,
Tomeu