• John Harrison's avatar
    drm/i915/uc: Fix issues with overriding firmware files · 5d53f4c2
    John Harrison authored
    The earlier update to support reduced versioning of firmware files
    introduced an issue with the firmware override module parameter. A
    self test would specify an invalid file name (invalid meaning not in
    the table) both with and without setting the override flag. The
    *non-override* case would cause an infinite loop. I.e. a situation
    that is impossible to hit outside of the selftest because either the
    file name has come from the table in first place or it came from an
    override. However, the override case was also broken in that it would
    bypass some of the later processing.
    
    The first fix is to update the scanning loop code so that if an
    invalid file is passed in, it will exit rather than loop forever. So
    if the impossible situation did somehow occur in the future, it
    wouldn't be such a big problem.
    
    The second flips the logic on the override early exit to be negative
    rather than positive. That way if an explicit override has been set,
    then it won't try to scan for backup options (because there is no
    point anyway - the user wanted X and if X is not available, that's
    their problem). It also means that it won't skip code that still needs
    to be run once a valid firmware file has been selected.
    
    v2: Also remove ANSI colour codes that accidentally got left in an
    error message in the original patch.
    
    Fixes: 665ae9c9 ("drm/i915/uc: Support for version reduced and multiple firmware files")
    Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
    Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
    Cc: Matthew Brost <matthew.brost@intel.com>
    Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
    Cc: Matthew Auld <matthew.auld@intel.com>
    Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
    Cc: Matt Roper <matthew.d.roper@intel.com>
    Cc: Lucas De Marchi <lucas.demarchi@intel.com>
    Cc: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
    Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
    Cc: Venkata Sandeep Dhanalakota <venkata.s.dhanalakota@intel.com>
    Signed-off-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
    Reviewed-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20220914005821.3702446-2-John.C.Harrison@Intel.com
    5d53f4c2
intel_uc_fw.c 30.9 KB