How to enable HMM on Debian?

I’m on GCP instance with T4 GPU. Booted up Ubuntu. Installed nvidia-open. HMM is enabled. But a customer is using Debian. So I tried Debian on exact same hardware. HMM won’t enable no matter what I do. I tried kernel 6.9 and even 6.11. Different flavors of the kernel. Even compiling my own kernel from latest unstable. Is there an official document about what exactly is required? Which kernel option needs to be enabled? Any way to enable logs to show why it decided not to enable HMM?

[ 0.000000] Linux version 6.11.5+bpo-cloud-amd64 (debian-kernel@lists.debian.org) (x86_64-linux-gnu-gcc-12
(Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian 6.11.5-1~bpo12
+1 (2024-11-11)

[ 4.933991] NVRM: loading NVIDIA UNIX Open Kernel Module for x86_64 565.57.01 Release Build (dvs-builder@U16-A24-9-2) Thu Oct 10 12:15:00 UTC 2024
[ 6.893551] nvidia-modeset: Loading NVIDIA UNIX Open Kernel Mode Setting Driver for x86_64 565.57.01 Release Build (dvs-builder@U16-A24-9-2) Thu Oct 10 12:03:51 UTC 2024
[ 8.338626] process ‘subagents/fluent-bit/bin/fluent-bit’ started with executable stack
[ 8.754027] nvidia-uvm: Loaded the UVM driver, major device number 240.

==============NVSMI LOG==============

Timestamp : Tue Dec 10 21:50:19 2024
Driver Version : 565.57.01
CUDA Version : 12.7

Attached GPUs : 1
GPU 00000000:00:04.0
Product Name : Tesla T4
Product Brand : NVIDIA
Product Architecture : Turing
Display Mode : Enabled
Display Active : Disabled
Persistence Mode : Enabled
Addressing Mode : None

Answering my own question. This is the requirement. open-gpu-kernel-modules/kernel-open/nvidia-uvm/uvm_linux.h at 9d0b0414a5304c3679c5db9d44d2afba8e58cc1b · NVIDIA/open-gpu-kernel-modules · GitHub

CONFIG_HMM_MIRROR and CONFIG_DEVICE_PRIVATE.

Success is not possible on Debian because they don’t enable this even on the latest unstable kernel. Everything works after I compiled my own kernel with these enabled. Chapter 4. Common kernel-related tasks

Note to others following this path. Make sure you download linux-config-xxx package to use as a starting point for your kernel config. Otherwise your custom kernel might not be compatible with the rest of your Debian system.