Skip to content

Build failure: implicit declaration of drm_clflush_virt_range on architecture other than x86 #555

Closed

Description

@mnixry

This occurs because the header file <drm/drm_cache.h> is currently included conditionally, restricted only to x86 architectures:

#if defined(CONFIG_X86)
#include <drm/drm_cache.h>
#endif

However, the function copy_primary_pixels_on_xe utilizes drm_clflush_virt_range and drm_memcpy_from_wc (defined in that header), but the function definition itself is not guarded by the same architecture checks:

evdi/module/evdi_painter.c

Lines 178 to 209 in 750044c

#if KERNEL_VERSION(5, 18, 0) <= LINUX_VERSION_CODE || defined(EL8) || defined(EL9)
static int copy_primary_pixels_on_xe(struct evdi_framebuffer *efb,
char __user *buffer,
int buf_byte_stride,
int const max_x,
int const max_y)
{
int y;
struct drm_framebuffer *fb = &efb->base;
const int byte_span = max_x * 4;
struct iosys_map dst_mapping = IOSYS_MAP_INIT_VADDR(vmalloc(max_x * 4));
for (y = 0; y < max_y; ++y) {
const int src_offset = fb->offsets[0] + fb->pitches[0] * y;
struct iosys_map src_mapping = IOSYS_MAP_INIT_VADDR((char *)efb->obj->vmapping + src_offset);
const int dst_offset = buf_byte_stride * y;
char __user *dst = buffer + dst_offset;
drm_clflush_virt_range(src_mapping.vaddr, byte_span);
drm_memcpy_from_wc(&dst_mapping, &src_mapping, byte_span);
if (copy_to_user(dst, dst_mapping.vaddr, byte_span))
return -EFAULT;
src_mapping.vaddr += fb->pitches[0];
dst += buf_byte_stride;
}
vfree(dst_mapping.vaddr);
return 0;
}
#endif

This mismatch causes the build to fail when targeting non-x86 architectures (such as AArch64), as the compiler cannot find the definitions for the DRM cache functions.

> /build/source/module/evdi_painter.c: In function 'copy_primary_pixels_on_xe':
2026-02-09T14:17:28.3342031Z evdi> /build/source/module/evdi_painter.c:196:17: error: implicit declaration of function 'drm_clflush_virt_range' [-Wimplicit-function-declaration]
2026-02-09T14:17:28.3342707Z evdi>   196 |                 drm_clflush_virt_range(src_mapping.vaddr, byte_span);
2026-02-09T14:17:28.3343032Z evdi>       |                 ^~~~~~~~~~~~~~~~~~~~~~

Ref: NixOS/nixpkgs#488694

Activity

  1. zrhoffman commented on Feb 16, 2026

    @zrhoffman
    Contributor

    This occurs because the header file <drm/drm_cache.h> is currently included conditionally, restricted only to x86 architectures:

    I am on Asahi Linux (aarch64), and I can confirm that making the include unconditional gets it to compile for me:

    diff --git a/module/evdi_painter.c b/module/evdi_painter.c
    index 4a1d2d5..46e11d8 100644
    --- a/module/evdi_painter.c
    +++ b/module/evdi_painter.c
    @@ -20,9 +20,7 @@
     #include <drm/drmP.h>
     #endif
     #include <drm/drm_edid.h>
    -#if defined(CONFIG_X86)
     #include <drm/drm_cache.h>
    -#endif
     #include "evdi_drm.h"
     #include "evdi_drm_drv.h"
     #include "evdi_cursor.h"
  2. synaptics-lspintzyk commented on Feb 16, 2026

    @synaptics-lspintzyk
    Contributor

    d I can confirm that making the include unconditional gets it to compile for me

    Good catch. Can you please submit PR?

  3. added a commit that references this issue on Feb 17, 2026
    5c12c6d
  4. added a commit that references this issue on Feb 17, 2026
    c88fb92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions