Re: [PATCH v2 1/2] scsi: ufs: core: Avoid unsafe MMIO reads in ufshcd_mcq_compl_all_cqes_lock()

From: Bart Van Assche

Date: Fri Sep 25 2026 - 13:37:45 EST


On 9/18/26 7:38 AM, Stanley Jhu wrote:
+ /* After processed the cqe, mark it empty (invalid) entry */

Please fix the grammar in the above source code comment and use capital
letters for "CQE".

+ /*
+ * All completion entries have been processed and cleared.
+ * Synchronize tail to head in software to mark the queue empty,
+ * avoiding an MMIO read of CQTPy while the controller is disabled.
+ */
+ hwq->cq_tail_slot = hwq->cq_head_slot;

This assignment can be removed because if the above code is reached
it is guaranteed that hwq->cq_tail_slot == hwq->cq_head_slot and later
code zeroes both slot indexes anyway (ufshcd_host_reset_and_restore()
-> ufshcd_mcq_config_resource()).

Thanks,

Bart.