]> git.proxmox.com Git - mirror_qemu.git/commit
usb-ohci: DMA writeback bug fixes
authorWei Yang <weiyang@linux.vnet.ibm.com>
Thu, 8 Mar 2012 01:10:44 +0000 (12:10 +1100)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 13 Mar 2012 09:15:32 +0000 (10:15 +0100)
commit86e18cae209f8101ff9a6013a1ff6ae620c06944
treed77d552348fe1b467b945de52c817252e6c28f15
parentfcb70eca3f14349a0ef8e74dc808360f81592026
usb-ohci: DMA writeback bug fixes

This patch fixes two bugs in the OHCI device where the device writes
back data to system memory that should be exclusively under the
control of the guest side driver.

In OHCI specification Section 5.2.7, it mentioned "In all cases, Host
Controller Driver is responsible for the insertion and removal of all
Endpoint Descriptors in the various Host Controller Endpoint
Descriptor lists".  In the ohci_frame_boundary(), ohci_put_hcca()
writes the entire hcca back including the interrupt ED lists which
should be under driver control. This violates the specification and
can race with a host driver updating that list at the same time.

In the OHCI Spec Section 4.6, Transfer Descriptor Queue Processing, it
mentioned "Since the TD pointed to by TailP is not accessed by the HC,
the Host Controller Driver can initialize that TD and link at least
one other to it without creating a coherency or synchronization
problem".  While the function ohci_put_ed() writes the entire endpoint
descriptor back including the TailP which should under driver
control. This violate the specification and can race with a host
driver updating the TD list at the same time.

In each case the solution is to make sure we don't write data which is
under driver control.

Cc: Gerd Hoffman <kraxel@redhat.com>
Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-ohci.c