Patchwork esp: On qemu-system-sparc's esp, TC is not set properly

login
register
mail settings
Submitter Ryo ONODERA
Date Sept. 25, 2012, 5:44 p.m.
Message ID <1348595075-4531-1-git-send-email-ryo_on@yk.rim.or.jp>
Download mbox | patch
Permalink /patch/186875/
State New
Headers show

Comments

Ryo ONODERA - Sept. 25, 2012, 5:44 p.m.
I does not understand hw/esp.c fully.
This patch supresses esp/TC related errors on NetBSD/sparc 5.1.2 or 6.0_RC2.

Please review the patch.

This is patch for https://bugs.launchpad.net/qemu/+bug/1055090 .

Signed-off-by: Ryo ONODERA <ryo_on@yk.rim.or.jp>
---
 hw/esp.c | 8 ++++++++
 1 file changed, 8 insertions(+)
Ryo ONODERA - Sept. 25, 2012, 6:15 p.m.
Hi,

From: Ryo ONODERA <ryo_on@yk.rim.or.jp>, Date: Wed, 26 Sep 2012 02:44:35 +0900

> I does not understand hw/esp.c fully.
> This patch supresses esp/TC related errors on NetBSD/sparc 5.1.2 or 6.0_RC2.
> 
> Please review the patch.
> 
> This is patch for https://bugs.launchpad.net/qemu/+bug/1055090 .
> 
> Signed-off-by: Ryo ONODERA <ryo_on@yk.rim.or.jp>
> ---
>  hw/esp.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/hw/esp.c b/hw/esp.c
> index 84a4e74..cd14ed1 100644
> --- a/hw/esp.c
> +++ b/hw/esp.c
> @@ -91,6 +91,10 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf)
>          dmalen |= s->rregs[ESP_TCMID] << 8;
>          dmalen |= s->rregs[ESP_TCHI] << 16;
>          s->dma_memory_read(s->dma_opaque, buf, dmalen);
> +        s->rregs[ESP_RSTAT] |= STAT_TC;
> +        s->rregs[ESP_TCLO] = 0;
> +        s->rregs[ESP_TCMID] = 0;
> +        s->rregs[ESP_TCHI] = 0;
>      } else {
>          dmalen = s->ti_size;
>          memcpy(buf, s->ti_buf, dmalen);
> @@ -242,6 +246,10 @@ static void esp_do_dma(ESPState *s)
>      if (s->do_cmd) {
>          trace_esp_do_dma(s->cmdlen, len);
>          s->dma_memory_read(s->dma_opaque, &s->cmdbuf[s->cmdlen], len);
> +        s->rregs[ESP_RSTAT] |= STAT_TC;
> +        s->rregs[ESP_TCLO] = 0;
> +        s->rregs[ESP_TCMID] = 0;
> +        s->rregs[ESP_TCHI] = 0;
>          s->ti_size = 0;
>          s->cmdlen = 0;
>          s->do_cmd = 0;

Sadly I have gotten same errors on NetBSD/sparc just after the report.

esp0: !TC on DATA XFER [intr 10, stat 83, step 0] prevphase 2, resid 0

Could qemu experts investigate this problem?

Thank you.

--
Ryo ONODERA // ryo_on@yk.rim.or.jp
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3
Blue Swirl - Sept. 30, 2012, 3:02 p.m.
On Tue, Sep 25, 2012 at 6:15 PM, Ryo ONODERA <ryo_on@yk.rim.or.jp> wrote:
> Hi,
>
> From: Ryo ONODERA <ryo_on@yk.rim.or.jp>, Date: Wed, 26 Sep 2012 02:44:35 +0900
>
>> I does not understand hw/esp.c fully.
>> This patch supresses esp/TC related errors on NetBSD/sparc 5.1.2 or 6.0_RC2.
>>
>> Please review the patch.
>>
>> This is patch for https://bugs.launchpad.net/qemu/+bug/1055090 .
>>
>> Signed-off-by: Ryo ONODERA <ryo_on@yk.rim.or.jp>
>> ---
>>  hw/esp.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/hw/esp.c b/hw/esp.c
>> index 84a4e74..cd14ed1 100644
>> --- a/hw/esp.c
>> +++ b/hw/esp.c
>> @@ -91,6 +91,10 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf)
>>          dmalen |= s->rregs[ESP_TCMID] << 8;
>>          dmalen |= s->rregs[ESP_TCHI] << 16;
>>          s->dma_memory_read(s->dma_opaque, buf, dmalen);
>> +        s->rregs[ESP_RSTAT] |= STAT_TC;
>> +        s->rregs[ESP_TCLO] = 0;
>> +        s->rregs[ESP_TCMID] = 0;
>> +        s->rregs[ESP_TCHI] = 0;
>>      } else {
>>          dmalen = s->ti_size;
>>          memcpy(buf, s->ti_buf, dmalen);
>> @@ -242,6 +246,10 @@ static void esp_do_dma(ESPState *s)
>>      if (s->do_cmd) {
>>          trace_esp_do_dma(s->cmdlen, len);
>>          s->dma_memory_read(s->dma_opaque, &s->cmdbuf[s->cmdlen], len);
>> +        s->rregs[ESP_RSTAT] |= STAT_TC;
>> +        s->rregs[ESP_TCLO] = 0;
>> +        s->rregs[ESP_TCMID] = 0;
>> +        s->rregs[ESP_TCHI] = 0;
>>          s->ti_size = 0;
>>          s->cmdlen = 0;
>>          s->do_cmd = 0;
>
> Sadly I have gotten same errors on NetBSD/sparc just after the report.
>
> esp0: !TC on DATA XFER [intr 10, stat 83, step 0] prevphase 2, resid 0
>
> Could qemu experts investigate this problem?

The error seems to be harmless, I was able to install NetBSD/sparc
5.1.2 and boot the installed system.

But the patch looks OK too except maybe RSTAT may need to be set
instead of ORed, possibly with other bits like other cases.

>
> Thank you.
>
> --
> Ryo ONODERA // ryo_on@yk.rim.or.jp
> PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3
>
>
>

Patch

diff --git a/hw/esp.c b/hw/esp.c
index 84a4e74..cd14ed1 100644
--- a/hw/esp.c
+++ b/hw/esp.c
@@ -91,6 +91,10 @@  static uint32_t get_cmd(ESPState *s, uint8_t *buf)
         dmalen |= s->rregs[ESP_TCMID] << 8;
         dmalen |= s->rregs[ESP_TCHI] << 16;
         s->dma_memory_read(s->dma_opaque, buf, dmalen);
+        s->rregs[ESP_RSTAT] |= STAT_TC;
+        s->rregs[ESP_TCLO] = 0;
+        s->rregs[ESP_TCMID] = 0;
+        s->rregs[ESP_TCHI] = 0;
     } else {
         dmalen = s->ti_size;
         memcpy(buf, s->ti_buf, dmalen);
@@ -242,6 +246,10 @@  static void esp_do_dma(ESPState *s)
     if (s->do_cmd) {
         trace_esp_do_dma(s->cmdlen, len);
         s->dma_memory_read(s->dma_opaque, &s->cmdbuf[s->cmdlen], len);
+        s->rregs[ESP_RSTAT] |= STAT_TC;
+        s->rregs[ESP_TCLO] = 0;
+        s->rregs[ESP_TCMID] = 0;
+        s->rregs[ESP_TCHI] = 0;
         s->ti_size = 0;
         s->cmdlen = 0;
         s->do_cmd = 0;