* [Qemu-devel] [PATCH v2 0/1] ide/atapi: Mark non-data commands as complete @ 2014-09-13 3:51 John Snow 2014-09-13 3:51 ` [Qemu-devel] [PATCH v2 1/1] " John Snow 2014-09-15 15:48 ` [Qemu-devel] [PATCH v2 0/1] " Stefan Hajnoczi 0 siblings, 2 replies; 4+ messages in thread From: John Snow @ 2014-09-13 3:51 UTC (permalink / raw) To: qemu-devel; +Cc: kwolf, pbonzini, jsnow, stefanha v2: - Instead of using ide_set_inactive, use ide_stop_transfer - ATAPI helpers use either ide_atapi_cmd_ok or ide_atapi_cmd_error, instead of ide_stop_transfer directly. John Snow (1): ide/atapi: Mark non-data commands as complete hw/ide/atapi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH v2 1/1] ide/atapi: Mark non-data commands as complete 2014-09-13 3:51 [Qemu-devel] [PATCH v2 0/1] ide/atapi: Mark non-data commands as complete John Snow @ 2014-09-13 3:51 ` John Snow 2014-09-13 10:35 ` Paolo Bonzini 2014-09-15 15:48 ` [Qemu-devel] [PATCH v2 0/1] " Stefan Hajnoczi 1 sibling, 1 reply; 4+ messages in thread From: John Snow @ 2014-09-13 3:51 UTC (permalink / raw) To: qemu-devel; +Cc: kwolf, pbonzini, jsnow, stefanha 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 <jsnow@redhat.com> --- 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 3d92b52..ee80c22 100644 --- a/hw/ide/atapi.c +++ b/hw/ide/atapi.c @@ -134,6 +134,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); } @@ -147,6 +148,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); } @@ -174,9 +176,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); @@ -186,7 +186,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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/1] ide/atapi: Mark non-data commands as complete 2014-09-13 3:51 ` [Qemu-devel] [PATCH v2 1/1] " John Snow @ 2014-09-13 10:35 ` Paolo Bonzini 0 siblings, 0 replies; 4+ messages in thread From: Paolo Bonzini @ 2014-09-13 10:35 UTC (permalink / raw) To: John Snow, qemu-devel; +Cc: kwolf, stefanha Il 13/09/2014 05:51, John Snow ha scritto: > 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 <jsnow@redhat.com> > --- > 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 3d92b52..ee80c22 100644 > --- a/hw/ide/atapi.c > +++ b/hw/ide/atapi.c > @@ -134,6 +134,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); > } > > @@ -147,6 +148,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); > } > > @@ -174,9 +176,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); > @@ -186,7 +186,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; > } > Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/1] ide/atapi: Mark non-data commands as complete 2014-09-13 3:51 [Qemu-devel] [PATCH v2 0/1] ide/atapi: Mark non-data commands as complete John Snow 2014-09-13 3:51 ` [Qemu-devel] [PATCH v2 1/1] " John Snow @ 2014-09-15 15:48 ` Stefan Hajnoczi 1 sibling, 0 replies; 4+ messages in thread From: Stefan Hajnoczi @ 2014-09-15 15:48 UTC (permalink / raw) To: John Snow; +Cc: kwolf, pbonzini, qemu-devel, stefanha [-- Attachment #1: Type: text/plain, Size: 534 bytes --] On Fri, Sep 12, 2014 at 11:51:11PM -0400, John Snow wrote: > v2: > > - Instead of using ide_set_inactive, use ide_stop_transfer > - ATAPI helpers use either ide_atapi_cmd_ok or ide_atapi_cmd_error, > instead of ide_stop_transfer directly. > > John Snow (1): > ide/atapi: Mark non-data commands as complete > > hw/ide/atapi.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > -- > 1.9.3 > > Thanks, applied to my block tree: https://github.com/stefanha/qemu/commits/block Stefan [-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-09-15 15:48 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-09-13 3:51 [Qemu-devel] [PATCH v2 0/1] ide/atapi: Mark non-data commands as complete John Snow 2014-09-13 3:51 ` [Qemu-devel] [PATCH v2 1/1] " John Snow 2014-09-13 10:35 ` Paolo Bonzini 2014-09-15 15:48 ` [Qemu-devel] [PATCH v2 0/1] " Stefan Hajnoczi
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.