• Russ Weight's avatar
    test_firmware: Error injection for firmware upload · 4a4e975b
    Russ Weight authored
    Add error injection capability to the test_firmware module specifically
    for firmware upload testing. Error injection instructions are transferred
    as the first part of the firmware payload. The format of an error
    injection string is similar to the error strings that may be read from
    the error sysfs node.
    
    To inject the error "programming:hw-error", one would use the error
    injection string "inject:programming:hw-error" as the firmware payload:
    
    $ echo 1 > loading
    $ echo inject:programming:hw-error > data
    $ echo 0 > loading
    $ cat status
    idle
    $ cat error
    programming:hw-error
    
    The first part of the error string is the progress state of the upload at
    the time of the error. The progress state would be one of the following:
    "preparing", "transferring", or "programming". The second part of the
    error string is one of the following: "hw-error", "timeout", "device-busy",
    "invalid-file-size", "read-write-error", "flash-wearout", and "user-abort".
    
    Note that all of the error strings except "user-abort" will fail without
    delay. The "user-abort" error will cause the firmware upload to stall at
    the requested progress state for up to 5 minutes to allow you to echo 1
    to the cancel sysfs node. It is this cancellation that causes the
    'user-abort" error. If the upload is not cancelled within the 5 minute
    time period, then the upload will complete without an error.
    Reviewed-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
    Reviewed-by: default avatarTianfei zhang <tianfei.zhang@intel.com>
    Tested-by: default avatarMatthew Gerlach <matthew.gerlach@linux.intel.com>
    Signed-off-by: default avatarRuss Weight <russell.h.weight@intel.com>
    Link: https://lore.kernel.org/r/20220421212204.36052-8-russell.h.weight@intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    4a4e975b
test_firmware.c 36.5 KB