All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] esp: minor fixes for older Linux versions
@ 2021-05-18 21:25 Mark Cave-Ayland
  2021-05-18 21:25 ` [PATCH 1/2] esp: only assert INTR_DC interrupt flag if selection fails Mark Cave-Ayland
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Mark Cave-Ayland @ 2021-05-18 21:25 UTC (permalink / raw)
  To: qemu-devel, qemu-stable, pbonzini, fam, laurent

Following on from the ESP changes in QEMU 6.0 someone pointed out that the old
Linux 2.6 ESP driver as used in Aurelian's SPARC image at
https://people.debian.org/~aurel32/qemu/sparc/ emits a constant stream of
"esp0: STEP_ASEL for tgt 0" messages to the console during boot.

These patches solve the issue so that the older image is able to boot cleanly
once again. The first patch is a genuine bug fix for the QEMU 6.0 changes whilst
the second works around the delayed bus phase change when deferring IO transfers
from the end of the command phase to the start of the information transfer
phase.

I've tested this using the extended suite of images used for the QEMU 6.0 changes
and confirmed that there are no other regressions.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


Mark Cave-Ayland (2):
  esp: only assert INTR_DC interrupt flag if selection fails
  esp: only set ESP_RSEQ at the start of the select sequence

 hw/scsi/esp.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

-- 
2.20.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] esp: only assert INTR_DC interrupt flag if selection fails
  2021-05-18 21:25 [PATCH 0/2] esp: minor fixes for older Linux versions Mark Cave-Ayland
@ 2021-05-18 21:25 ` Mark Cave-Ayland
  2021-05-18 21:25 ` [PATCH 2/2] esp: only set ESP_RSEQ at the start of the select sequence Mark Cave-Ayland
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Mark Cave-Ayland @ 2021-05-18 21:25 UTC (permalink / raw)
  To: qemu-devel, qemu-stable, pbonzini, fam, laurent

The datasheet sequence tables confirm that when a target selection fails, only
the INTR_DC interrupt flag should be asserted.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fixes: cf47a41e05 ("esp: latch individual bits in ESP_RINTR register")
---
 hw/scsi/esp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index b668acef82..000e45a624 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -213,7 +213,7 @@ static int esp_select(ESPState *s)
     if (!s->current_dev) {
         /* No such drive */
         s->rregs[ESP_RSTAT] = 0;
-        s->rregs[ESP_RINTR] |= INTR_DC;
+        s->rregs[ESP_RINTR] = INTR_DC;
         s->rregs[ESP_RSEQ] = SEQ_0;
         esp_raise_irq(s);
         return -1;
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] esp: only set ESP_RSEQ at the start of the select sequence
  2021-05-18 21:25 [PATCH 0/2] esp: minor fixes for older Linux versions Mark Cave-Ayland
  2021-05-18 21:25 ` [PATCH 1/2] esp: only assert INTR_DC interrupt flag if selection fails Mark Cave-Ayland
@ 2021-05-18 21:25 ` Mark Cave-Ayland
  2021-05-28  7:07 ` [PATCH 0/2] esp: minor fixes for older Linux versions Mark Cave-Ayland
  2021-06-09 12:13 ` Paolo Bonzini
  3 siblings, 0 replies; 6+ messages in thread
From: Mark Cave-Ayland @ 2021-05-18 21:25 UTC (permalink / raw)
  To: qemu-devel, qemu-stable, pbonzini, fam, laurent

When processing a command to select a target and send a CDB, the ESP device
maintains a sequence step register so that if an error occurs the host can
determine which part of the selection/CDB submission sequence failed.

The old Linux 2.6 driver is really pedantic here: it checks the sequence step
register even if a command succeeds and complains loudly on the console if the
sequence step register doesn't match the expected bus phase and interrupt flags.

This reason this mismatch occurs is because the ESP emulation currently doesn't
update the bus phase until the next TI (Transfer Information) command and so the
cleared sequence step register is considered invalid for the stale bus phase.

Normally this isn't an issue as the host only checks the sequence step register
if an error occurs but the old Linux 2.6 driver does this in several places
causing a large stream of "esp0: STEP_ASEL for tgt 0" messages to appear on the
console during the boot process.

Fix this by not clearing the sequence step register when reading the interrupt
register and clearing the DMA status, so the guest sees a valid sequence step
and bus phase combination at the end of the command phase. No other change is
required since the sequence step register is correctly updated throughout the
selection/CDB submission sequence once one of the select commands is issued.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fixes: 1b9e48a5bd ("esp: implement non-DMA transfers in PDMA mode")
---
 hw/scsi/esp.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index 000e45a624..18d4d56392 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -481,7 +481,6 @@ static void esp_dma_done(ESPState *s)
 {
     s->rregs[ESP_RSTAT] |= STAT_TC;
     s->rregs[ESP_RINTR] |= INTR_BS;
-    s->rregs[ESP_RSEQ] = 0;
     s->rregs[ESP_RFLAGS] = 0;
     esp_set_tc(s, 0);
     esp_raise_irq(s);
@@ -917,7 +916,15 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr)
         val = s->rregs[ESP_RINTR];
         s->rregs[ESP_RINTR] = 0;
         s->rregs[ESP_RSTAT] &= ~STAT_TC;
-        s->rregs[ESP_RSEQ] = SEQ_0;
+        /*
+         * According to the datasheet ESP_RSEQ should be cleared, but as the
+         * emulation currently defers information transfers to the next TI
+         * command leave it for now so that pedantic guests such as the old
+         * Linux 2.6 driver see the correct flags before the next SCSI phase
+         * transition.
+         *
+         * s->rregs[ESP_RSEQ] = SEQ_0;
+         */
         esp_lower_irq(s);
         break;
     case ESP_TCHI:
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] esp: minor fixes for older Linux versions
  2021-05-18 21:25 [PATCH 0/2] esp: minor fixes for older Linux versions Mark Cave-Ayland
  2021-05-18 21:25 ` [PATCH 1/2] esp: only assert INTR_DC interrupt flag if selection fails Mark Cave-Ayland
  2021-05-18 21:25 ` [PATCH 2/2] esp: only set ESP_RSEQ at the start of the select sequence Mark Cave-Ayland
@ 2021-05-28  7:07 ` Mark Cave-Ayland
  2021-06-07 11:00   ` Mark Cave-Ayland
  2021-06-09 12:13 ` Paolo Bonzini
  3 siblings, 1 reply; 6+ messages in thread
From: Mark Cave-Ayland @ 2021-05-28  7:07 UTC (permalink / raw)
  To: qemu-devel, qemu-stable, pbonzini, fam, laurent

On 18/05/2021 22:25, Mark Cave-Ayland wrote:

> Following on from the ESP changes in QEMU 6.0 someone pointed out that the old
> Linux 2.6 ESP driver as used in Aurelian's SPARC image at
> https://people.debian.org/~aurel32/qemu/sparc/ emits a constant stream of
> "esp0: STEP_ASEL for tgt 0" messages to the console during boot.
> 
> These patches solve the issue so that the older image is able to boot cleanly
> once again. The first patch is a genuine bug fix for the QEMU 6.0 changes whilst
> the second works around the delayed bus phase change when deferring IO transfers
> from the end of the command phase to the start of the information transfer
> phase.
> 
> I've tested this using the extended suite of images used for the QEMU 6.0 changes
> and confirmed that there are no other regressions.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> 
> 
> Mark Cave-Ayland (2):
>    esp: only assert INTR_DC interrupt flag if selection fails
>    esp: only set ESP_RSEQ at the start of the select sequence
> 
>   hw/scsi/esp.c | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)

Ping?


ATB,

Mark.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] esp: minor fixes for older Linux versions
  2021-05-28  7:07 ` [PATCH 0/2] esp: minor fixes for older Linux versions Mark Cave-Ayland
@ 2021-06-07 11:00   ` Mark Cave-Ayland
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Cave-Ayland @ 2021-06-07 11:00 UTC (permalink / raw)
  To: qemu-devel, qemu-stable, pbonzini, fam, laurent

On 28/05/2021 08:07, Mark Cave-Ayland wrote:

> On 18/05/2021 22:25, Mark Cave-Ayland wrote:
> 
>> Following on from the ESP changes in QEMU 6.0 someone pointed out that the old
>> Linux 2.6 ESP driver as used in Aurelian's SPARC image at
>> https://people.debian.org/~aurel32/qemu/sparc/ emits a constant stream of
>> "esp0: STEP_ASEL for tgt 0" messages to the console during boot.
>>
>> These patches solve the issue so that the older image is able to boot cleanly
>> once again. The first patch is a genuine bug fix for the QEMU 6.0 changes whilst
>> the second works around the delayed bus phase change when deferring IO transfers
>> from the end of the command phase to the start of the information transfer
>> phase.
>>
>> I've tested this using the extended suite of images used for the QEMU 6.0 changes
>> and confirmed that there are no other regressions.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>>
>>
>> Mark Cave-Ayland (2):
>>    esp: only assert INTR_DC interrupt flag if selection fails
>>    esp: only set ESP_RSEQ at the start of the select sequence
>>
>>   hw/scsi/esp.c | 13 ++++++++++---
>>   1 file changed, 10 insertions(+), 3 deletions(-)
> 
> Ping?

Ping again?


ATB,

Mark.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] esp: minor fixes for older Linux versions
  2021-05-18 21:25 [PATCH 0/2] esp: minor fixes for older Linux versions Mark Cave-Ayland
                   ` (2 preceding siblings ...)
  2021-05-28  7:07 ` [PATCH 0/2] esp: minor fixes for older Linux versions Mark Cave-Ayland
@ 2021-06-09 12:13 ` Paolo Bonzini
  3 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2021-06-09 12:13 UTC (permalink / raw)
  To: Mark Cave-Ayland, qemu-devel, qemu-stable, fam, laurent

On 18/05/21 23:25, Mark Cave-Ayland wrote:
> Following on from the ESP changes in QEMU 6.0 someone pointed out that the old
> Linux 2.6 ESP driver as used in Aurelian's SPARC image at
> https://people.debian.org/~aurel32/qemu/sparc/ emits a constant stream of
> "esp0: STEP_ASEL for tgt 0" messages to the console during boot.
> 
> These patches solve the issue so that the older image is able to boot cleanly
> once again. The first patch is a genuine bug fix for the QEMU 6.0 changes whilst
> the second works around the delayed bus phase change when deferring IO transfers
> from the end of the command phase to the start of the information transfer
> phase.
> 
> I've tested this using the extended suite of images used for the QEMU 6.0 changes
> and confirmed that there are no other regressions.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> 
> 
> Mark Cave-Ayland (2):
>    esp: only assert INTR_DC interrupt flag if selection fails
>    esp: only set ESP_RSEQ at the start of the select sequence
> 
>   hw/scsi/esp.c | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
> 

Queued, thanks.

Paolo



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-09 12:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 21:25 [PATCH 0/2] esp: minor fixes for older Linux versions Mark Cave-Ayland
2021-05-18 21:25 ` [PATCH 1/2] esp: only assert INTR_DC interrupt flag if selection fails Mark Cave-Ayland
2021-05-18 21:25 ` [PATCH 2/2] esp: only set ESP_RSEQ at the start of the select sequence Mark Cave-Ayland
2021-05-28  7:07 ` [PATCH 0/2] esp: minor fixes for older Linux versions Mark Cave-Ayland
2021-06-07 11:00   ` Mark Cave-Ayland
2021-06-09 12:13 ` Paolo Bonzini

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.