Skip to content

Commit

Permalink
common/cnxk: fix handling up and down interrupts
Browse files Browse the repository at this point in the history
Down messages should be processed only when down interrupt is received
while UP messages should be processed when up interrupt is received.
A scenario has been observed where processing down message on UP
message interrupt causes processing of old message response while
response of latest message is not received.

Fixes: fa4ee2d ("common/cnxk: sync between mbox up and down messages")
Cc: [email protected]

Signed-off-by: Harman Kalra <[email protected]>
  • Loading branch information
harman-kalra authored and jerinjacobk committed Oct 5, 2023
1 parent 7557e3f commit 88d7fa4
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions drivers/common/cnxk/roc_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,14 +770,22 @@ roc_pf_vf_mbox_irq(void *param)
* by 1ms until this region is zeroed mbox_wait_for_zero()
*/
mbox_data = plt_read64(dev->bar2 + RVU_VF_VFPF_MBOX0);
if (mbox_data)
plt_write64(!mbox_data, dev->bar2 + RVU_VF_VFPF_MBOX0);
/* If interrupt occurred for down message */
if (mbox_data & MBOX_DOWN_MSG) {
mbox_data &= ~MBOX_DOWN_MSG;
plt_write64(mbox_data, dev->bar2 + RVU_VF_VFPF_MBOX0);

/* First process all configuration messages */
process_msgs(dev, dev->mbox);
/* First process all configuration messages */
process_msgs(dev, dev->mbox);
}
/* If interrupt occurred for UP message */
if (mbox_data & MBOX_UP_MSG) {
mbox_data &= ~MBOX_UP_MSG;
plt_write64(mbox_data, dev->bar2 + RVU_VF_VFPF_MBOX0);

/* Process Uplink messages */
process_msgs_up(dev, &dev->mbox_up);
/* Process Uplink messages */
process_msgs_up(dev, &dev->mbox_up);
}
}

/* IRQ to PF from AF - PF context (interrupt thread) */
Expand All @@ -799,14 +807,22 @@ roc_af_pf_mbox_irq(void *param)
* by 1ms until this region is zeroed mbox_wait_for_zero()
*/
mbox_data = plt_read64(dev->bar2 + RVU_PF_PFAF_MBOX0);
if (mbox_data)
plt_write64(!mbox_data, dev->bar2 + RVU_PF_PFAF_MBOX0);
/* If interrupt occurred for down message */
if (mbox_data & MBOX_DOWN_MSG) {
mbox_data &= ~MBOX_DOWN_MSG;
plt_write64(mbox_data, dev->bar2 + RVU_PF_PFAF_MBOX0);

/* First process all configuration messages */
process_msgs(dev, dev->mbox);
/* First process all configuration messages */
process_msgs(dev, dev->mbox);
}
/* If interrupt occurred for up message */
if (mbox_data & MBOX_UP_MSG) {
mbox_data &= ~MBOX_UP_MSG;
plt_write64(mbox_data, dev->bar2 + RVU_PF_PFAF_MBOX0);

/* Process Uplink messages */
process_msgs_up(dev, &dev->mbox_up);
/* Process Uplink messages */
process_msgs_up(dev, &dev->mbox_up);
}
}

static int
Expand Down

0 comments on commit 88d7fa4

Please sign in to comment.