Skip to content

Commit b369554

Browse files
Hariprasad Shenaidavem330
authored andcommitted
cxgb4: For T4, don't read the Firmware Mailbox Control register
T4 doesn't have the Shadow copy of the register which we can read without side effect. So don't read mbox control register for T4 adapter Signed-off-by: Hariprasad Shenai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8119c01 commit b369554

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,18 +1128,26 @@ static const struct file_operations devlog_fops = {
11281128
static int mbox_show(struct seq_file *seq, void *v)
11291129
{
11301130
static const char * const owner[] = { "none", "FW", "driver",
1131-
"unknown" };
1131+
"unknown", "<unread>" };
11321132

11331133
int i;
11341134
unsigned int mbox = (uintptr_t)seq->private & 7;
11351135
struct adapter *adap = seq->private - mbox;
11361136
void __iomem *addr = adap->regs + PF_REG(mbox, CIM_PF_MAILBOX_DATA_A);
1137-
unsigned int ctrl_reg = (is_t4(adap->params.chip)
1138-
? CIM_PF_MAILBOX_CTRL_A
1139-
: CIM_PF_MAILBOX_CTRL_SHADOW_COPY_A);
1140-
void __iomem *ctrl = adap->regs + PF_REG(mbox, ctrl_reg);
11411137

1142-
i = MBOWNER_G(readl(ctrl));
1138+
/* For T4 we don't have a shadow copy of the Mailbox Control register.
1139+
* And since reading that real register causes a side effect of
1140+
* granting ownership, we're best of simply not reading it at all.
1141+
*/
1142+
if (is_t4(adap->params.chip)) {
1143+
i = 4; /* index of "<unread>" */
1144+
} else {
1145+
unsigned int ctrl_reg = CIM_PF_MAILBOX_CTRL_SHADOW_COPY_A;
1146+
void __iomem *ctrl = adap->regs + PF_REG(mbox, ctrl_reg);
1147+
1148+
i = MBOWNER_G(readl(ctrl));
1149+
}
1150+
11431151
seq_printf(seq, "mailbox owned by %s\n\n", owner[i]);
11441152

11451153
for (i = 0; i < MBOX_LEN; i += 8)

0 commit comments

Comments
 (0)