• Christian Gmeiner's avatar
    drm/etnaviv: fix perfmon domain interation · 40b697e2
    Christian Gmeiner authored
    The GC860 has one GPU device which has a 2d and 3d core. In this case
    we want to expose perfmon information for both cores.
    
    The driver has one array which contains all possible perfmon domains
    with some meta data - doms_meta. Here we can see that for the GC860
    two elements of that array are relevant:
    
      doms_3d: is at index 0 in the doms_meta array with 8 perfmon domains
      doms_2d: is at index 1 in the doms_meta array with 1 perfmon domain
    
    The userspace driver wants to get a list of all perfmon domains and
    their perfmon signals. This is done by iterating over all domains and
    their signals. If the userspace driver wants to access the domain with
    id 8 the kernel driver fails and returns invalid data from doms_3d with
    and invalid offset.
    
    This results in:
      Unable to handle kernel paging request at virtual address 00000000
    
    On such a device it is not possible to use the userspace driver at all.
    
    The fix for this off-by-one error is quite simple.
    Reported-by: default avatarPaul Cercueil <paul@crapouillou.net>
    Tested-by: default avatarPaul Cercueil <paul@crapouillou.net>
    Fixes: ed1dd899 ("drm/etnaviv: rework perfmon query infrastructure")
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarChristian Gmeiner <christian.gmeiner@gmail.com>
    Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
    40b697e2
etnaviv_perfmon.c 12.4 KB