Currently the completion queue processing routine in UFS does not check whether there is available space. This can cause CQ entries to be discarded and overwritten. This series include a fix for the issue based on how NVMe processes completions. It also includes a test to illustrate the issue.
Before applying the fix, the test will fail with: ERROR:../tests/qtest/ufs-test.c:801:ufstest_mcq_cq_wraparound: assertion failed (completed == num_requests): (0 == 32) Ilia Levi (2): hw/ufs: Fix mcq completion queue wraparound tests/qtest/ufs-test: Add test for mcq completion queue wraparound hw/ufs/ufs.c | 20 ++++++- hw/ufs/ufs.h | 9 +++ tests/qtest/ufs-test.c | 125 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+), 1 deletion(-) -- 2.49.1
