Skip to content

ide: fix atapi software reset

John Snow qemu-devel 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 5 repliesIn review
  2. v15 patches 4 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6ide: Prohibit RESET on IDE driveshw/ide/core.c+7 -30 replies
2/6ide: code motionhw/ide/core.c+58 -580 replies
3/6ide: move buffered DMA cancel to corehw/ide/core.c hw/ide/internal.h hw/ide/pci.c+47 -350 replies
4/6ide: replace blk_drain_all by blk_drainhw/ide/core.c+1 -10 replies
5/6ide: Add silent DRQ cancellationhw/ide/core.c+16 -33 replies
6/6ide: fix device_reset to not ignore pending AIOhw/ide/core.c+17 -100 replies

Reviews trailers per patch

None of the 6 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchStefan Hajnoczi
SeriesR-b
1/6
2/6
3/6
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 0/6] ide: fix atapi software reset

The ATAPI software reset function is implemented somewhat lackadaisically.

Firstly, it is valid only for ATAPI drives - not HDs. If a HD should receive this command while BSY, it should be ignored like any other command instead of aborted. A non-BSY HD is free to abort the command in the usual fashion to indicate it doesn't understand or doesn't support that command.

Second, for drives that should accept a software reset, they should not "forget" about all pending AIO during the reset. Since a software reset resets the DRQ and BSY flags, it is possible to 'stack' multiple concurrent reads using DMA and alternately chaining software reset and DMA reads. We mustn't reset BSY/DRQ until we are confident that we have canceled existing AIO.

Third, the existing software reset routine does not perform a very rigorous reset.

This series corrects this by:

(1) Correcting ide_exec_cmd to correctly ignore, not abort, software reset commands for ide-hd devices that are busy executing a command.

(2) Improving the software reset routine to cancel buffered DMA, then fall back to synchronously waiting for any pending DMA to finish before returning, insuring that the reset completes sanely.

(3) Use existing reset routines to comprehensively reset the device.

________________________________________________________________________________

For convenience, this branch is available at:
https://github.com/jnsnow/qemu.git branch ide-reset-fix
https://github.com/jnsnow/qemu/tree/ide-reset-fix

This version is tagged ide-reset-fix-v2:
https://github.com/jnsnow/qemu/releases/tag/ide-reset-fix-v2

John Snow (6):
ide: Prohibit RESET on IDE drives
ide: code motion
ide: move buffered DMA cancel to core
ide: replace blk_drain_all by blk_drain
ide: Add silent DRQ cancellation
ide: fix device_reset to not ignore pending AIO

 hw/ide/core.c     | 215 ++++++++++++++++++++++++++++++++++++------------------
 hw/ide/internal.h |   1 +
 hw/ide/pci.c      |  36 +--------
 3 files changed, 144 insertions(+), 108 deletions(-)
Signature · 1 line
2.4.3