• André Almeida's avatar
    drm/amd/debugfs: Expose GFXOFF state to userspace · 4686177f
    André Almeida authored
    GFXOFF has two different "state" values: one to define if the GPU is
    allowed/disallowed to enter GFXOFF, usually called state; and another
    one to define if currently GFXOFF is being used, usually called status.
    Even when GFXOFF is allowed, GPU firmware can decide to not used it
    accordingly to the GPU load.
    
    Userspace can allow/disallow GPUs to enter into GFXOFF via debugfs. The
    kernel maintains a counter of requests for GFXOFF (gfx_off_req_count)
    that should be decreased to allow GFXOFF and increased to disallow.
    
    The issue with this interface is that userspace can't be sure if GFXOFF
    is currently allowed. Even by checking amdgpu_gfxoff file, one might get
    an ambiguous 2, that means that GPU is currently out of GFXOFF, but that
    can be either because it's currently disallowed or because it's allowed
    but given the current GPU load it's enabled. Then, userspace needs to
    rely on the fact that GFXOFF is enabled by default on boot and to track
    this information.
    
    To make userspace life easier and GFXOFF more reliable, return the
    current state of GFXOFF to userspace when reading amdgpu_gfxoff with the
    same semantics of writing: 0 means not allowed, not 0 means allowed.
    
    Expose the current status of GFXOFF through a new file,
    amdgpu_gfxoff_status.
    Signed-off-by: default avatarAndré Almeida <andrealmeid@igalia.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    4686177f
amdgpu_debugfs.c 45.6 KB