cxgbe(4): Verify that the driver accesses the firmware mailbox in a
thread-safe manner. MFC after: 3 days
This commit is contained in:
parent
ff577cb645
commit
f6d9d14b93
@ -151,7 +151,7 @@ enum {
|
||||
/* adapter flags */
|
||||
FULL_INIT_DONE = (1 << 0),
|
||||
FW_OK = (1 << 1),
|
||||
/* INTR_DIRECT = (1 << 2), No longer used. */
|
||||
CHK_MBOX_ACCESS = (1 << 2),
|
||||
MASTER_PF = (1 << 3),
|
||||
ADAP_SYSCTL_CTX = (1 << 4),
|
||||
/* TOM_INIT_DONE= (1 << 5), No longer used */
|
||||
|
@ -286,6 +286,9 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
|
||||
__be64 cmd_rpl[MBOX_LEN/8];
|
||||
u32 pcie_fw;
|
||||
|
||||
if (adap->flags & CHK_MBOX_ACCESS)
|
||||
ASSERT_SYNCHRONIZED_OP(adap);
|
||||
|
||||
if ((size & 15) || size > MBOX_LEN)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -1221,6 +1221,15 @@ t4_attach(device_t dev)
|
||||
goto done;
|
||||
}
|
||||
|
||||
/*
|
||||
* Ensure thread-safe mailbox access (in debug builds).
|
||||
*
|
||||
* So far this was the only thread accessing the mailbox but various
|
||||
* ifnets and sysctls are about to be created and their handlers/ioctls
|
||||
* will access the mailbox from different threads.
|
||||
*/
|
||||
sc->flags |= CHK_MBOX_ACCESS;
|
||||
|
||||
rc = bus_generic_attach(dev);
|
||||
if (rc != 0) {
|
||||
device_printf(dev,
|
||||
@ -1336,6 +1345,7 @@ t4_detach_common(device_t dev)
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
sc->flags &= ~CHK_MBOX_ACCESS;
|
||||
if (sc->flags & FULL_INIT_DONE) {
|
||||
if (!(sc->flags & IS_VF))
|
||||
t4_intr_disable(sc);
|
||||
|
Loading…
x
Reference in New Issue
Block a user