Skip to contentSkip to conversation

Sun4m : SCSI ESP controller

PATCH In review Olivier Danet 3 participants 6 messages Feb 16, 2014 – Feb 23, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Sun4m : SCSI ESP controller

Two small fixes for the ESP (AM53C94) SCSI controller

* Signal the end of the DMA transfer after a SCSI command.

* The status register (RSTAT) is cleared after reading the interrupt status register (RINTR), except for the TC bit (=Count To Zero) and the scsi phase bits, which mirror SCSI signals levels.

Fixes the bug "esp0: !TC on DATA XFER" with NetBSD
https://bugs.launchpad.net/qemu/+bug/1055090

---
 hw/scsi/esp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/scsi/esp.c +2 -2
index 2d150bf..5e91077 100644
@@ -246,6 +246,7 @@ static void esp_do_dma(ESPState *s)
         s->cmdlen = 0;
         s->do_cmd = 0;
         do_cmd(s, s->cmdbuf);
+        esp_dma_done(s);
         return;
     }
     if (s->async_len == 0) {
@@ -417,10 +418,9 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr)
            except TC */
         old_val = s->rregs[ESP_RINTR];
         s->rregs[ESP_RINTR] = 0;
-        s->rregs[ESP_RSTAT] &= ~STAT_TC;
         s->rregs[ESP_RSEQ] = SEQ_CD;
         esp_lower_irq(s);
-
+        s->rregs[ESP_RSTAT] &= STAT_TC | STAT_MI;
         return old_val;
     default:
         break;
Signature · 1 line
1.8.1.5
#1 lore raw
Quoted 32 lines · Olivier Danet

Two small fixes for the ESP (AM53C94) SCSI controller

* Signal the end of the DMA transfer after a SCSI command.

* The status register (RSTAT) is cleared after reading the interrupt status register (RINTR), except for the TC bit (=Count To Zero) and the scsi phase bits, which mirror SCSI signals levels.

Fixes the bug "esp0: !TC on DATA XFER" with NetBSD
https://bugs.launchpad.net/qemu/+bug/1055090

---
hw/scsi/esp.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
hw/scsi/esp.c +1 -0
index 2d150bf..5e91077 100644
@@ -246,6 +246,7 @@ static void esp_do_dma(ESPState *s)
 s->cmdlen = 0;
 s->do_cmd = 0;
 do_cmd(s, s->cmdbuf);
+ esp_dma_done(s);
 return;
 }
 if (s->async_len == 0) {
@@ -417,10 +418,9 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr)

except TC */
old_val = s->rregs[ESP_RINTR];
s->rregs[ESP_RINTR] = 0;

Quoted 8 lines

- s->rregs[ESP_RSTAT] &= ~STAT_TC;
s->rregs[ESP_RSEQ] = SEQ_CD;
esp_lower_irq(s);
-
+ s->rregs[ESP_RSTAT] &= STAT_TC | STAT_MI;
return old_val;
default:
break;

Hi Olivier,

I've applied the non-whitespace damaged patch (attached) but unfortunately I still see the "!TC on DATA XFER" bug with my NetBSD 5 ISO under qemu-system-sparc :/ Note that the second part of the patch showed some fuzz so I'm wondering if this patch is complete or whether part of it is still missing?

Also ESP patches should have an esp or scsi/esp prefix in the subject line and should CC the current SCSI maintainer (see MAINTAINERS file) which is currently Paolo.

HTH,

Mark.

Return-Path: <[email protected]>
Delivered-To: unknown
Received: from mail.ilande.co.uk (82.165.15.123:995) by mca-desktop with
POP3-SSL; 16 Feb 2014 23:15:04 -0000
Envelope-to: [email protected]
Delivery-date: Sun, 16 Feb 2014 23:13:20 +0000
Received: from lists.gnu.org ([208.118.235.17])

	by s16892447.onlinehome-server.info with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.76)
	(envelope-from <[email protected]>)
	id 1WFAth-0002KD-0Y
	for [email protected]; Sun, 16 Feb 2014 23:13:19 +0000
Received: from localhost ([::1]:35381 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <[email protected]>)
	id 1WFAtZ-0005sM-EF
	for [email protected]; Sun, 16 Feb 2014 18:13:09 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45790)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <[email protected]>) id 1WFAsk-0004o1-Ca
	for [email protected]; Sun, 16 Feb 2014 18:12:23 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <[email protected]>) id 1WFAsf-0004UU-4E
	for [email protected]; Sun, 16 Feb 2014 18:12:18 -0500

Received: from mout.gmx.net ([212.227.15.18]:50241)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from <[email protected]>) id 1WFAse-0004UQ-RR for [email protected]; Sun, 16 Feb 2014 18:12:13 -0500
Received: from [192.168.1.24] ([90.38.117.132]) by mail.gmx.com (mrgmx102)

	with ESMTPSA (Nemesis) id 0MZwYd-1WaHhN2a3L-00LpC4 for
	<[email protected]>; Mon, 17 Feb 2014 00:12:11 +0100

Message-ID: <[email protected]>
Date: Mon, 17 Feb 2014 00:13:42 +0100
From: Olivier Danet <[email protected]>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;

	rv:24.0) Gecko/20100101 Thunderbird/24.3.0

MIME-Version: 1.0
To: qemu-devel <[email protected]>, Blue Swirl <[email protected]>,
Mark Cave-Ayland <[email protected]>, Artyom Tarasenko <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K0:dTf3Ng2SR2hoC84GUEPPGIG7swVLITC+kwoZJU1NPn1G0hz/d99

	GriJbXlzO8YZlcJk/hIKyyMkLyqBI/uXSxagybTB2BdC/cgkZgFCe0O8RnMpUvEsp+MzL7W
	YmHmlDOhgAWB8zqJK+AYngRp3AnDmHxUdIXdO7Qi506pLWUotz5BlBBls4TfBbIvA5WbFpz
	XbbXBYD0tM0RA5iD8LA4A==

X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
X-Received-From: 212.227.15.18
X-BeenThere: [email protected]
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
<mailto:[email protected]?subject=unsubscribe>
List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:[email protected]>
List-Help: <mailto:[email protected]?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
<mailto:[email protected]?subject=subscribe>
X-Mailman-Copy: yes
Errors-To: [email protected]
Sender: [email protected]
X-SA-Exim-Connect-IP: 208.118.235.17
X-SA-Exim-Mail-From: [email protected]
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on

	s16892447.onlinehome-server.info

X-Spam-Level:
X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
RCVD_IN_DNSWL_HI,SPF_PASS autolearn=ham version=3.3.2
Subject: [Qemu-devel] [PATCH] Sun4m : SCSI ESP controller
X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000)
X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info)

Two small fixes for the ESP (AM53C94) SCSI controller

* Signal the end of the DMA transfer after a SCSI command.

* The status register (RSTAT) is cleared after reading the interrupt status register (RINTR), except for the TC bit (=Count To Zero) and the scsi phase bits, which mirror SCSI signals levels.

Fixes the bug "esp0: !TC on DATA XFER" with NetBSD
https://bugs.launchpad.net/qemu/+bug/1055090

---
  hw/scsi/esp.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/scsi/esp.c +2 -2
index 2d150bf..5e91077 100644
@@ -246,6 +246,7 @@ static void esp_do_dma(ESPState *s)
         s->cmdlen = 0;
         s->do_cmd = 0;
         do_cmd(s, s->cmdbuf);
+        esp_dma_done(s);
         return;
      }
      if (s->async_len == 0) {
@@ -417,10 +418,9 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr)
            except TC */
         old_val = s->rregs[ESP_RINTR];
         s->rregs[ESP_RINTR] = 0;
-        s->rregs[ESP_RSTAT] &= ~STAT_TC;
         s->rregs[ESP_RSEQ] = SEQ_CD;
         esp_lower_irq(s);
-
+        s->rregs[ESP_RSTAT] &= STAT_TC | STAT_MI;
         return old_val;
     default:
         break;
Signature · 1 line
1.8.1.5
#2 lore raw

Il 20/02/2014 09:58, Mark Cave-Ayland ha scritto:

Quoted 9 lines

Hi Olivier,

I've applied the non-whitespace damaged patch (attached) but unfortunately I still see the "!TC on DATA XFER" bug with my NetBSD 5 ISO under qemu-system-sparc :/ Note that the second part of the patch showed some fuzz so I'm wondering if this patch is complete or whether part of it is still missing?

Quoted 4 lines

Also ESP patches should have an esp or scsi/esp prefix in the subject line and should CC the current SCSI maintainer (see MAINTAINERS file) which is currently Paolo.

BTW, Mark, should you add yourself to MAINTAINERS for sparc?

Paolo

#4 lore raw
In reply to Mark Cave-Ayland
Quoted 45 lines · Mark Cave-Ayland
Quoted 32 lines · Olivier Danet

Two small fixes for the ESP (AM53C94) SCSI controller

* Signal the end of the DMA transfer after a SCSI command.

* The status register (RSTAT) is cleared after reading the interrupt status register (RINTR), except for the TC bit (=Count To Zero) and the scsi phase bits, which mirror SCSI signals levels.

Fixes the bug "esp0: !TC on DATA XFER" with NetBSD
https://bugs.launchpad.net/qemu/+bug/1055090

---
hw/scsi/esp.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
hw/scsi/esp.c +1 -0
index 2d150bf..5e91077 100644
@@ -246,6 +246,7 @@ static void esp_do_dma(ESPState *s)
 s->cmdlen = 0;
 s->do_cmd = 0;
 do_cmd(s, s->cmdbuf);
+ esp_dma_done(s);
 return;
 }
 if (s->async_len == 0) {
@@ -417,10 +418,9 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr)

except TC */
old_val = s->rregs[ESP_RINTR];
s->rregs[ESP_RINTR] = 0;

Quoted 8 lines

- s->rregs[ESP_RSTAT] &= ~STAT_TC;
s->rregs[ESP_RSEQ] = SEQ_CD;
esp_lower_irq(s);
-
+ s->rregs[ESP_RSTAT] &= STAT_TC | STAT_MI;
return old_val;
default:
break;

Hi Olivier,

Quoted 8 lines

I've applied the non-whitespace damaged patch (attached) but unfortunately I still see the "!TC on DATA XFER" bug with my NetBSD 5 ISO under qemu-system-sparc :/ Note that the second part of the patch showed some fuzz so I'm wondering if this patch is complete or whether part of it is still missing?

Also ESP patches should have an esp or scsi/esp prefix in the subject line and should CC the current SCSI maintainer (see MAINTAINERS file) which is currently Paolo.

HTH,

Mark.

I don't get these errors installing NetBSD 5 (tried 5.02 & 5.1). With NetBSD 6, the patch makes a lot of difference :

http://temlib.org/pub/qemu_tc_patch.png
http://temlib.org/pub/qemu_tc_nopatch.png

(the default terminal during install is terrible)

* The dma() part is a coherence bug in the ESP driver which does not update the DMA registers after a command transfer.

* The RINTR part makes the driver match more closely the datasheet:
http://sensi.org/download/doc/am53c94.pdf
Page 19/63

These modifications are not particularly tailored for NetBSD nor SPARCs.

Olivier

(Sorry about the whitespaces, I will try to find out the cause !)

#5 lore raw
In reply to Mark Cave-Ayland
Quoted 49 lines · Mark Cave-Ayland
Quoted 32 lines · Olivier Danet

Two small fixes for the ESP (AM53C94) SCSI controller

* Signal the end of the DMA transfer after a SCSI command.

* The status register (RSTAT) is cleared after reading the interrupt status register (RINTR), except for the TC bit (=Count To Zero) and the scsi phase bits, which mirror SCSI signals levels.

Fixes the bug "esp0: !TC on DATA XFER" with NetBSD
https://bugs.launchpad.net/qemu/+bug/1055090

---
hw/scsi/esp.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
hw/scsi/esp.c +1 -0
index 2d150bf..5e91077 100644
@@ -246,6 +246,7 @@ static void esp_do_dma(ESPState *s)
 s->cmdlen = 0;
 s->do_cmd = 0;
 do_cmd(s, s->cmdbuf);
+ esp_dma_done(s);
 return;
 }
 if (s->async_len == 0) {
@@ -417,10 +418,9 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr)

except TC */
old_val = s->rregs[ESP_RINTR];
s->rregs[ESP_RINTR] = 0;

Quoted 8 lines

- s->rregs[ESP_RSTAT] &= ~STAT_TC;
s->rregs[ESP_RSEQ] = SEQ_CD;
esp_lower_irq(s);
-
+ s->rregs[ESP_RSTAT] &= STAT_TC | STAT_MI;
return old_val;
default:
break;

I've applied the non-whitespace damaged patch (attached) but unfortunately I still see the "!TC on DATA XFER" bug with my NetBSD 5 ISO under qemu-system-sparc :/ Note that the second part of the patch showed some fuzz so I'm wondering if this patch is complete or whether part of it is still missing?

Quoted 3 lines

Also ESP patches should have an esp or scsi/esp prefix in the subject line and should CC the current SCSI maintainer (see MAINTAINERS file) which is currently Paolo.

Hi Olivier,

I've done some more testing on this patch today, and what I've found is that there are 2 types of error emitted from the NetBSD ESP driver: the majority of the "!TC on DATA XFER" messages go away under NetBSD 6 with the patch, but I still get the occasional one on the console, particularly with NetBSD 5. There are still messages about DMA interrupts appearing as can be seen at http://www.ilande.co.uk/tmp/netbsd5-esp.png.

Both Linux and NetBSD seem to install fine with the patch applied, so no regressions there - I haven't had a chance to test Solaris yet. If Artyom could give this a quick test on his collection of Solaris images then I'd say the patch is okay to apply.

More interesting is that with or without the patch, if you boot a standard Debian etch .qcow2 HD image and then shut it down then you get the following kernel panic: http://www.ilande.co.uk/tmp/debian-esp.png.

So my current conclusion is that this patch doesn't appear to cause any noticeable regressions outside of Solaris, however there is a still a problem somewhere with the ESP DMA interrupts on SPARC32.

ATB,

Mark.

#3 lore raw
In reply to Paolo Bonzini
Quoted 10 lines · Paolo Bonzini

Il 20/02/2014 09:58, Mark Cave-Ayland ha scritto:

Quoted 9 lines

Hi Olivier,

I've applied the non-whitespace damaged patch (attached) but unfortunately I still see the "!TC on DATA XFER" bug with my NetBSD 5 ISO under qemu-system-sparc :/ Note that the second part of the patch showed some fuzz so I'm wondering if this patch is complete or whether part of it is still missing?

Quoted 6 lines
Quoted 4 lines

Also ESP patches should have an esp or scsi/esp prefix in the subject line and should CC the current SCSI maintainer (see MAINTAINERS file) which is currently Paolo.

BTW, Mark, should you add yourself to MAINTAINERS for sparc?

If people are okay to apply my patches then I don't mind :) I'll send this request through separately.

ATB,

Mark.