Skip to content

Commit f8608bf

Browse files
Runyu Xiaogregkh
authored andcommitted
octeontx2-vf: clear stale mailbox IRQ state before request_irq()
[ Upstream commit 0b352f0 ] otx2vf_register_mbox_intr() currently installs the VF mailbox IRQ handler before clearing stale mailbox interrupt state. The code then says that local interrupt bits should be cleared first to avoid spurious interrupts, but that clear still happens only after request_irq() has already made the handler reachable. A running system can reach this during VF mailbox interrupt registration while stale or latched RVU_VF_INT state is still present. If delivery happens in the request_irq()-to-clear window, otx2vf_vfaf_mbox_intr_handler() can run before local quiesce and touch the same vf->mbox and vf->mbox_wq carrier that probe and teardown later reuse or destroy. Move the stale mailbox interrupt clear ahead of request_irq(), but keep interrupt enabling after the handler is installed. This closes the pre-clear early-IRQ window without creating a new enable-before-handler window. Fixes: 3184fb5 ("octeontx2-vf: Virtual function driver support") Cc: stable@vger.kernel.org Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Ratheesh Kannoth <rkannoth@marvell.com> Link: https://patch.msgid.link/20260611160014.3202224-3-runyu.xiao@seu.edu.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 540cede commit f8608bf

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

  • drivers/net/ethernet/marvell/octeontx2/nic

drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,15 @@ static int otx2vf_register_mbox_intr(struct otx2_nic *vf, bool probe_pf)
245245
{
246246
struct otx2_hw *hw = &vf->hw;
247247
struct msg_req *req;
248+
u64 mbox_int_mask;
248249
char *irq_name;
249250
int err;
250251

252+
mbox_int_mask = BIT_ULL(0);
253+
254+
/* Clear stale mailbox interrupt state before installing the handler. */
255+
otx2_write64(vf, RVU_VF_INT, mbox_int_mask);
256+
251257
/* Register mailbox interrupt handler */
252258
irq_name = &hw->irq_name[RVU_VF_INT_VEC_MBOX * NAME_SIZE];
253259
snprintf(irq_name, NAME_SIZE, "RVUVFAF Mbox");
@@ -259,11 +265,8 @@ static int otx2vf_register_mbox_intr(struct otx2_nic *vf, bool probe_pf)
259265
return err;
260266
}
261267

262-
/* Enable mailbox interrupt for msgs coming from PF.
263-
* First clear to avoid spurious interrupts, if any.
264-
*/
265-
otx2_write64(vf, RVU_VF_INT, BIT_ULL(0));
266-
otx2_write64(vf, RVU_VF_INT_ENA_W1S, BIT_ULL(0));
268+
/* Enable mailbox interrupt for msgs coming from PF. */
269+
otx2_write64(vf, RVU_VF_INT_ENA_W1S, mbox_int_mask);
267270

268271
if (!probe_pf)
269272
return 0;

0 commit comments

Comments
 (0)