• Jacob Keller's avatar
    ice: fix reads from NVM Shadow RAM on E830 and E825-C devices · cfa747a6
    Jacob Keller authored
    The ice driver reads data from the Shadow RAM portion of the NVM during
    initialization, including data used to identify the NVM image and device,
    such as the ETRACK ID used to populate devlink dev info fw.bundle.
    
    Currently it is using a fixed offset defined by ICE_CSS_HEADER_LENGTH to
    compute the appropriate offset. This worked fine for E810 and E822 devices
    which both have CSS header length of 330 words.
    
    Other devices, including both E825-C and E830 devices have different sizes
    for their CSS header. The use of a hard coded value results in the driver
    reading from the wrong block in the NVM when attempting to access the
    Shadow RAM copy. This results in the driver reporting the fw.bundle as 0x0
    in both the devlink dev info and ethtool -i output.
    
    The first E830 support was introduced by commit ba20ecb1 ("ice: Hook up
    4 E830 devices by adding their IDs") and the first E825-C support was
    introducted by commit f64e1894 ("ice: introduce new E825C devices
    family")
    
    The NVM actually contains the CSS header length embedded in it. Remove the
    hard coded value and replace it with logic to read the length from the NVM
    directly. This is more resilient against all existing and future hardware,
    vs looking up the expected values from a table. It ensures the driver will
    read from the appropriate place when determining the ETRACK ID value used
    for populating the fw.bundle_id and for reporting in ethtool -i.
    
    The CSS header length for both the active and inactive flash bank is stored
    in the ice_bank_info structure to avoid unnecessary duplicate work when
    accessing multiple words of the Shadow RAM. Both banks are read in the
    unlikely event that the header length is different for the NVM in the
    inactive bank, rather than being different only by the overall device
    family.
    
    Fixes: ba20ecb1 ("ice: Hook up 4 E830 devices by adding their IDs")
    Co-developed-by: default avatarPaul Greenwalt <paul.greenwalt@intel.com>
    Signed-off-by: default avatarPaul Greenwalt <paul.greenwalt@intel.com>
    Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
    Tested-by: default avatarPucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
    Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
    Link: https://lore.kernel.org/r/20240603-net-2024-05-30-intel-net-fixes-v2-2-e3563aa89b0c@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    cfa747a6
ice_nvm.c 38.6 KB