Arm Community
Arm Community
  • Site
  • User
  • Site
  • Search
  • User
Arm Community blogs
Arm Community blogs
Mobile, Graphics, and Gaming blog Unofficial patches for the Mali Midgard kernel drivers r19p0 on Linux 4.13.0-rcX
  • Blogs
  • Mentions
  • Sub-Groups
  • Tags
  • Jump...
  • Cancel
More blogs in Arm Community blogs
  • AI blog

  • Announcements

  • Architectures and Processors blog

  • Automotive blog

  • Embedded and Microcontrollers blog

  • Internet of Things (IoT) blog

  • Laptops and Desktops blog

  • Mobile, Graphics, and Gaming blog

  • Operating Systems blog

  • Servers and Cloud Computing blog

  • SoC Design and Simulation blog

  • Tools, Software and IDEs blog

Tags
  • Mali Kernel Device Drivers for GPU
  • Mali GPU (Midgard Architecture)
  • Linux
Actions
  • RSS
  • More
  • Cancel
Related blog posts
Related forum threads

Unofficial patches for the Mali Midgard kernel drivers r19p0 on Linux 4.13.0-rcX

Myy
Myy
July 18, 2017
2 minute read time.

Greetings,

The first release candidate of Linux 4.13 is now released, along with the new Mali Midgard kernel drivers, which are now at the version r19p0!

These new drivers can be integrated without issues on Linux 4.10 but still need to be patched to integrate them with recent Linux kernels.

Here I provide the patches I wrote to compile the Mali Midgard kernel drivers r19p0, along with the Mali UMP driver, on 4.13 kernels.

You'll still need to copy the drivers and integrate them to the Linux kernel in order to build them.

Most of these patches are mostly due to headers names and structure members being changed after Linux 4.10.

Mali Midgard specific patch :

  • https://github.com/Miouyouyou/RockMyy/blob/master/patches/Midgard/r19p0-01rel0/0001-Mali-midgard-r19p0-fixes-for-4.13-kernels.patch
  • https://github.com/Miouyouyou/RockMyy/blob/master/patches/Midgard/r19p0-01rel0/0005-Added-the-new-compatible-list-mainly-used-by-Rockchi.patch

Mali UMP specific patches :

  • https://github.com/Miouyouyou/RockMyy/blob/master/patches/Midgard/r19p0-01rel0/0002-Using-the-new-header-on-4.12-kernels-for-copy_-_user.patch
  • https://github.com/Miouyouyou/RockMyy/blob/master/patches/Midgard/r19p0-01rel0/0003-Adapt-get_user_pages-calls-to-use-the-new-calling-pr.patch

The patch required to compile the Mali Midgard drivers is due to the following changes in Linux 4.11 and onward :

  • mm, fs: reduce fault, page_mkwrite, and pfn_mkwrite to take only vmf
    11bac80004499ea59f361ef2a5516c84b6eab675 (Git.kernel.org Github)
    Mainlined in Linux v4.11-rc1
  • sched/headers: Move task->mm handling methods to <linux/sched/mm.h>
    68e21be2916b359fd8afb536c1911dc014cfd03e (Git.kernel.org Github)
    Mainlined in Linux v4.11-rc1
  • sched/headers: Move task-stack related APIs from <linux/sched.h> to <linux/sched/task_stack.h>
    f3ac60671954c8d413532627b1be13a76f394c49 (Git.kernel.org Github)
    Mainlined in Linux v4.11-rc1
  • dma-fence: Introduce drm_fence_set_error() helper
    a009e975da5c7d42a7f5eaadc54946eb5f76c9af (Git.kernel.org Github)
    Mainlined in Linux v4.11-rc1
  • dt-bindings: gpu: drop wrong compatible from midgard binding example
    670d6303e90825f918cdcb77095706cad2df05c2 (Git.kernel.org Github)
    Mainlined in Linux v4.13-rc4

The patches required to compile the Mali UMP driver are due to the following mainline kernel changes :

  • generic ...copy_..._user primitives
    d597580d373774b1bdab84b3d26ff0b55162b916 (Git.kernel.org Github)
    Mainlined in Linux 4.12-rc1
  • mm: replace get_user_pages_remote() write/force parameters with gup_flags
    9beae1ea89305a9667ceaab6d0bf46a045ad71e7 (Git.kernel.org Github)
    Mainlined in Linux Kernel: 4.9.0-rc2

The patches required to enable the compilation of Mali Midgard GPU drivers and UMP drivers, after copying the drivers package TX011-SW-99002-r19p0-01rel0/driver/product/kernel/ content in your linux kernel base directory, are available here :

  • https://github.com/Miouyouyou/RockMyy/blob/master/patches/kernel/v4.13/0001-Integrating-the-Mali-drivers.patch

The mainlined Rockchip DTS files now defines the Mali GPU nodes, which is great. However, the mainlined definition defines the Mali GPU IRQ names using lowercase letter, while the unpatched driver only understands IRQ names written in uppercase, leading to the driver failing the GPU detection.

The following patch solves this issue :

  • https://github.com/Miouyouyou/RockMyy/blob/master/patches/Midgard/r19p0-01rel0/0004-Don-t-be-TOO-severe-when-looking-for-the-IRQ-names.patch

Also note that, the mainlined Rockchip DTS file does not define the specific "clk_mali" clock name on the GPU node, expecting the driver to get the main clock when needed. This patch modifies the Mali Midgard driver to get the main clock and avoid dependencies to that specific clock symbol :

  • https://github.com/Miouyouyou/RockMyy/blob/master/patches/kernel/v4.13/0005-Remove-the-dependency-to-the-clk_mali-symbol.patch

A full kernel download, patch and compilation procedure for MiQi RK3288 Armv7 boards is available here : https://github.com/Miouyouyou/RockMyy .

The procedure includes the download of the Linux 4.13-rc1 kernel and the Mali r19p0-01rel0 kernel drivers.

These patches have been tested with the r13p0 drivers provided by Rockchip, using an Armbian system on a MiQi board.

If these patches were useful to you, don't hesitate to support me on Patreon !

Update 2015-08-07 It seems that a few changes in the DTS "compatible" property naming schemes of the Mali Midgard GPU nodes generated some issues within the driver, which could not find the GPU anymore, requiring another patch.

Anonymous
Mobile, Graphics, and Gaming blog
  • Unlock the power of SVE and SME with SIMD Loops

    Vidya Praveen
    Vidya Praveen
    SIMD Loops is an open-source project designed to help developers learn SVE and SME through hands-on experimentation. It offers a clear, practical pathway to mastering Arm’s most advanced SIMD technologies…
    • September 19, 2025
  • What is Arm Performance Studio?

    Jai Schrem
    Jai Schrem
    Arm Performance Studio gives developers free tools to analyze performance, debug graphics, and optimize apps on Arm platforms.
    • August 27, 2025
  • How Neural Super Sampling works: Architecture, training, and inference

    Liam O'Neil
    Liam O'Neil
    A deep dive into a practical, ML-powered approach to temporal super sampling.
    • August 12, 2025