From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUYsq-00036D-T3 for qemu-devel@nongnu.org; Tue, 23 Apr 2013 04:47:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUYsp-0006fD-GT for qemu-devel@nongnu.org; Tue, 23 Apr 2013 04:47:28 -0400 Received: from goliath.siemens.de ([192.35.17.28]:17856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUYsp-0006f1-6h for qemu-devel@nongnu.org; Tue, 23 Apr 2013 04:47:27 -0400 Message-ID: <51764A9C.8000508@siemens.com> Date: Tue, 23 Apr 2013 10:47:24 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1343401379-19495-1-git-send-email-pbonzini@redhat.com> <1343401379-19495-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1343401379-19495-4-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 03/32] lsi: use qdev_reset_all List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On 2012-07-27 17:02, Paolo Bonzini wrote: > By first resetting the devices, lsi_soft_reset will find the queue > already cleared so there is no need to do that forcibly (which may also > leak SCSIRequests, and/or worse due to dangling references to the > lsi_request in the hba_private field). > > Signed-off-by: Paolo Bonzini > --- > hw/lsi53c895a.c | 15 +++------------ > 1 file changed, 3 insertions(+), 12 deletions(-) > > diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c > index 2fe141d..f04cc68 100644 > --- a/hw/lsi53c895a.c > +++ b/hw/lsi53c895a.c > @@ -282,8 +282,6 @@ static inline int lsi_irq_on_rsl(LSIState *s) > > static void lsi_soft_reset(LSIState *s) > { > - lsi_request *p; > - > DPRINTF("Reset\n"); > s->carry = 0; > > @@ -350,15 +348,8 @@ static void lsi_soft_reset(LSIState *s) > s->sbc = 0; > s->csbc = 0; > s->sbr = 0; > - while (!QTAILQ_EMPTY(&s->queue)) { > - p = QTAILQ_FIRST(&s->queue); > - QTAILQ_REMOVE(&s->queue, p, next); > - g_free(p); > - } > - if (s->current) { > - g_free(s->current); > - s->current = NULL; > - } > + assert(QTAILQ_EMPTY(&s->queue)); > + assert(!s->current); > } > > static int lsi_dma_40bit(LSIState *s) > @@ -1738,7 +1729,7 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val) > lsi_execute_script(s); > } > if (val & LSI_ISTAT0_SRST) { > - lsi_soft_reset(s); > + qdev_reset_all(&s->dev.qdev); What should ensure that all device resets are performed before the host reset? I'm asking as we just ran into the assert(!s->current) over 1.3.1. Or is there some patch from a later version missing (not seeing anything suspicious for lsi at least)? Thanks, Jan -- Siemens AG, Corporate Technology, CT RTC ITP SDP-DE Corporate Competence Center Embedded Linux