ice_read_flat_nvm(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– ice_read_flat_nvm(9) πŸ’–

okay so bestie, buckle up β€” this is a page from the Kernel API Manual and it's about ice_read_flat_nvm, which is genuinely one of those functions that looks scary but is actually serving. Let's get into it ✨


πŸŽ€ NAME πŸŽ€

ice_read_flat_nvm β€” read a portion of NVM by flat offset. that's it, that's the vibe πŸ’…


✨ SYNOPSIS ✨

int ice_read_flat_nvm (struct ice_hw *hw , u32 offset , u32 *length , u8
*data , bool read_shadow_ram , enum libie_aq_err *read_aq_err );

like, six arguments. she's high-maintenance but worth it 🫢


🌸 ARGUMENTS 🌸

  • hw β€” pointer to the HW struct. the whole hardware situation lives here 🏠
  • offset β€” offset from beginning of NVM. where you're starting from, bestie πŸ“
  • length β€” (in) number of bytes to read; (out) number of bytes actually read. she's a two-way street, lowkey iconic πŸ”
  • data β€” buffer to return data in (sized to fit the specified length). pls size her correctly or it's giving chaos πŸ™ˆ
  • read_shadow_ram β€” if true, read from shadow RAM instead of NVM. shadow RAM said "let me be the main character" πŸ‘‘
  • read_aq_err β€” if non-NULL, receives the AQ error status of the failing read. if you pass NULL she simply won't tell you, that's the deal πŸ’€

πŸ¦‹ DESCRIPTION πŸ¦‹

So basically: this function reads a portion of the NVM, treating it as a flat memory space. no cap. and the way that she does it is actually so smart β€” she correctly breaks read requests across Shadow RAM sectors and makes sure that no single read request exceeds the maximum 4KB read for a single AdminQ command. organization? immaculate. 🧚

now for the spicy part 🌢️ β€” FW caps the read lock at a maximum of 3000ms, so a read spanning multiple 4KB sectors legit cannot be done under a single lock without FW reclaiming it mid-read. rude, but okay. so the NVM lock is therefore acquired and released around each AQ read, which means this function must be called without the lock held. i cannot stress this enough bestie, do not hold the lock πŸ™…β€β™€οΈ

⚠️ also important: since ice_release_nvm issues an AQ command that overwrites hw->adminq.sq_last_status, callers that need the failing read's AQ error must use read_aq_err rather than inspecting sq_last_status afterwards. the status you want is gone by then, fr fr 😭

she returns a status code on failure. and heads up β€” the data pointer may be partially updated if some reads succeed before a failure. so like, no, you don't get a clean slate on error. tragic but true πŸ’”


🌈 SEE ALSO 🌈

kernel file ./drivers/net/ethernet/intel/ice/ice_nvm.c β€” go read the source, it slays ✨

and the whole friend group:

ice_aq_read_nvm(9), ice_aq_update_nvm(9), ice_aq_erase_nvm(9), ice_read_sr_word(9), ice_acquire_nvm(9), ice_release_nvm(9), ice_get_flash_bank_offset(9), ice_read_flash_module(9), ice_read_nvm_module(9), ice_read_nvm_sr_copy(9), ice_read_netlist_module(9), ice_get_pfa_module_tlv(9), ice_read_pba_string(9), ice_get_nvm_ver_info(9), ice_get_inactive_nvm_ver(9), ice_get_orom_civd_data(9), ice_get_orom_ver_info(9), ice_get_inactive_orom_ver(9), ice_get_netlist_info(9), ice_get_inactive_netlist_ver(9), ice_discover_flash_size(9), ice_read_sr_pointer(9), ice_read_sr_area_size(9), ice_determine_active_flash_banks(9), ice_get_nvm_css_hdr_len(9), ice_determine_css_hdr_len(9), ice_init_nvm(9), ice_nvm_validate_checksum(9), ice_nvm_write_activate(9), ice_aq_nvm_update_empr(9)

like genuinely every single one, i'm not skipping a single bestie 🫢


and that's the page!! this one's from ./drivers/net/ethernet/intel/ice, dated October 2026, and it's a ice_read_flat_nvm(9) kind of moment. mwah, go forth and don't hold that lock πŸ’œπŸŽ€

πŸ“¦ where this page comes from