[PATCH 02/16] lsi53c895a: do not do anything else is a reset is requested by writing ISTAT0

Paolo Bonzini posted 16 patches 5 days, 16 hours ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>, Richard Henderson <richard.henderson@linaro.org>, Helge Deller <deller@gmx.de>
[PATCH 02/16] lsi53c895a: do not do anything else is a reset is requested by writing ISTAT0
Posted by Paolo Bonzini 5 days, 16 hours ago
If the device is reset, anything that is done before will not really
be visible.  So do the reset and exit immediately if that is one
if the requests in the value written to ISTAT0.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/lsi53c895a.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 90643b26ab8..81b4f93f4d3 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -1949,6 +1949,10 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
     CASE_SET_REG32(dsa, 0x10)
     case 0x14: /* ISTAT0 */
         s->istat0 = (s->istat0 & 0x0f) | (val & 0xf0);
+        if (val & LSI_ISTAT0_SRST) {
+            device_cold_reset(DEVICE(s));
+            return;
+        }
         if (val & LSI_ISTAT0_ABRT) {
             lsi_script_dma_interrupt(s, LSI_DSTAT_ABRT);
         }
@@ -1962,9 +1966,6 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
             s->dsp = s->dnad;
             lsi_execute_script(s);
         }
-        if (val & LSI_ISTAT0_SRST) {
-            device_cold_reset(DEVICE(s));
-        }
         break;
     case 0x16: /* MBOX0 */
         s->mbox0 = val;
-- 
2.53.0
Re: [PATCH 02/16] lsi53c895a: do not do anything else is a reset is requested by writing ISTAT0
Posted by BALATON Zoltan 5 days, 15 hours ago
On Fri, 27 Mar 2026, Paolo Bonzini wrote:
> If the device is reset, anything that is done before will not really
> be visible.  So do the reset and exit immediately if that is one
> if the requests in the value written to ISTAT0.

Typo in above line: if -> of and in subject is -> if

Regards,
BALATON Zoltan

> Cc: qemu-stable@nongnu.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> hw/scsi/lsi53c895a.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
> index 90643b26ab8..81b4f93f4d3 100644
> --- a/hw/scsi/lsi53c895a.c
> +++ b/hw/scsi/lsi53c895a.c
> @@ -1949,6 +1949,10 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
>     CASE_SET_REG32(dsa, 0x10)
>     case 0x14: /* ISTAT0 */
>         s->istat0 = (s->istat0 & 0x0f) | (val & 0xf0);
> +        if (val & LSI_ISTAT0_SRST) {
> +            device_cold_reset(DEVICE(s));
> +            return;
> +        }
>         if (val & LSI_ISTAT0_ABRT) {
>             lsi_script_dma_interrupt(s, LSI_DSTAT_ABRT);
>         }
> @@ -1962,9 +1966,6 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
>             s->dsp = s->dnad;
>             lsi_execute_script(s);
>         }
> -        if (val & LSI_ISTAT0_SRST) {
> -            device_cold_reset(DEVICE(s));
> -        }
>         break;
>     case 0x16: /* MBOX0 */
>         s->mbox0 = val;
>