From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShKEQ-0007uH-23 for qemu-devel@nongnu.org; Wed, 20 Jun 2012 08:42:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShKEJ-0006eT-AN for qemu-devel@nongnu.org; Wed, 20 Jun 2012 08:41:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShKEJ-0006dT-0s for qemu-devel@nongnu.org; Wed, 20 Jun 2012 08:41:51 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5KCfnvf025563 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 20 Jun 2012 08:41:49 -0400 From: Gerd Hoffmann Date: Wed, 20 Jun 2012 14:41:45 +0200 Message-Id: <1340196107-6309-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1340196107-6309-1-git-send-email-kraxel@redhat.com> References: <1340196107-6309-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 2/4] ehci: fix td writeback List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Only write back the dwords the hc is supposed to update. Should not make a difference in theory as the guest must not touch the td while it is active to avoid races. But it is still more correct. Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-ehci.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index f5fc008..9fb6423 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -2070,6 +2070,7 @@ out: static int ehci_state_writeback(EHCIQueue *q) { EHCIPacket *p = QTAILQ_FIRST(&q->packets); + uint32_t *qtd, addr; int again = 0; /* Write back the QTD from the QH area */ @@ -2077,8 +2078,9 @@ static int ehci_state_writeback(EHCIQueue *q) assert(p->qtdaddr == q->qtdaddr); ehci_trace_qtd(q, NLPTR_GET(p->qtdaddr), (EHCIqtd *) &q->qh.next_qtd); - put_dwords(q->ehci, NLPTR_GET(p->qtdaddr), (uint32_t *) &q->qh.next_qtd, - sizeof(EHCIqtd) >> 2); + qtd = (uint32_t *) &q->qh.next_qtd; + addr = NLPTR_GET(p->qtdaddr); + put_dwords(q->ehci, addr + 2 * sizeof(uint32_t), qtd + 2, 2); ehci_free_packet(p); /* -- 1.7.1