Skip to content

Commit

Permalink
dwc_eqos - fix verifier complaint about interrupt lock
Browse files Browse the repository at this point in the history
Interrupt lock can't be acquired until interrupts are connected, so
verifier complains about attempts to acquire/release the interrupt lock
in D0Entry/D0Exit. Fix by doing the work outside the lock, which is ok
because we don't really need a lock for this during D0Entry/D0Exit.
  • Loading branch information
idigdoug committed Jan 2, 2024
1 parent 43c80a1 commit 2bcb782
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions drivers/net/dwc_eqos/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ MakeChannelInterruptEnable(InterruptsWanted wanted)
return interruptEnable;
}

_IRQL_requires_min_(DISPATCH_LEVEL) // Actually HIGH_LEVEL.
_IRQL_requires_max_(HIGH_LEVEL)
static void
DeviceInterruptSet_Locked(_Inout_ MacRegisters* regs, InterruptsWanted wanted)
{
Expand Down Expand Up @@ -643,12 +643,15 @@ DeviceD0Entry(
macConfig.ChecksumOffloadEnable = context->config.txCoeSel || context->config.rxCoeSel;
Write32(&context->regs->Mac_Configuration, macConfig);

// Clear and then enable interrupts.
// Clear any pending interrupts, then unmask them.

NT_ASSERT(ReadNoFence8(&context->updateLinkStateBusy) == 0);
UpdateLinkState(context); // Clears LinkStatus interrupt.
Write32(&context->regs->Dma_Ch[0].Status, ChannelStatus_t(~0u));
DeviceInterruptEnable(context, InterruptsState);

NT_ASSERT(context->interruptsWanted == InterruptsNone);
context->interruptsWanted = InterruptsState;
DeviceInterruptSet_Locked(context->regs, InterruptsState); // Interrupts are disabled so interrupt lock is offline.

TraceEntryExitWithStatus(DeviceD0Entry, LEVEL_INFO, status,
TraceLoggingUInt32(previousState),
Expand All @@ -671,7 +674,9 @@ DeviceD0Exit(
NTSTATUS status = STATUS_SUCCESS;
auto const context = DeviceGetContext(device);

DeviceInterruptDisable(context, InterruptsAll);
DeviceInterruptSet_Locked(context->regs, InterruptsNone); // Interrupts are disabled so interrupt lock is offline.
context->interruptsWanted = InterruptsNone;

WdfWorkItemFlush(context->updateLinkStateWorkItem);
NT_ASSERT(ReadNoFence8(&context->updateLinkStateBusy) == 0);

Expand Down

0 comments on commit 2bcb782

Please sign in to comment.