On 5/6/2016 7:07 AM, Beilei Xing wrote: > For X540 and forward it is possible if a system reset occur at the > right time to leave the SWFW semaphore high. This new function will > attempt to grab and release the semaphore. If the grab times out it > will still release the semaphore placing it in a known good state. > The idea is to call this when you know no one should be holding the > semaphore (i.e. probe time) > This patch alse fixes possible race issue between ports when issuing > host interface command by acquiring/releasing the management host > interface semaphore in ixgbe_host_interface_command. > > Signed-off-by: Beilei Xing <beilei.xing at intel.com> > --- Does it make sense to separate this patch into two.
... > +/** > + * ixgbe_init_swfw_semaphore - Clean up SWFW semaphore > + * @hw: pointer to hardware structure > + * > + * Attempts to acquire the SWFW semaphore through SW_FW_SYNC register. > + * Regardless of whether is succeeds or not it then release the semaphore. > + * This is function is called to recover from catastrophic failures that > + * may have left the semaphore locked. > + **/ > +void ixgbe_init_swfw_semaphore(struct ixgbe_hw *hw) > +{ > + if (hw->mac.ops.init_swfw_sync) > + hw->mac.ops.init_swfw_sync(hw); > +} One add ixgbe_init_swfw_semaphore related code (init_swfw_sync, ixgbe_init_swfw_sync_X540) ... > @@ -4390,6 +4392,12 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, > u32 *buffer, > DEBUGOUT1("Buffer length failure buffersize=%d.\n", length); > return IXGBE_ERR_HOST_INTERFACE_COMMAND; > } > + /* Take management host interface semaphore */ > + status = hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_SW_MNG_SM); > + > + if (status) > + return status; > + Second is fix in ixgbe_host_interface_command, they are unrelated as far as I can see. > /* Set bit 9 of FWSTS clearing FW reset indication */ > fwsts = IXGBE_READ_REG(hw, IXGBE_FWSTS); > IXGBE_WRITE_REG(hw, IXGBE_FWSTS, fwsts | IXGBE_FWSTS_FWRI); ...