[PATCH 0/2] hw/ufs: Fix mcq completion queue wraparound

Ilia Levi posted 2 patches 1 month, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251222123559.3387-1-ilia.levi@intel.com
Maintainers: Jeuk Kim <jeuk20.kim@samsung.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
hw/ufs/ufs.c           |  20 ++++++-
hw/ufs/ufs.h           |   9 +++
tests/qtest/ufs-test.c | 125 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 153 insertions(+), 1 deletion(-)
[PATCH 0/2] hw/ufs: Fix mcq completion queue wraparound
Posted by Ilia Levi 1 month, 2 weeks ago
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
Re: [PATCH 0/2] hw/ufs: Fix mcq completion queue wraparound
Posted by Jeuk Kim 1 month ago
On 12/22/2025 9:35 PM, Ilia Levi wrote:
> 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(-)

Hi Ilia,

Sorry for the late reply. Thanks a lot for the fix and the test.

Reviewed-by: Jeuk Kim <jeuk20.kim@samsung.com>