The MAP_ICM
command is privileged, and only the physical function driver is allowed to execute it. It is executed through __mlx4_qp_alloc_icm
in the example quoted in the question when the driver is in "native" mode: neither handling a virtual function or a physical function that manages other virtual functions.
In SRIOV mode, when the driver manages a physical function that has some virtual functions, the __mlx4_qp_alloc_icm
function is called only from within the resource tracker in resource_tracker.c
. This module manages the allocation of ICM for all the functions it handles (virtual and physical) to prevent conflicts. The call to __mlx4_qp_alloc_icm
specifically is in the qp_alloc_res
function.