* [Qemu-devel] [PATCH 1/1] ide/atapi: Mark non-data commands as complete
@ 2014-09-12 16:00 John Snow
2014-09-12 16:08 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: John Snow @ 2014-09-12 16:00 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_set_inactive,
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 | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 3d92b52..3e9ad7b 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_set_inactive(s, false);
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_set_inactive(s, false);
ide_set_irq(s->bus);
}
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] ide/atapi: Mark non-data commands as complete
2014-09-12 16:00 [Qemu-devel] [PATCH 1/1] ide/atapi: Mark non-data commands as complete John Snow
@ 2014-09-12 16:08 ` Paolo Bonzini
2014-09-12 18:56 ` John Snow
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2014-09-12 16:08 UTC (permalink / raw)
To: John Snow, qemu-devel; +Cc: kwolf, stefanha
Il 12/09/2014 18:00, 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_set_inactive,
> 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 | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
> index 3d92b52..3e9ad7b 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_set_inactive(s, false);
> 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_set_inactive(s, false);
> ide_set_irq(s->bus);
> }
>
>
The set_inactive callback does nothing on AHCI, but is DMA-specific for
PCI. Even though you probably aren't seeing any bad effects, I think
ide_transfer_stop is a better match. It would also match what
ide_atapi_cmd_reply_end does before calling ide_atapi_cmd_error (via
ide_atapi_io_error) and before an inlined copy of ide_atapi_cmd_ok. So
you would get a bugfix and a cleanup at once.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH 1/1] ide/atapi: Mark non-data commands as complete
2014-09-12 16:08 ` Paolo Bonzini
@ 2014-09-12 18:56 ` John Snow
0 siblings, 0 replies; 3+ messages in thread
From: John Snow @ 2014-09-12 18:56 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: kwolf, stefanha
On 09/12/2014 12:08 PM, Paolo Bonzini wrote:
> Il 12/09/2014 18:00, 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_set_inactive,
>> 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 | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
>> index 3d92b52..3e9ad7b 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_set_inactive(s, false);
>> 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_set_inactive(s, false);
>> ide_set_irq(s->bus);
>> }
>>
>>
>
> The set_inactive callback does nothing on AHCI, but is DMA-specific for
> PCI. Even though you probably aren't seeing any bad effects, I think
> ide_transfer_stop is a better match. It would also match what
> ide_atapi_cmd_reply_end does before calling ide_atapi_cmd_error (via
> ide_atapi_io_error) and before an inlined copy of ide_atapi_cmd_ok. So
> you would get a bugfix and a cleanup at once.
>
> Paolo
>
OK. I am going to hold on to the revised patch for extended testing, I
am seeing some strange issues and I want to fix it correctly instead of
introduce new regressions with a quick fix.
--j
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-12 18:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-12 16:00 [Qemu-devel] [PATCH 1/1] ide/atapi: Mark non-data commands as complete John Snow
2014-09-12 16:08 ` Paolo Bonzini
2014-09-12 18:56 ` John Snow
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).