This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Unofficial patches for the Mali Midgard kernel drivers r19p0 on Linux 4.17

Greetings,

I can't seem to make this a discussion so... I'm posting it as a question.

Here I provide a few patches I wrote to compile the Mali Midgard kernel drivers r19p0, along with the Mali UMP driver, when integrated into 4.17 kernels.

Why the r19p0 and not the latest r24p0 ? Because I'm either stuck with the legacy r14p0 user-space drivers from Rockchip, for GLES and DRM+GBM support, or the legacy r12p0 drivers from ARM for Vulkan support, and these won't get updated anytime soon, it seems. Since starting from the r20p0, the Mali Midgard kernel drivers dropped support for legacy IOCTL used by the legacy Mali Midgard user-space drivers, I'm staying with the r19p0 drivers.

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

Note that if you're used to my previous posts, I've dropped the UMP patches as the DMABUF framework provide roughly the same features and the Mali driver uses DMABUF instead of the UMP framework when possible.

Most of these patches are mostly due to headers names and structure members being changed after Linux 4.10, but the last one is due to some changes to the mmap interface by Linus Torvalds himself, and will lead to the kernel driver loading correctly and the user-space binary driver failing mmap2 calls silently... Nasty stuff...

Mali Midgard specific patch :

Mali Midgard patches related to DTS detection :

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

  • 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
  • timer: Remove setup_*timer() interface
    513ae785c63c30741e46f43960213d4ae5382ec0 (Git.kernel.org Github)
    Mainlined in Linux v4.15-rc1
  • compiler.h: Remove ACCESS_ONCE()
    b899a850431e2dd0943205a63a68573f3e312d0d (Git.kernel.org Github)
    Mainlined in Linux v4.15-rc4
  • fs: add ksys_close() wrapper; remove in-kernel calls to sys_close()
    2ca2a09d6215fd9621aa3e2db7cc9428a61f2911 (Git.kernel.org Github)
    Mainlined in Linux v4.17-rc1

  • mmap: introduce sane default mmap limits
    be83bbf806822b1b89e0a0f23cd87cddc409e429 (Git.kernel.org Github)
    Mainlined in Linux v4.17-rc5

The DTS related patches target RK3288 owners and are related to the following changes :

  • ARM: dts: rockchip: add ARM Mali GPU node for rk3288
    e3df026c594c77f0de1bdaa413d591b4345e4b6a (Git.kernel.org Github)
    Mainlined in Linux v4.13-rc1
  • ARM: dts: rockchip: fix mali gpu node on rk3288
    ca12437303f35b0a5b97c856d88886ce9df6a0d7 (Git.kernel.org Github)
    Mainlined in Linux v4.13-rc4

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

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

The procedure includes the download of the Linux 4.17 kernel and the Mali r19p0-01rel0 kernel driver.

These patches have been tested with the r14p0 drivers provided by Rockchip, and the r12p0 (fbdev with Vulkan) drivers for Firefly boards provided by ARM, using an Armbian system on a MiQi board and on an ASUS Tinkerboard.
The Vulkan support still remains untested. Only listing Vulkan devices properties and queues have been tested so far.

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