Skip to content

Commit 8d8d375

Browse files
Xu Lujoergroedel
authored andcommitted
iommu/riscv: Empty iommu queue before enabling it
Changing cqen/fqen/pqen from 0 to 1 sets the cqh/fqt/pqt registers to 0. But the cqt/fqh/pqh registers are left unmodified. This commit resets cqt/fqh/pqh registers to ensure corresponding queues are empty before being enabled during initialization. Signed-off-by: Xu Lu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent d5f88ac commit 8d8d375

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/iommu/riscv/iommu.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ static int riscv_iommu_queue_enable(struct riscv_iommu_device *iommu,
240240
return rc;
241241
}
242242

243+
/* Empty queue before enabling it */
244+
if (queue->qid == RISCV_IOMMU_INTR_CQ)
245+
riscv_iommu_writel(queue->iommu, Q_TAIL(queue), 0);
246+
else
247+
riscv_iommu_writel(queue->iommu, Q_HEAD(queue), 0);
248+
243249
/*
244250
* Enable queue with interrupts, clear any memory fault if any.
245251
* Wait for the hardware to acknowledge request and activate queue

0 commit comments

Comments
 (0)