[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 02/59] ide/atapi: Mark non-data commands as comple
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL v2 02/59] ide/atapi: Mark non-data commands as complete |
Date: |
Mon, 22 Sep 2014 12:41:33 +0100 |
From: John Snow <address@hidden>
When the command completion code in IDE and AHCI
was unified to put all command completion inside
of a callback, "cmd_done," we neglected to
ensure that all AHCI/ATAPI command paths would
eventually register as finished. for the PCI
interface to IDE this is not a problem because
cmd_done is a nop, but the AHCI implementation
needs to send a D2H_REG_FIS and interrupt back
to the guest to inform of completion.
This patch adds calls to ide_stop_transfer,
which calls ide_cmd_done, inside of
ide_atapi_cmd_ok and ide_atapi_cmd_error.
This fixes regressions observed by trying to boot QEMU
with a Fedora 20 live CD under Q35/AHCI, which uses
ATAPI command 0x00, which is a status check that may
cause a hang because we never complete, and ATAPI
command 0x56, which is unsupported by our current
implementation and results in an error that we never
report back to the guest.
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/ide/atapi.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 6d52cda..10218df 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -136,6 +136,7 @@ void ide_atapi_cmd_ok(IDEState *s)
s->error = 0;
s->status = READY_STAT | SEEK_STAT;
s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD;
+ ide_transfer_stop(s);
ide_set_irq(s->bus);
}
@@ -149,6 +150,7 @@ void ide_atapi_cmd_error(IDEState *s, int sense_key, int
asc)
s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD;
s->sense_key = sense_key;
s->asc = asc;
+ ide_transfer_stop(s);
ide_set_irq(s->bus);
}
@@ -176,9 +178,7 @@ void ide_atapi_cmd_reply_end(IDEState *s)
#endif
if (s->packet_transfer_size <= 0) {
/* end of transfer */
- s->status = READY_STAT | SEEK_STAT;
- s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO |
ATAPI_INT_REASON_CD;
- ide_transfer_stop(s);
+ ide_atapi_cmd_ok(s);
ide_set_irq(s->bus);
#ifdef DEBUG_IDE_ATAPI
printf("status=0x%x\n", s->status);
@@ -188,7 +188,6 @@ void ide_atapi_cmd_reply_end(IDEState *s)
if (s->lba != -1 && s->io_buffer_index >= s->cd_sector_size) {
ret = cd_read_sector(s, s->lba, s->io_buffer, s->cd_sector_size);
if (ret < 0) {
- ide_transfer_stop(s);
ide_atapi_io_error(s, ret);
return;
}
--
1.9.3
- [Qemu-devel] [PULL v2 00/59] Block patches, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 01/59] block/vhdx.c: Mark parent_vhdx_guid variable as unused, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 02/59] ide/atapi: Mark non-data commands as complete,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL v2 04/59] ide/ahci: Check for -ECANCELED in aio callbacks, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 05/59] block: Add refcnt in BlockDriverAIOCB, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 03/59] aio-win32: fix uninitialized use of have_select_revents, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 06/59] block: Add bdrv_aio_cancel_async, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 07/59] block: Drop bdrv_em_co_aiocb_info.cancel, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 08/59] block: Drop bdrv_em_aiocb_info.cancel, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 09/59] thread-pool: Convert thread_pool_aiocb_info.cancel to cancel_async, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 10/59] linux-aio: Convert laio_aiocb_info.cancel to .cancel_async, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 11/59] dma: Convert dma_aiocb_info.cancel to .cancel_async, Stefan Hajnoczi, 2014/09/22
- [Qemu-devel] [PULL v2 13/59] archipelago: Drop archipelago_aiocb_info.cancel, Stefan Hajnoczi, 2014/09/22