Page MenuHomeFreeBSD

dwmmc: cleanup cmd and locking, consistency between mmc and mmccam
ClosedPublic

Authored by bz on Jul 29 2025, 8:13 PM.
Tags
None
Referenced Files
F131686768: D51628.diff
Fri, Oct 10, 8:33 AM
Unknown Object (File)
Fri, Oct 3, 9:40 PM
Unknown Object (File)
Thu, Oct 2, 4:03 PM
Unknown Object (File)
Thu, Sep 25, 5:28 AM
Unknown Object (File)
Tue, Sep 23, 4:24 PM
Unknown Object (File)
Wed, Sep 17, 11:17 AM
Unknown Object (File)
Sep 1 2025, 9:18 AM
Unknown Object (File)
Aug 30 2025, 4:49 AM
Subscribers

Details

Summary

In general sprinkle locking assertions and harmonized KASSERTs
throughout the upper part of the driver to document expectations.

In dwmmc_cmd_done() "cmd" should be set correctly and be used for
both MMCCAM and classic mmc rather than special-casing mmccam.
In dwmmc_next_operation() place variable declarations on the top
for both cases before the first debug and lock assertion calls;
then factor out common parts at the end and put both cases in the
same order.
By calling dwmmc_next_operation() directly from both dwmmc_request()
in the mmc case, and dwmmc_cam_request() in the mmccase (rather than)
chaining calls in the latter, we avoid unlocking the sc in the mmccam
case and have a consistent call path from both; also removing the
mmccam #ifdef from dwmmc_request() brings more clarity.
In dwmmc_next_operation() enhance the panic/error messages with
some extra information and assert that we come in with a cam pinfo
on CAM_ACTIVE_INDEX.

MFC after: 3 days

Test Plan

@imp, while I believe this to be true, we should never
end up here not on CAM_ACTIVE_INDEX as the KASSERT
documents, right?

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bz requested review of this revision.Jul 29 2025, 8:13 PM
bz created this revision.
This revision is now accepted and ready to land.Jul 30 2025, 6:02 AM

This change looks good, I say belatedly. the one suggestion is really kinda weak and mostly super-duper paranoia that other drivers don't do...

sys/dev/mmc/host/dwmmc.c
1510

might want to assert this is a MMCIO, though that may be a bit much